@@ -49,7 +49,7 @@ void FirmataClass::endSysex(void)
49
49
FirmataClass::FirmataClass ()
50
50
{
51
51
firmwareVersionCount = 0 ;
52
- systemReset ();
52
+ init ();
53
53
}
54
54
55
55
// ******************************************************************************
@@ -400,33 +400,35 @@ void FirmataClass::detach(byte command)
400
400
// * Private Methods
401
401
// ******************************************************************************
402
402
403
-
404
-
405
- // resets the system state upon a SYSTEM_RESET message from the host software
406
- void FirmataClass::systemReset (void )
403
+ // initialize to a known state
404
+ void FirmataClass::init (void )
407
405
{
408
406
byte i;
409
407
410
408
waitForData = 0 ; // this flag says the next serial input will be data
411
409
executeMultiByteCommand = 0 ; // execute this after getting multi-byte data
412
410
multiByteChannel = 0 ; // channel data for multiByteCommands
413
411
414
-
415
412
for (i=0 ; i<MAX_DATA_BYTES; i++) {
416
413
storedInputData[i] = 0 ;
417
414
}
418
415
419
416
parsingSysex = false ;
420
- sysexBytesRead = 0 ;
417
+ sysexBytesRead = 0 ;
418
+ }
419
+
420
+ // resets the system state upon a SYSTEM_RESET message from the host software
421
+ void FirmataClass::systemReset (void )
422
+ {
423
+ init ();
421
424
422
425
if (currentSystemResetCallback)
423
426
(*currentSystemResetCallback)();
424
427
425
- // flush(); //TODO uncomment when Firmata is a subclass of HardwareSerial
428
+ FirmataSerial-> flush ();
426
429
}
427
430
428
431
429
-
430
432
// =============================================================================
431
433
// used for flashing the pin for the version number
432
434
void FirmataClass::pin13strobe (int count, int onInterval, int offInterval)
0 commit comments