Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 7 additions & 15 deletions Firmata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,14 @@ void FirmataClass::printVersion(void)

void FirmataClass::blinkVersion(void)
{
#if defined(VERSION_BLINK_PIN)
// flash the pin with the protocol version
pinMode(VERSION_BLINK_PIN, OUTPUT);
strobeBlinkPin(FIRMATA_MAJOR_VERSION, 40, 210);
strobeBlinkPin(VERSION_BLINK_PIN, FIRMATA_MAJOR_VERSION, 40, 210);
delay(250);
strobeBlinkPin(FIRMATA_MINOR_VERSION, 40, 210);
strobeBlinkPin(VERSION_BLINK_PIN, FIRMATA_MINOR_VERSION, 40, 210);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a nitpick, but should this also be FIRMATA_ prefixed?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally but it has been defined in Boards.h for years. I'm not sure if anyone is using it in their sketches - probably not because it is only used in Firmata.cpp, but nothing prevents anyone from using it in a sketch as well. This is a issue I've been having lately. Each new Arduino board has included a duplicate define somewhere in it's code base that has broken something in Firmata so prefixing is necessary... just trying to figure out a way to do it without breaking existing sketches.

delay(125);
#endif
}

void FirmataClass::printFirmwareVersion(void)
Expand Down Expand Up @@ -161,7 +163,6 @@ int FirmataClass::available(void)
return FirmataStream->available();
}


void FirmataClass::processSysexMessage(void)
{
switch (storedInputData[0]) { //first byte in buffer is command
Expand Down Expand Up @@ -330,7 +331,6 @@ void FirmataClass::sendDigitalPort(byte portNumber, int portData)
FirmataStream->write(portData >> 7); // Tx bits 7-13
}


void FirmataClass::sendSysex(byte command, byte bytec, byte *bytev)
{
byte i;
Expand All @@ -347,7 +347,6 @@ void FirmataClass::sendString(byte command, const char *string)
sendSysex(command, strlen(string), (byte *)string);
}


// send a string as the protocol string type
void FirmataClass::sendString(const char *string)
{
Expand All @@ -360,7 +359,6 @@ void FirmataClass::write(byte c)
FirmataStream->write(c);
}


// Internal Actions/////////////////////////////////////////////////////////////

// generic callbacks
Expand Down Expand Up @@ -428,8 +426,6 @@ void FirmataClass::detach(byte command)
//* Private Methods
//******************************************************************************



// resets the system state upon a SYSTEM_RESET message from the host software
void FirmataClass::systemReset(void)
{
Expand All @@ -450,22 +446,18 @@ void FirmataClass::systemReset(void)
(*currentSystemResetCallback)();
}



// =============================================================================
// used for flashing the pin for the version number
void FirmataClass::strobeBlinkPin(int count, int onInterval, int offInterval)
void FirmataClass::strobeBlinkPin(byte pin, int count, int onInterval, int offInterval)
{
byte i;
pinMode(VERSION_BLINK_PIN, OUTPUT);
for (i = 0; i < count; i++) {
delay(offInterval);
digitalWrite(VERSION_BLINK_PIN, HIGH);
digitalWrite(pin, HIGH);
delay(onInterval);
digitalWrite(VERSION_BLINK_PIN, LOW);
digitalWrite(pin, LOW);
}
}


// make one instance for the user to use
FirmataClass Firmata;
2 changes: 1 addition & 1 deletion Firmata.h
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ class FirmataClass
/* private methods ------------------------------ */
void processSysexMessage(void);
void systemReset(void);
void strobeBlinkPin(int count, int onInterval, int offInterval);
void strobeBlinkPin(byte pin, int count, int onInterval, int offInterval);
};

extern FirmataClass Firmata;
Expand Down