@@ -49,7 +49,7 @@ void FirmataClass::endSysex(void)
4949FirmataClass::FirmataClass ()
5050{
5151 firmwareVersionCount = 0 ;
52- systemReset ();
52+ init ();
5353}
5454
5555// ******************************************************************************
@@ -400,33 +400,35 @@ void FirmataClass::detach(byte command)
400400// * Private Methods
401401// ******************************************************************************
402402
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 )
407405{
408406 byte i;
409407
410408 waitForData = 0 ; // this flag says the next serial input will be data
411409 executeMultiByteCommand = 0 ; // execute this after getting multi-byte data
412410 multiByteChannel = 0 ; // channel data for multiByteCommands
413411
414-
415412 for (i=0 ; i<MAX_DATA_BYTES; i++) {
416413 storedInputData[i] = 0 ;
417414 }
418415
419416 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 ();
421424
422425 if (currentSystemResetCallback)
423426 (*currentSystemResetCallback)();
424427
425- // flush(); //TODO uncomment when Firmata is a subclass of HardwareSerial
428+ FirmataSerial-> flush ();
426429}
427430
428431
429-
430432// =============================================================================
431433// used for flashing the pin for the version number
432434void FirmataClass::pin13strobe (int count, int onInterval, int offInterval)
0 commit comments