File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -388,16 +388,19 @@ void wait(unsigned long ms) {
388
388
}
389
389
}
390
390
391
- void wait (unsigned long ms, uint8_t cmd, uint8_t msgtype) {
391
+ bool wait (unsigned long ms, uint8_t cmd, uint8_t msgtype) {
392
392
unsigned long enter = hwMillis ();
393
393
// invalidate msg type
394
394
_msg.type = !msgtype;
395
- while ( (hwMillis () - enter < ms) && !(mGetCommand (_msg)==cmd && _msg.type ==msgtype) ) {
395
+ bool expectedResponse = false ;
396
+ while ( (hwMillis () - enter < ms) && !expectedResponse ) {
396
397
_process ();
397
398
#if defined(MY_GATEWAY_ESP8266)
398
399
yield ();
399
400
#endif
401
+ expectedResponse = (mGetCommand (_msg) == cmd && _msg.type == msgtype);
400
402
}
403
+ return expectedResponse;
401
404
}
402
405
403
406
Original file line number Diff line number Diff line change @@ -177,8 +177,9 @@ void wait(unsigned long ms);
177
177
* @param ms Number of milliseconds to sleep.
178
178
* @param cmd Command of incoming message.
179
179
* @param msgtype Message type.
180
+ * @return True if specified message received
180
181
*/
181
- void wait (unsigned long ms , uint8_t cmd , uint8_t msgtype );
182
+ bool wait (unsigned long ms , uint8_t cmd , uint8_t msgtype );
182
183
183
184
/**
184
185
* Sleep (PowerDownMode) the MCU and radio. Wake up on timer.
You can’t perform that action at this time.
0 commit comments