File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -190,7 +190,11 @@ void Wippersnapper_DigitalGPIO::deinitDigitalPin(
190190/* *******************************************************************/
191191int Wippersnapper_DigitalGPIO::digitalReadSvc (int pinName) {
192192 // Service using arduino `digitalRead`
193+ WS_DEBUG_PRINT (" \t DioPinRead: " );
194+ WS_DEBUG_PRINT (pinName);
193195 int pinVal = digitalRead (pinName);
196+ WS_DEBUG_PRINT (" =" );
197+ WS_DEBUG_PRINT (pinVal);
194198 return pinVal;
195199}
196200
@@ -284,8 +288,8 @@ void Wippersnapper_DigitalGPIO::processDigitalInputs() {
284288 } else if (_digital_input_pins[i].period == 0L ) {
285289 // read pin
286290 int pinVal = digitalReadSvc (_digital_input_pins[i].pinName );
287- // only send on-change
288- if (pinVal != _digital_input_pins[i].prvPinVal ) {
291+ // only send on-change, but we don't know initial state of feed (prvPinVal at boot)
292+ if (_digital_input_pins[i]. prvPeriod <= 0 || pinVal != _digital_input_pins[i].prvPinVal ) {
289293 WS_DEBUG_PRINT (" Executing state-based event on D" );
290294 WS_DEBUG_PRINTLN (_digital_input_pins[i].pinName );
291295
@@ -324,6 +328,10 @@ void Wippersnapper_DigitalGPIO::processDigitalInputs() {
324328
325329 // reset the digital pin
326330 _digital_input_pins[i].prvPeriod = curTime;
331+ } else {
332+ WS_DEBUG_PRINT (" Dio: No change on " );
333+ WS_DEBUG_PRINT (_digital_input_pins[i].pinName );
334+ WS_DEBUG_PRINTLN (" , skipping..." );
327335 }
328336 }
329337 }
You can’t perform that action at this time.
0 commit comments