@@ -233,38 +233,6 @@ export class SMXStage {
233
233
return this . testDataResponse$ . firstToPromise ( ) ;
234
234
}
235
235
236
- /*
237
- void SMX::SMXManager::UpdatePanelTestMode()
238
- {
239
- // If the test mode has changed, send the new test mode.
240
- //
241
- // When the test mode is enabled, send the test mode again periodically, or it'll time
242
- // out on the master and be turned off. Don't repeat the PanelTestMode_Off command.
243
- g_Lock.AssertLockedByCurrentThread();
244
- uint32_t now = GetTickCount();
245
- if(m_PanelTestMode == m_LastSentPanelTestMode &&
246
- (m_PanelTestMode == PanelTestMode_Off || now - m_SentPanelTestModeAtTicks < 1000))
247
- return;
248
-
249
- // When we first send the test mode command (not for repeats), turn off lights.
250
- if(m_LastSentPanelTestMode == PanelTestMode_Off)
251
- {
252
- // The 'l' command used to set lights, but it's now only used to turn lights off
253
- // for cases like this.
254
- string sData = "l";
255
- sData.append(108, 0);
256
- sData += "\n";
257
- for(int iPad = 0; iPad < 2; ++iPad)
258
- m_pDevices[iPad]->SendCommandLocked(sData);
259
- }
260
-
261
- m_SentPanelTestModeAtTicks = now;
262
- m_LastSentPanelTestMode = m_PanelTestMode;
263
- for(int iPad = 0; iPad < 2; ++iPad)
264
- m_pDevices[iPad]->SendCommandLocked(ssprintf("t %c\n", m_PanelTestMode));
265
- }
266
- */
267
-
268
236
getPanelTestMode ( ) {
269
237
return this . panelTestMode ;
270
238
}
@@ -281,11 +249,7 @@ void SMX::SMXManager::UpdatePanelTestMode()
281
249
}
282
250
// Turn off panel test mode, and send "Off" event
283
251
this . panelTestMode = mode ;
284
- this . events . output$ . push ( Uint8Array . of ( API_COMMAND . SET_PANEL_TEST_MODE , mode ) ) ;
285
-
286
- // TODO: Do we need to do anything with this? Does this even need to be called to flush
287
- // the queue?
288
- this . events . ackReports$ . firstToPromise ( ) ;
252
+ this . events . output$ . push ( Uint8Array . of ( API_COMMAND . SET_PANEL_TEST_MODE , char2byte ( " " ) , mode , char2byte ( "\n" ) ) ) ;
289
253
}
290
254
291
255
// Either we're already off, or we sent the off command, so just return.
@@ -299,31 +263,20 @@ void SMX::SMXManager::UpdatePanelTestMode()
299
263
/**
300
264
* the 'l' command used to set lights, but it's now only used to turn lights off
301
265
* for cases like this
302
- * Lights are always updated together (for some reason??)
303
- * 2 pads * 9 panels * 25 lights each * 3 (RGB) = 1350
304
- * The source code uses `108` and I'm really unsure why
305
- *
306
- * TODO: Does this even do anything?
266
+ * 1 pad * 9 panels * 25 lights each * 3 (RGB) = 675
267
+ * The source code uses `108` instead and I'm really unsure why,
268
+ * but we're gonna do the same thing here because it works.
307
269
*/
308
- this . events . output$ . push ( Uint8Array . of ( API_COMMAND . SET_LIGHTS_OLD , ...padData ( [ ] , 1350 , 0 ) , char2byte ( "\n" ) ) ) ;
309
-
310
- // TODO: Do we need to do anything with this? Does this even need to be called to flush
311
- // the queue?
312
- this . events . ackReports$ . firstToPromise ( ) ;
270
+ this . events . output$ . push ( Uint8Array . of ( API_COMMAND . SET_LIGHTS_OLD , ...padData ( [ ] , 108 , 0 ) , char2byte ( "\n" ) ) ) ;
313
271
314
272
// Send the Panel Test Mode command
315
- this . events . output$ . push ( Uint8Array . of ( API_COMMAND . SET_PANEL_TEST_MODE , mode ) ) ;
273
+ this . events . output$ . push ( Uint8Array . of ( API_COMMAND . SET_PANEL_TEST_MODE , char2byte ( " " ) , mode , char2byte ( "\n" ) ) ) ;
316
274
317
- // TODO: Do we need to do anything with this? Does this even need to be called to flush
318
- // the queue?
319
- this . events . ackReports$ . firstToPromise ( ) ;
320
-
321
- // The Panel Test Mode command needs to be resent every second
275
+ // The Panel Test Mode command needs to be resent approximately every second, or else the stage will
276
+ // auto time out and turn off Panel Test Mode itself
322
277
this . testModeIntervalHandle = setInterval ( ( ) => {
323
- this . events . output$ . push ( Uint8Array . of ( API_COMMAND . SET_PANEL_TEST_MODE , mode ) ) ;
324
-
325
- // TODO: Do I need to call this to consume the event?
326
- this . events . ackReports$ . firstToPromise ( ) ;
278
+ console . log ( "Test Mode Push Interval" ) ;
279
+ this . events . output$ . push ( Uint8Array . of ( API_COMMAND . SET_PANEL_TEST_MODE , char2byte ( " " ) , mode , char2byte ( "\n" ) ) ) ;
327
280
} , 1000 ) ;
328
281
}
329
282
}
0 commit comments