Skip to content

Commit 6e723d4

Browse files
Merge pull request firmata#104 from ntruchsess/force_reporting
force digital and analogMessage when enabling reporting
2 parents 404961f + dc7e2b5 commit 6e723d4

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

utility/AnalogInputFirmata.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ void AnalogInputFirmata::reportAnalog(byte analogPin, int value)
4444
analogInputsToReport = analogInputsToReport &~ (1 << analogPin);
4545
} else {
4646
analogInputsToReport = analogInputsToReport | (1 << analogPin);
47+
Firmata.sendAnalog(analogPin, analogRead(analogPin));
4748
}
4849
}
4950
// TODO: save status to EEPROM here, if changed

utility/DigitalInputFirmata.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ void DigitalInputFirmata::reportDigital(byte port, int value)
7676
{
7777
if (port < TOTAL_PORTS) {
7878
reportPINs[port] = (byte)value;
79+
if (value) outputPort(port, readPort(port, portConfigInputs[port]), true);
7980
}
8081
// do not disable analog reporting on these 8 pins, to allow some
8182
// pins used for digital, others analog. Instead, allow both types

0 commit comments

Comments
 (0)