bool getFirmware(uploader.Uploader.Code device) { // was https://raw.github.com/tridge/SiK/master/Firmware/dst/radio.hm_trp.hex // now http://www.samba.org/tridge/UAV/3DR/radio.hm_trp.hex if (device == uploader.Uploader.Code.DEVICE_ID_HM_TRP) { return(Common.getFilefromNet("http://www.samba.org/tridge/UAV/3DR/radio.hm_trp.hex", firmwarefile)); } else if (device == uploader.Uploader.Code.DEVICE_ID_RFD900) { return(Common.getFilefromNet("http://rfdesign.com.au/firmware/radio.rfd900.hex", firmwarefile)); } else if (device == uploader.Uploader.Code.DEVICE_ID_RFD900A) { int fixme; int fixme23; // return Common.getFilefromNet("http://rfdesign.com.au/firmware/MPSiK%20V2.2%20radio~rfd900a.ihx", firmwarefile); return(Common.getFilefromNet("http://rfdesign.com.au/firmware/radio.rfd900a.hex", firmwarefile)); } else { return(false); } }
bool getFirmware(uploader.Uploader.Code device) { // was https://raw.github.com/tridge/SiK/master/Firmware/dst/radio.hm_trp.hex // now http://www.samba.org/tridge/UAV/3DR/radio.hm_trp.hex if (device == uploader.Uploader.Code.DEVICE_ID_HM_TRP) { return(Common.getFilefromNet("http://www.samba.org/tridge/UAV/3DR/radio.hm_trp.hex", firmwarefile)); } else if (device == uploader.Uploader.Code.DEVICE_ID_RFD900) { return(Common.getFilefromNet("http://www.samba.org/tridge/UAV/3DR/radio.rfd900.hex", firmwarefile)); } else { return(false); } }
private void BUT_getcurrent_Click(object sender, EventArgs e) { ArdupilotMega.Comms.ICommsSerial comPort = new SerialPort(); try { comPort.PortName = MainV2.comPort.BaseStream.PortName; comPort.BaudRate = MainV2.comPort.BaseStream.BaudRate; comPort.ReadTimeout = 4000; comPort.Open(); } catch { CustomMessageBox.Show("Invalid ComPort or in use"); return; } lbl_status.Text = "Connecting"; if (doConnect(comPort)) { // cleanup doCommand(comPort, "AT&T"); comPort.DiscardInBuffer(); lbl_status.Text = "Doing Command ATI & RTI"; ATI.Text = doCommand(comPort, "ATI"); RTI.Text = doCommand(comPort, "RTI"); uploader.Uploader.Code freq = (uploader.Uploader.Code)Enum.Parse(typeof(uploader.Uploader.Code), doCommand(comPort, "ATI3")); uploader.Uploader.Code board = (uploader.Uploader.Code)Enum.Parse(typeof(uploader.Uploader.Code), doCommand(comPort, "ATI2")); ATI3.Text = freq.ToString(); // 8 and 9 if (freq == uploader.Uploader.Code.FREQ_915) { S8.DataSource = Range(895000, 1000, 935000); RS8.DataSource = Range(895000, 1000, 935000); S9.DataSource = Range(895000, 1000, 935000); RS9.DataSource = Range(895000, 1000, 935000); } else if (freq == uploader.Uploader.Code.FREQ_433) { S8.DataSource = Range(414000, 100, 454000); RS8.DataSource = Range(414000, 100, 454000); S9.DataSource = Range(414000, 100, 454000); RS9.DataSource = Range(414000, 100, 454000); } if (board == uploader.Uploader.Code.DEVICE_ID_RFD900 || board == uploader.Uploader.Code.DEVICE_ID_RFD900A) { S4.DataSource = Range(1, 1, 30); RS4.DataSource = Range(1, 1, 30); } RSSI.Text = doCommand(comPort, "ATI7").Trim(); lbl_status.Text = "Doing Command ATI5"; string answer = doCommand(comPort, "ATI5"); string[] items = answer.Split('\n'); foreach (string item in items) { if (item.StartsWith("S")) { string[] values = item.Split(':', '='); if (values.Length == 3) { Control[] controls = this.Controls.Find(values[0].Trim(), true); if (controls.Length > 0) { if (controls[0].GetType() == typeof(CheckBox)) { ((CheckBox)controls[0]).Checked = values[2].Trim() == "1"; } else { controls[0].Text = values[2].Trim(); } } } } } // remote foreach (Control ctl in groupBox2.Controls) { if (ctl.Name.StartsWith("RS") && ctl.Name != "RSSI") { ctl.ResetText(); } } comPort.DiscardInBuffer(); lbl_status.Text = "Doing Command RTI5"; answer = doCommand(comPort, "RTI5"); items = answer.Split('\n'); foreach (string item in items) { if (item.StartsWith("S")) { string[] values = item.Split(':', '='); if (values.Length == 3) { Control[] controls = this.Controls.Find("R" + values[0].Trim(), true); if (controls.Length == 0) { continue; } if (controls[0].GetType() == typeof(CheckBox)) { ((CheckBox)controls[0]).Checked = values[2].Trim() == "1"; } else if (controls[0].GetType() == typeof(TextBox)) { ((TextBox)controls[0]).Text = values[2].Trim(); } else if (controls[0].GetType() == typeof(ComboBox)) { ((ComboBox)controls[0]).Text = values[2].Trim(); } } else { log.Info("Odd config line :" + item); } } } // off hook doCommand(comPort, "ATO"); lbl_status.Text = "Done"; } else { // off hook doCommand(comPort, "ATO"); lbl_status.Text = "Fail"; CustomMessageBox.Show("Failed to enter command mode"); } comPort.Close(); BUT_Syncoptions.Enabled = true; BUT_savesettings.Enabled = true; }
void WriteBootloaderCode(uploader.Uploader.Code Code) { byte[] ToSend = new byte[] { (byte)Code }; _Port.Write(ToSend, 0, 1); }