@@ -81,7 +81,7 @@ export class SMXStage {
81
81
private debug = true ;
82
82
private _config : SMXConfig | null = null ;
83
83
private panelTestMode = PanelTestMode . Off ;
84
- private testModeIntervalHandle : number | null = null ;
84
+ private cancelTestModeInterval : Bacon . Unsub | null = null ;
85
85
86
86
public get config ( ) {
87
87
return this . _config ?. config || null ;
@@ -243,9 +243,9 @@ export class SMXStage {
243
243
// We don't want to send the "Off" command multiple times, so only send it if
244
244
// it's currently activated
245
245
if ( this . panelTestMode !== PanelTestMode . Off ) {
246
- if ( this . testModeIntervalHandle !== null ) {
247
- clearInterval ( this . testModeIntervalHandle ) ;
248
- this . testModeIntervalHandle = null ;
246
+ if ( this . cancelTestModeInterval ) {
247
+ this . cancelTestModeInterval ( ) ;
248
+ this . cancelTestModeInterval = null ;
249
249
}
250
250
// Turn off panel test mode, and send "Off" event
251
251
this . panelTestMode = mode ;
@@ -274,10 +274,10 @@ export class SMXStage {
274
274
275
275
// The Panel Test Mode command needs to be resent approximately every second, or else the stage will
276
276
// auto time out and turn off Panel Test Mode itself
277
- this . testModeIntervalHandle = setInterval ( ( ) => {
277
+ this . cancelTestModeInterval = Bacon . interval ( 1000 , null ) . subscribe ( ( ) => {
278
278
console . log ( "Test Mode Push Interval" ) ;
279
279
this . events . output$ . push ( Uint8Array . of ( API_COMMAND . SET_PANEL_TEST_MODE , char2byte ( " " ) , mode , char2byte ( "\n" ) ) ) ;
280
- } , 1000 ) ;
280
+ } ) ;
281
281
}
282
282
}
283
283
0 commit comments