/// <summary> /// keyboard shortcuts override /// </summary> /// <param name="msg"></param> /// <param name="keyData"></param> /// <returns></returns> protected override bool ProcessCmdKey(ref Message msg, Keys keyData) { if (keyData == Keys.F12) { MenuConnect_Click(null, null); return true; } if (keyData == Keys.F2) { MenuFlightData_Click(null, null); return true; } if (keyData == Keys.F3) { MenuFlightPlanner_Click(null, null); return true; } if (keyData == Keys.F4) { MenuTuning_Click(null, null); return true; } if (keyData == Keys.F5) { comPort.getParamList(); MyView.ShowScreen(MyView.current.Name); return true; } if (keyData == (Keys.Control | Keys.F)) // temp { Form frm = new temp(); ThemeManager.ApplyThemeTo(frm); frm.Show(); return true; } /*if (keyData == (Keys.Control | Keys.S)) // screenshot { ScreenShot(); return true; }*/ if (keyData == (Keys.Control | Keys.G)) // nmea out { Form frm = new SerialOutputNMEA(); ThemeManager.ApplyThemeTo(frm); frm.Show(); return true; } if (keyData == (Keys.Control | Keys.X)) // select sysid { MissionPlanner.Controls.SysidSelector id = new SysidSelector(); id.TopMost = true; id.Show(); return true; } if (keyData == (Keys.Control | Keys.L)) // limits { return true; } if (keyData == (Keys.Control | Keys.W)) // test ac config { return true; } if (keyData == (Keys.Control | Keys.Z)) { MissionPlanner.GenOTP otp = new MissionPlanner.GenOTP(); otp.ShowDialog(this); return true; } if (keyData == (Keys.Control | Keys.T)) // for override connect { try { MainV2.comPort.Open(false); } catch (Exception ex) { CustomMessageBox.Show(ex.ToString()); } return true; } if (keyData == (Keys.Control | Keys.Y)) // for ryan beall and ollyw42 { // write try { MainV2.comPort.doCommand(MAVLink.MAV_CMD.PREFLIGHT_STORAGE, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); } catch { CustomMessageBox.Show("Invalid command"); return true; } //read ///////MainV2.comPort.doCommand(MAVLink09.MAV_CMD.PREFLIGHT_STORAGE, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); CustomMessageBox.Show("Done MAV_ACTION_STORAGE_WRITE"); return true; } if (keyData == (Keys.Control | Keys.J)) { /* var test = MainV2.comPort.GetLogList(); foreach (var item in test) { var ms = comPort.GetLog(item.id); using (BinaryWriter bw = new BinaryWriter(File.OpenWrite("test" + item.id + ".bin"))) { bw.Write(ms.ToArray()); } var temp1 = Log.BinaryLog.ReadLog("test" + item.id + ".bin"); File.WriteAllLines("test" + item.id + ".log", temp1); }*/ return true; } return base.ProcessCmdKey(ref msg, keyData); }
/// <summary> /// keyboard shortcuts override /// </summary> /// <param name="msg"></param> /// <param name="keyData"></param> /// <returns></returns> protected override bool ProcessCmdKey(ref Message msg, Keys keyData) { if (keyData == Keys.F12) { MenuConnect_Click(null, null); return true; } if (keyData == Keys.F2) { MenuFlightData_Click(null,null); return true; } if (keyData == Keys.F3) { MenuFlightPlanner_Click(null, null); return true; } if (keyData == Keys.F4) { MenuTuning_Click(null, null); return true; } if (keyData == Keys.F5) { comPort.getParamList(); MyView.ShowScreen(MyView.current.Name); return true; } if (keyData == (Keys.Control | Keys.F)) // temp { Form frm = new temp(); ThemeManager.ApplyThemeTo(frm); frm.Show(); return true; } /*if (keyData == (Keys.Control | Keys.S)) // screenshot { ScreenShot(); return true; }*/ if (keyData == (Keys.Control | Keys.G)) // nmea out { Form frm = new SerialOutputNMEA(); ThemeManager.ApplyThemeTo(frm); frm.Show(); return true; } if (keyData == (Keys.Control | Keys.L)) // limits { Form temp = new Form(); Control frm = new GCSViews.ConfigurationView.ConfigAP_Limits(); temp.Controls.Add(frm); temp.Size = frm.Size; frm.Dock = DockStyle.Fill; ThemeManager.ApplyThemeTo(temp); temp.Show(); return true; } if (keyData == (Keys.Control | Keys.W)) // test ac config { Wizard.Wizard cfg = new Wizard.Wizard(); cfg.ShowDialog(this); return true; } if (keyData == (Keys.Control | Keys.Z)) // test ac config { MissionPlanner.GenOTP otp = new MissionPlanner.GenOTP(); otp.ShowDialog(this); return true; } if (keyData == (Keys.Control | Keys.T)) // for override connect { try { MainV2.comPort.Open(false); } catch (Exception ex) { CustomMessageBox.Show(ex.ToString()); } return true; } if (keyData == (Keys.Control | Keys.Y)) // for ryan beall { // write try { MainV2.comPort.doCommand(MAVLink.MAV_CMD.PREFLIGHT_STORAGE, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); } catch { CustomMessageBox.Show("Invalid command"); return true; } //read ///////MainV2.comPort.doCommand(MAVLink09.MAV_CMD.PREFLIGHT_STORAGE, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); CustomMessageBox.Show("Done MAV_ACTION_STORAGE_WRITE"); return true; } if (keyData == (Keys.Control | Keys.J)) // for jani { string data = "!!"; if (System.Windows.Forms.DialogResult.OK == InputBox.Show("inject", "enter data to be written", ref data)) { MainV2.comPort.Write(data + "\r"); } return true; } return base.ProcessCmdKey(ref msg, keyData); }