Skip to content

force digital or analog message when enabling digital port or analog pin reporting #157

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 26, 2014
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
8 changes: 8 additions & 0 deletions examples/StandardFirmata/StandardFirmata.ino
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,10 @@ void reportAnalogCallback(byte analogPin, int value)
analogInputsToReport = analogInputsToReport &~ (1 << analogPin);
} else {
analogInputsToReport = analogInputsToReport | (1 << analogPin);
// Send pin value immediately. This is helpful when connected via
// ethernet, wi-fi or bluetooth so pin states can be known upon
// reconnecting.
Firmata.sendAnalog(analogPin, analogRead(analogPin));
}
}
// TODO: save status to EEPROM here, if changed
Expand All @@ -358,6 +362,10 @@ void reportDigitalCallback(byte port, int value)
{
if (port < TOTAL_PORTS) {
reportPINs[port] = (byte)value;
// Send port value immediately. This is helpful when connected via
// ethernet, wi-fi or bluetooth so pin states can be known upon
// reconnecting.
if (value) outputPort(port, readPort(port, portConfigInputs[port]), true);
}
// do not disable analog reporting on these 8 pins, to allow some
// pins used for digital, others analog. Instead, allow both types
Expand Down
8 changes: 5 additions & 3 deletions extras/revisions.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
FIRMATA 2.4.0 BETA - not yet released

[core library]
* Changed the way servo pins are mapped to enable use of servos on
a wider range of pins, including analog pins.
* Updated FirmataServo example to use new pin mapping technique
* Changed sendValueAsTwo7bitBytes, startSysex and endSysex from private to
public methods.
* Added Intel Galileo to Boards.h
Expand All @@ -22,6 +19,11 @@ FIRMATA 2.4.0 BETA - not yet released
* Increased input data buffer size from 32 to 64 bytes

[StandardFirmata]
* When a digital port is enabled, its value is now immediately sent to the client
* When an analog pin is enabled, its value is now immediately sent to the client
* Changed the way servo pins are mapped to enable use of servos on
a wider range of pins, including analog pins.
* Updated FirmataServo example to use new pin mapping technique
* Fixed management of unexpected sized I2C replies (Nahuel Greco)
* Fixed a bug when removing a monitored device with I2C_STOP_Reading (Nahuel Greco)
* Fixed conditional expression in I2C_STOP_READING case
Expand Down