@@ -29,6 +29,12 @@ public partial class GimbalVideoControl : UserControl, IMessageFilter
2929 // logger
3030 private static readonly ILog log = LogManager . GetLogger ( System . Reflection . MethodBase . GetCurrentMethod ( ) . DeclaringType ) ;
3131
32+ // Uncomment the Console.WriteLine line to enable debug output.
33+ private static void DebugConsoleWrite ( string format , params object [ ] args )
34+ {
35+ // Console.WriteLine(format, args);
36+ }
37+
3238 private GimbalControlSettings preferences = new GimbalControlSettings ( ) ;
3339
3440 private readonly GStreamer _stream = new GStreamer ( ) ;
@@ -433,7 +439,7 @@ private void HandleHeldKeys()
433439 previousPitchRate = pitch ;
434440 previousYawRate = yaw ;
435441 selectedGimbalManager ? . SetRatesCommandAsync ( pitch , yaw , yaw_lock , selectedGimbalID ) ;
436- Console . WriteLine ( $ "Pitch: { pitch } , Yaw: { yaw } " ) ;
442+ DebugConsoleWrite ( "Pitch: {0 }, Yaw: {1}" , pitch , yaw ) ;
437443 }
438444
439445 float zoom = 0 ;
@@ -452,7 +458,7 @@ private void HandleHeldKeys()
452458 {
453459 previousZoomRate = zoom ;
454460 selectedCamera ? . SetZoomAsync ( zoom , CAMERA_ZOOM_TYPE . ZOOM_TYPE_CONTINUOUS ) ;
455- Console . WriteLine ( $ "Zoom: { zoom } " ) ;
461+ DebugConsoleWrite ( "Zoom: {0}" , zoom ) ;
456462 }
457463 }
458464
@@ -506,7 +512,7 @@ private void HandleKeyPress(Keys key)
506512
507513 private void TakePicture ( )
508514 {
509- Console . WriteLine ( "Take picture" ) ;
515+ DebugConsoleWrite ( "Take picture" ) ;
510516 selectedCamera ? . TakeSinglePictureAsync ( ) ;
511517 }
512518
@@ -515,46 +521,46 @@ private void SetRecording(bool start)
515521 isRecording = start ;
516522 if ( start )
517523 {
518- Console . WriteLine ( "Start recording" ) ;
524+ DebugConsoleWrite ( "Start recording" ) ;
519525 selectedCamera ? . StartRecordingAsync ( ) ;
520526 }
521527 else
522528 {
523- Console . WriteLine ( "Stop recording" ) ;
529+ DebugConsoleWrite ( "Stop recording" ) ;
524530 selectedCamera ? . StopRecordingAsync ( ) ;
525531 }
526532 }
527533
528534 private void SetYawLock ( bool locked )
529535 {
530536 string message = locked ? "lock" : "follow" ;
531- Console . WriteLine ( $ "Set yaw { message } " ) ;
537+ DebugConsoleWrite ( "Set yaw {0}" , message ) ;
532538 yaw_lock = locked ;
533539 yawLockToolStripMenuItem . Checked = locked ;
534540 selectedGimbalManager ? . SetRatesCommandAsync ( previousPitchRate , previousYawRate , yaw_lock , selectedGimbalID ) ;
535541 }
536542
537543 private void Retract ( )
538544 {
539- Console . WriteLine ( "Retract" ) ;
545+ DebugConsoleWrite ( "Retract" ) ;
540546 selectedGimbalManager ? . RetractAsync ( ) ;
541547 }
542548
543549 private void Neutral ( )
544550 {
545- Console . WriteLine ( "Neutral" ) ;
551+ DebugConsoleWrite ( "Neutral" ) ;
546552 selectedGimbalManager ? . NeutralAsync ( ) ;
547553 }
548554
549555 private void PointDown ( )
550556 {
551- Console . WriteLine ( "Point down" ) ;
557+ DebugConsoleWrite ( "Point down" ) ;
552558 selectedGimbalManager ? . SetAnglesCommandAsync ( - 90 , 0 , false , selectedGimbalID ) ;
553559 }
554560
555561 private void Home ( )
556562 {
557- Console . WriteLine ( "Home" ) ;
563+ DebugConsoleWrite ( "Home" ) ;
558564 var loc = MainV2 . comPort ? . MAV ? . cs . HomeLocation ;
559565 selectedGimbalManager ? . SetROILocationAsync ( loc . Lat , loc . Lng , loc . Alt , frame : MAV_FRAME . GLOBAL ) ;
560566 }
@@ -632,8 +638,8 @@ private void VideoBox_Click(object sender, EventArgs e)
632638 return ;
633639 }
634640 q = attitude * q ;
635- Console . WriteLine ( "Attitude: {0:0.0} {1:0.0} {2:0.0}" , attitude . get_euler_yaw ( ) * MathHelper . rad2deg , attitude . get_euler_pitch ( ) * MathHelper . rad2deg , attitude . get_euler_roll ( ) * MathHelper . rad2deg ) ;
636- Console . WriteLine ( "New: {0:0.0} {1:0.0} {2:0.0}" , q . get_euler_yaw ( ) * MathHelper . rad2deg , q . get_euler_pitch ( ) * MathHelper . rad2deg , q . get_euler_roll ( ) * MathHelper . rad2deg ) ;
641+ DebugConsoleWrite ( "Attitude: {0:0.0} {1:0.0} {2:0.0}" , attitude . get_euler_yaw ( ) * MathHelper . rad2deg , attitude . get_euler_pitch ( ) * MathHelper . rad2deg , attitude . get_euler_roll ( ) * MathHelper . rad2deg ) ;
642+ DebugConsoleWrite ( "New: {0:0.0} {1:0.0} {2:0.0}" , q . get_euler_yaw ( ) * MathHelper . rad2deg , q . get_euler_pitch ( ) * MathHelper . rad2deg , q . get_euler_roll ( ) * MathHelper . rad2deg ) ;
637643
638644 selectedGimbalManager ? . SetAttitudeAsync ( q , yaw_lock , selectedGimbalID ) ;
639645
@@ -766,10 +772,9 @@ private void AutoConnectTimerCallback(object sender, System.Timers.ElapsedEventA
766772 {
767773 if ( CameraProtocol . VideoStreams . Count < 1 )
768774 {
769- Console . Write ( "Requesting video stream information..." ) ;
770775 // We must not have any reported video streams. Try to request them.
771776 selectedCamera ? . RequestVideoStreamInformation ( ) ;
772- Console . WriteLine ( " done. ") ;
777+ DebugConsoleWrite ( "Requested video stream information ") ;
773778 // Come back later and see if any streams have been reported
774779 AutoConnectTimer . Start ( ) ;
775780 return ;
0 commit comments