private void MainForm_Load(object sender, EventArgs e) { // load languages for (int i = 0; i < CLanguages.Languages.Count; i++) { _languages_toolStripComboBox.Items.Add(CLanguages.Languages[i].Name); } _languages_toolStripComboBox.SelectedIndex = 0; __tabControl.Enabled = false; __tabControl.Visible = false; refresh_com(); COMPortInfo.Refresh_Devices(); // debug 탭 설정 if (Properties.Settings.Default.DEBUG == false) { __tabControl.TabPages.RemoveAt(6); } COMPortInfo.OnComRefreshed += OnCOMRefresh; CLanguages.SetLanguage(Properties.Settings.Default.CURRENTLANGUAGE); set_language(); _languages_toolStripComboBox.SelectedIndex = Properties.Settings.Default.CURRENTLANGUAGE; _skip_language = false; }
static void Main() { CLanguages.SetLanguage(0); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new MainForm()); }
private void __tabControl_SelectedIndexChanged(object sender, EventArgs e) { if (__tabControl.TabPages[__tabControl.SelectedIndex].Text == CLanguages.GetTranslate("PAGE_REPORTS_REPORTS")) { _com.SerialSend(ECMD.ROM_RAW); } }
private void __clearReportsCToolStripMenuItem_Click(object sender, EventArgs e) { if (MessageBox.Show(CLanguages.GetTranslate("MESSAGE_WARNING_REPORT_RESET").Replace("{0}", Environment.NewLine), CLanguages.GetTranslate("MESSAGE_ALERT"), MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { _com.SerialSend(ECMD.ROM_RESET); _com.SerialSend(ECMD.ROM_RAW); } }
public void set_language() { _modechannels_groupBox.Text = CLanguages.GetTranslate("PAGE_MODE_MODECHANNELS"); _mode1_label.Text = CLanguages.GetTranslate("PAGE_MODE_A"); _mode2_label.Text = CLanguages.GetTranslate("PAGE_MODE_B"); _mode3_label.Text = CLanguages.GetTranslate("PAGE_MODE_C"); _modeSetting_groupBox.Text = CLanguages.GetTranslate("PAGE_MODE_SETTING"); _mixMode_label.Text = CLanguages.GetTranslate("PAGE_MODE_MIX"); __default_button.Text = CLanguages.GetTranslate("PAGE_MODE_DEFAULT"); }
private void __reset_ToolStripMenuItem_Click(object sender, EventArgs e) { if (MessageBox.Show(CLanguages.GetTranslate("MESSAGE_WARNING_REPORT_RESET").Replace("{0}", Environment.NewLine), CLanguages.GetTranslate("MESSAGE_ALERT"), MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { Communication.EEPROM.reset(); byte[] buf = Communication.EEPROM.encode(); _com.SerialSend(ECMD.EEPROM_SET, buf); _com.SerialSend(ECMD.ROM_RESET); _com.SerialSend(ECMD.EEPROM_RAW); } }
private void _languages_toolStripComboBox_SelectedIndexChanged(object sender, EventArgs e) { if (!_skip_language) { CLanguages.SetLanguage(_languages_toolStripComboBox.SelectedIndex); set_language(); Properties.Settings.Default.CURRENTLANGUAGE = _languages_toolStripComboBox.SelectedIndex; Properties.Settings.Default.Save(); } }
public void set_language() { __install_groupBox.Text = CLanguages.GetTranslate("PAGE_MOUNT_NAME"); __fb_groupBox.Text = CLanguages.GetTranslate("PAGE_MOUNT_FRONTBACK"); __tb_groupBox.Text = CLanguages.GetTranslate("PAGE_MOUNT_TOPBOTTOM"); __backword_comboBox.Items.Clear(); __backword_comboBox.Items.Add(CLanguages.GetTranslate("PAGE_MOUNT_FRONT")); __backword_comboBox.Items.Add(CLanguages.GetTranslate("PAGE_MOUNT_BACK")); __reverse_comboBox.Items.Clear(); __reverse_comboBox.Items.Add(CLanguages.GetTranslate("PAGE_MOUNT_TOP")); __reverse_comboBox.Items.Add(CLanguages.GetTranslate("PAGE_MOUNT_BOTTOM")); }
public void set_language() { _channel_groupBox.Text = CLanguages.GetTranslate("PAGE_OUTPUT_CHANNEL"); _ich_default_button.Text = CLanguages.GetTranslate("PAGE_OUTPUT_DEFAULT"); _output_groupBox.Text = CLanguages.GetTranslate("PAGE_OTUPUT_OUTPUT"); _pulse_label.Text = CLanguages.GetTranslate("PAGE_OUTPUT_PULSE"); _min_label.Text = CLanguages.GetTranslate("PAGE_OUTPUT_MIN"); _max_label.Text = CLanguages.GetTranslate("PAGE_OUTPUT_MAX"); _center_label.Text = CLanguages.GetTranslate("PAGE_OUTPUT_CENTER"); _default_trim_button.Text = CLanguages.GetTranslate("PAGE_OUTPUT_DEFAULT"); //_save_button.Text = Languages.PAGE_OUTPUT_SAVE; }
public void set_language() { _protocol_groupBox.Text = CLanguages.GetTranslate("PAGE_RADIO_PROTOCOL"); _hz_label.Text = CLanguages.GetTranslate("PAGE_RADIO_RADIOHZ"); _input_label.Text = CLanguages.GetTranslate("PAGE_RADIO_INPUTCHANNELS"); _calibration_groupBox.Text = CLanguages.GetTranslate("PAGE_RADIO_CALIBRATION"); _min_label.Text = CLanguages.GetTranslate("PAGE_RADIO_MIN"); _center_label.Text = CLanguages.GetTranslate("PAGE_RADIO_CENTER"); _max_label.Text = CLanguages.GetTranslate("PAGE_RADIO_MAX"); _default_button.Text = _ich_default_button.Text = CLanguages.GetTranslate("PAGE_RADIO_DEFAULT"); _save_radio_button.Text = CLanguages.GetTranslate("PAGE_RADIO_SAVE"); }
private void openToolStripMenuItem_Click(object sender, EventArgs e) { // eeprom load OpenFileDialog ofd = new OpenFileDialog(); ofd.Filter = "CPM files | *.cpm"; ofd.DefaultExt = "cpm"; if (_com.IsOpen) { if (ofd.ShowDialog() == DialogResult.OK) { if (MessageBox.Show(CLanguages.GetTranslate(".MESSAGE_OVERWRITE_CPM"), "Custompilot", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { Communication.EEPROM.decode(_file.LoadEEPROMDATA(ofd.FileName)); _com.SerialSend(ECMD.EEPROM_SET, Communication.EEPROM.encode()); } } } }
private void __uC_TabFirmware_On_BootloaderUploadMode(object sender, EventArgs e) { firm_dowing(); _com.SerialStop(); if (__com_toolStripComboBox.SelectedIndex < 0) { MessageBox.Show(CLanguages.GetTranslate("MESSAGE_COM_SELECT"), CLanguages.GetTranslate("MESSAGE_ERROR"), MessageBoxButtons.OK, MessageBoxIcon.Error); } else { try { __uC_TabFirmware.COMPORT = COMPortInfo.GetCOMPortsInfo()[__com_toolStripComboBox.SelectedIndex].Name; __uC_TabFirmware.UploadFirmware(); }catch { MessageBox.Show("Please try again in a few minutes.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void __uC_TabFirmware_On_BootloaderMode(object sender, EventArgs e) { firm_dowing(); _com.SerialStop(); if (__com_toolStripComboBox.SelectedIndex < 0) { MessageBox.Show(CLanguages.GetTranslate("MESSAGE_COM_SELECT"), CLanguages.GetTranslate("MESSAGE_ERROR"), MessageBoxButtons.OK, MessageBoxIcon.Error); } else { try { __uC_TabFirmware.COMPORT = COMPortInfo.GetCOMPortsInfo()[__com_toolStripComboBox.SelectedIndex].Name; __uC_TabFirmware.DownloadFirmware(); } catch { Console.WriteLine("firmware down 올바른 com 포트가 없습니다."); } } }
public void set_language() { _information_groupBox.Text = CLanguages.GetTranslate("PAGE_FIRM_INFORMATION"); _id_label.Text = CLanguages.GetTranslate("PAGE_FIRM_PRODUCTID"); _firmware_label.Text = CLanguages.GetTranslate("PAGE_FIRM_FIRMWARE"); //_name_label.Text = CLanguages.GetTranslate("PAGE_FIRM_NAME"); _firmwareBackup_groupBox.Text = CLanguages.GetTranslate("PAGE_FIRM_FIRMWAREBACKUP"); _file_label1.Text = CLanguages.GetTranslate("PAGE_FIRM_FILE"); _firmware_down_open_file_button.Text = CLanguages.GetTranslate("PAGE_FIRM_SAVE"); _ver_label1.Text = CLanguages.GetTranslate("PAGE_FIRM_VER"); _state_label1.Text = CLanguages.GetTranslate("PAGE_FIRM_STATE"); _firmware_dowload_button.Text = CLanguages.GetTranslate("PAGE_FIRM_DOWNLOAD"); _firmwareUpload_groupBox.Text = CLanguages.GetTranslate("PAGE_FIRM_FIRMWAREUPLOAD"); _file_label2.Text = CLanguages.GetTranslate("PAGE_FIRM_FILE"); _firmware_up_open_file_button.Text = CLanguages.GetTranslate("PAGE_FIRM_OPEN"); _ver_label2.Text = CLanguages.GetTranslate("PAGE_FIRM_VER"); _state_label2.Text = CLanguages.GetTranslate("PAGE_FIRM_STATE"); _firmware_upload_button.Text = CLanguages.GetTranslate("PAGE_FIRM_UPLOAD"); _console_groupBox.Text = CLanguages.GetTranslate("PAGE_FIRM_CONSOLE"); }
public About() { InitializeComponent(); this.Text = CLanguages.GetTranslate("FORM_ABOUT_CAPTION"); }
private void set_language() { // main menu fileFToolStripMenuItem.Text = CLanguages.GetTranslate("MENU_FILE"); __openToolStripMenuItem.Text = CLanguages.GetTranslate("MENU_OPEN"); __saveOToolStripMenuItem.Text = CLanguages.GetTranslate("MENU_SAVE"); __exitXToolStripMenuItem.Text = CLanguages.GetTranslate("MENU_EXIT"); // setting menu __settingSToolStripMenuItem.Text = CLanguages.GetTranslate("MENU_SETTING"); imutoolStripMenuItem.Text = CLanguages.GetTranslate("MENU_IMU"); factoryreset_ToolStripMenuItem.Text = CLanguages.GetTranslate("MENU_FACTORYRESET"); __IMUCalibrationToolStripMenuItem.Text = CLanguages.GetTranslate("MENU_IMU_CAL"); // buttons __connect_toolStripButton.Text = CLanguages.GetTranslate("MENU_CONNECT"); __firmver_toolStripLabel.Text = CLanguages.GetTranslate("MENU_FIRMWAREVER"); // menu help __helpHToolStripMenuItem.Text = CLanguages.GetTranslate("MENU_HELP"); __aboutAToolStripMenuItem.Text = CLanguages.GetTranslate("MENU_HELP_ABOUT"); __onlineSupportToolStripMenuItem.Text = CLanguages.GetTranslate("MENU_HELP_SUPPORT"); __installUSBDriverToolStripMenuItem.Text = CLanguages.GetTranslate("MENU_HELP_DRIVER"); __tESTTToolStripMenuItem.Text = CLanguages.GetTranslate("MENU_HELP_TEST"); // support __supportToolStripMenuItem.Text = CLanguages.GetTranslate("MENU_SUPPORT"); __userLanguageToolStripMenuItem.Text = CLanguages.GetTranslate("MENU_USERLANGUAGE"); __productsToolStripMenuItem.Text = CLanguages.GetTranslate("MENU_PRODUCTS"); __manualToolStripMenuItem.Text = CLanguages.GetTranslate("MENU_MANUAL"); __firmware1.Text = CLanguages.GetTranslate("MENU_SUPPORT_FIRMWARE1"); __firmware2.Text = CLanguages.GetTranslate("MENU_SUPPORT_FIRMWARE2"); __pCManager.Text = CLanguages.GetTranslate("MENU_SUPPORT_PCMANAGER"); // tabs //__firmware_tabPage.Text = CLanguages.GetTranslate("TAB_FIRMWARE; __radio_tabPage.Text = CLanguages.GetTranslate("TAB_RADIO"); __mode_tabPage.Text = CLanguages.GetTranslate("TAB_MODE"); _output_tabPage.Text = CLanguages.GetTranslate("TAB_OUTPUT"); __sensors_tabPage.Text = CLanguages.GetTranslate("TAB_SENSOR"); __reports_tabPage.Text = CLanguages.GetTranslate("TAB_REPORT"); __mount_tabPage.Text = CLanguages.GetTranslate("TAB_BOARD"); // firmware page set __uC_TabFirmware.set_language(); // radio page set _uC_RadioTab.set_language(); // mode page set __uC_FlightModeWindow.set_language(); // output page set _uC_ServoWindow.set_language(); // reports page set __uC_Reports.set_language(); // mount page set __uC_Mount.set_language(); }
private void __timer_serial_Tick(object sender, EventArgs e) { if (_com.IsOpen) { _com.Do_comm(); List <Serial.s_comstack> packets = _com.Recv(); if (packets != null) { foreach (Serial.s_comstack packet in packets) { switch (packet.cmd) { case ECMD.VERSION: string version = string.Format("{0, 1:D1}.{1, 2:D2}.{2, 3:D3}", packet.data[0], packet.data[1], packet.data[2]); __firmver_toolStripLabel.Text = "Firmware Ver: " + version; __uC_TabFirmware.Version = version; _com.SerialSend(ECMD.EEPROM_RAW); _uC_RadioTab.setRadioSet(packet.data[1]); break; case ECMD.EEPROM_RAW: _islockname = true; Communication.EEPROM.decode(packet.data); _uC_RadioTab.Decode_EEPROM(); _uC_ServoWindow.Decode_EEPROM(); __uC_FlightModeWindow.Decode_EEPROM(); __uC_TabFirmware.pid = Communication.EEPROM.plane.license.ToString(); _devicename__toolStripTextBox.Text = Encoding.Unicode.GetString(Communication.EEPROM.plane.name64).Trim(); __uC_Mount.Decode_EEPROM(); if (Communication.EEPROM.mpu.calibration.accs[2] == 0) { __uc_HUD.CalibrationWarning = true; _isCalibrationWarning = true; } else { __uc_HUD.CalibrationWarning = false; } _islockname = false; break; case ECMD.RADIO_RAW: _uC_RadioTab.Decode_radio(packet.data); _uC_RadioTab.radio_hz = BitConverter.ToInt16(packet.data, 64); _uC_RadioTab.radio_fhz = BitConverter.ToInt16(packet.data, 64 + 2); if (packet.data[64 + 4] != 0) { _uC_RadioTab.IsFailsafe = true; } else { _uC_RadioTab.IsFailsafe = false; } if (packet.data[64 + 5] != 0) { _uC_RadioTab.IsNosignal = true; _uC_ServoWindow.IsFailsafe = true; } else { _uC_RadioTab.IsNosignal = false; _uC_ServoWindow.IsFailsafe = false; } break; case ECMD.TMODE: __uC_FlightModeWindow.Decode_raw(packet.data); break; case ECMD.LOOPTIME: // parse looptime ___looptime_toolStripStatusLabel.Text = String.Format("Looptime: {0, 4:D3}", BitConverter.ToInt16(packet.data, 0)); if (_isCalibrationWarning && _isCalibrationWarning_flashing) { __ypr_toolStripStatusLabel.Text = "Calibration Warning!!!"; _isCalibrationWarning_flashing = false; __ypr_toolStripStatusLabel.BackColor = Color.Red; } else { __ypr_toolStripStatusLabel.Text = String.Format("ypr:{0, 6:F1}{1, 6:F1}{2, 6:F1}", BitConverter.ToSingle(packet.data, 2), BitConverter.ToSingle(packet.data, 6), BitConverter.ToSingle(packet.data, 10)); __ypr_toolStripStatusLabel.BackColor = this.BackColor; _isCalibrationWarning_flashing = true; } if (packet.data.Length > 14) { double voltage = ((float)(UInt16)packet.data[28]) / 10.0; if (voltage < 4.5) { ___vcc_toolStripStatusLabel.BackColor = Color.Red; } else { ___vcc_toolStripStatusLabel.BackColor = this.BackColor; } ___vcc_toolStripStatusLabel.Text = String.Format("VCC: {0, 3:F1}", voltage); UInt16 temp = ((UInt16)packet.data[29]); ___temp_toolStripStatusLabel.Text = String.Format("temp: {0, 2:D2} ℃", temp); if (temp > 70) { ___temp_toolStripStatusLabel.BackColor = Color.Orange; } else if (temp > 85) { ___temp_toolStripStatusLabel.BackColor = Color.Red; } else { ___temp_toolStripStatusLabel.BackColor = this.BackColor; } UInt16 error_count = BitConverter.ToUInt16(packet.data, 26); if (error_count > 0) { ___err_toolStripStatusLabel.BackColor = Color.Red; } else { ___err_toolStripStatusLabel.BackColor = this.BackColor; } ___err_toolStripStatusLabel.Text = String.Format("err: {0, 5:D1}", error_count); ushort wdt = (ushort)packet.data[30]; ushort reports = (ushort)packet.data[31]; if (wdt > 0) { ___report_toolStripStatusLabel.BackColor = Color.Red; } else if (reports > 0) { ___report_toolStripStatusLabel.BackColor = Color.Orange; } else { ___report_toolStripStatusLabel.BackColor = this.BackColor; } ___report_toolStripStatusLabel.Text = String.Format("Reports: {0, 5:D1}", reports + wdt); if (packet.data.Length > 30) { ___gforce_toolStripStatusLabel.Text = String.Format("G:{0, 6:F1}{1, 6:F1}{2, 6:F1}", BitConverter.ToSingle(packet.data, 14), BitConverter.ToSingle(packet.data, 18), BitConverter.ToSingle(packet.data, 22)); } } __uc_HUD.Roll = 360 - (BitConverter.ToSingle(packet.data, 2) - 180); __uc_HUD.Pitch = BitConverter.ToSingle(packet.data, 6) - 180; __uc_HUD.Heading = BitConverter.ToSingle(packet.data, 10) - 180; __uc_HUD.Draw(); break; case ECMD.SERVO_RAW: _uC_ServoWindow.Decode_Servos(packet.data); if (packet.data[24] != 0) { _uC_ServoWindow.IsFailsafe = true; } else { _uC_ServoWindow.IsFailsafe = false; } break; case ECMD.ERROR: Console.WriteLine("Error packet received."); break; case ECMD.ROM_RAW: __uC_Reports.DecodeData(packet.data); break; } } } if (__connect_toolStripButton.Text == CLanguages.GetTranslate("MENU_CONNECT")) { // com 연결 됨 __refresh_toolStripButton.Enabled = false; __connect_toolStripButton.Text = CLanguages.GetTranslate("MENU_DISCONNECT"); __tabControl.Enabled = true; __tabControl.Visible = true; __uC_TabFirmware.Visible = false; __uC_TabFirmware.IsConnected = true; __com_toolStripComboBox.Enabled = false; Properties.Settings.Default.LASTCOMDEVICE = __com_toolStripComboBox.Text; Properties.Settings.Default.Save(); __settingSToolStripMenuItem.Enabled = true; __openToolStripMenuItem.Enabled = true; __saveOToolStripMenuItem.Enabled = true; _devicename__toolStripTextBox.Enabled = true; //tabpage_enabled(true); } else { // 2. 현재 탭 정보 요구 0.2초 마다 버젼 정보를 받아온 경우만,,, TimeSpan span = DateTime.Now - _preTime; if (span.TotalMilliseconds >= _chktime) { //return; _preTime = DateTime.Now; // 현재탭 확인 if (__tabControl.SelectedTab.Text == CLanguages.GetTranslate("TAB_RADIO")) { // Radio calibration _com.SerialSend(ECMD.RADIO_RAW); } else if (__tabControl.SelectedTab.Text == CLanguages.GetTranslate("TAB_OUTPUT")) { _com.SerialSend(ECMD.SERVO_RAW); } else if (__tabControl.SelectedTab.Text == CLanguages.GetTranslate("TAB_MODE")) { _com.SerialSend(ECMD.TMODE); } } span = DateTime.Now - _preTime_1s; if (span.TotalMilliseconds >= 200) { if (Communication.EEPROM.plane.initialized == Communication.Initializecode) { _preTime_1s = DateTime.Now; _com.SerialSend(ECMD.LOOPTIME); _chktime = 200; } else { // 초기화 안됨 } } } } else { if (__connect_toolStripButton.Text == CLanguages.GetTranslate("MENU_DISCONNECT")) { // com 끊김 __refresh_toolStripButton.Enabled = true; __connect_toolStripButton.Text = CLanguages.GetTranslate("MENU_CONNECT"); __connect_toolStripButton.Enabled = true; __tabControl.SelectedTab = __tabControl.TabPages[0]; __com_toolStripComboBox.Enabled = true; __firmver_toolStripLabel.Text = "Firmware Ver. "; __uC_TabFirmware.IsConnected = false; __uC_TabFirmware.Visible = true; __settingSToolStripMenuItem.Enabled = false; _devicename__toolStripTextBox.Enabled = false; __tabControl.Enabled = false; __tabControl.Visible = false; __openToolStripMenuItem.Enabled = false; __saveOToolStripMenuItem.Enabled = false; } } // imu 캘리브레이션 체크 TimeSpan sp = DateTime.Now - _imuCalc; if (sp.TotalSeconds > 0 && sp.TotalSeconds < 2) { _imuCalc = DateTime.Now.AddMinutes(-1); _com.SerialSend(ECMD.EEPROM_RAW); } }
public void set_language() { _reports_groupBox.Text = CLanguages.GetTranslate("PAGE_REPORTS_REPORTS"); __export_button.Text = CLanguages.GetTranslate("PAGE_REPORTS_EXPORT"); ___reset_button.Text = CLanguages.GetTranslate("PAGE_REPORTS_RESET"); }