@@ -55,9 +55,7 @@ motors.initialize = async function (callback) {
5555 // Update filtering defaults based on API version
5656 const FILTER_DEFAULT = FC . getFilterDefaults ( ) ;
5757
58- if ( GUI . active_tab != 'motors' ) {
59- GUI . active_tab = 'motors' ;
60- }
58+ GUI . active_tab = 'motors' ;
6159
6260 await MSP . promise ( MSPCodes . MSP_STATUS ) ;
6361 await MSP . promise ( MSPCodes . MSP_PID_ADVANCED ) ;
@@ -884,7 +882,7 @@ motors.initialize = async function (callback) {
884882 ] ;
885883
886884 motorsEnableTestModeElement . on ( 'change' , function ( ) {
887- let enabled = $ ( this ) . is ( ':checked' ) ;
885+ let enabled = motorsEnableTestModeElement . is ( ':checked' ) ;
888886 // prevent or disable testing if configHasChanged flag is set.
889887 if ( self . configHasChanged ) {
890888 if ( enabled ) {
@@ -900,17 +898,13 @@ motors.initialize = async function (callback) {
900898 if ( motorsEnableTestModeElement . is ( ':checked' ) ) {
901899 if ( ! ignoreKeys . includes ( e . code ) ) {
902900 motorsEnableTestModeElement . prop ( 'checked' , false ) . trigger ( 'change' ) ;
901+ document . removeEventListener ( 'keydown' , evt => disableMotorTest ( evt ) ) ;
903902 }
904903 }
905904 }
906905
907906 if ( enabled ) {
908907 document . addEventListener ( 'keydown' , e => disableMotorTest ( e ) ) ;
909- // enable Status and Motor data pulling
910- GUI . interval_add ( 'motor_and_status_pull' , get_status , 50 , true ) ;
911- } else {
912- document . removeEventListener ( 'keydown' , e => disableMotorTest ( e ) ) ;
913- GUI . interval_remove ( "motor_and_status_pull" ) ;
914908 }
915909
916910 setContentButtons ( enabled ) ;
@@ -1002,7 +996,7 @@ motors.initialize = async function (callback) {
1002996
1003997 // data pulling functions used inside interval timer
1004998
1005- function get_status ( ) {
999+ function getStatus ( ) {
10061000 // status needed for arming flag
10071001 MSP . send_message ( MSPCodes . MSP_STATUS , false , false , get_motor_data ) ;
10081002 }
@@ -1143,8 +1137,8 @@ motors.initialize = async function (callback) {
11431137
11441138 $ ( 'a.stop' ) . on ( 'click' , ( ) => motorsEnableTestModeElement . prop ( 'checked' , false ) . trigger ( 'change' ) ) ;
11451139
1146- // get initial motor status values
1147- get_status ( ) ;
1140+ // enable Status and Motor data pulling
1141+ GUI . interval_add ( 'motor_and_status_pull' , getStatus , 50 , true ) ;
11481142
11491143 setup_motor_output_reordering_dialog ( SetupEscDshotDirectionDialogCallback , zeroThrottleValue ) ;
11501144
0 commit comments