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(
190
190
/* *******************************************************************/
191
191
int Wippersnapper_DigitalGPIO::digitalReadSvc (int pinName) {
192
192
// Service using arduino `digitalRead`
193
+ WS_DEBUG_PRINT (" \t DioPinRead: " );
194
+ WS_DEBUG_PRINT (pinName);
193
195
int pinVal = digitalRead (pinName);
196
+ WS_DEBUG_PRINT (" =" );
197
+ WS_DEBUG_PRINT (pinVal);
194
198
return pinVal;
195
199
}
196
200
@@ -284,8 +288,8 @@ void Wippersnapper_DigitalGPIO::processDigitalInputs() {
284
288
} else if (_digital_input_pins[i].period == 0L ) {
285
289
// read pin
286
290
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 ) {
289
293
WS_DEBUG_PRINT (" Executing state-based event on D" );
290
294
WS_DEBUG_PRINTLN (_digital_input_pins[i].pinName );
291
295
@@ -324,6 +328,10 @@ void Wippersnapper_DigitalGPIO::processDigitalInputs() {
324
328
325
329
// reset the digital pin
326
330
_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..." );
327
335
}
328
336
}
329
337
}
You can’t perform that action at this time.
0 commit comments