Skip to content

Commit 30565af

Browse files
committed
WIP: working retry of uart pm2.5
1 parent 1fe51a7 commit 30565af

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/Wippersnapper.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@
9595
{ \
9696
unsigned long startTime = millis(); \
9797
while (millis() - startTime < timeout) { \
98-
result_type result_var = func(__VA_ARGS__); \
98+
result_var = func(__VA_ARGS__); \
9999
if (condition(result_var)) { \
100100
break; \
101101
} \

src/components/uart/drivers/ws_uart_drv_pm25aqi.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -104,13 +104,13 @@ class ws_uart_drv_pm25aqi : public ws_uart_drv {
104104
bool read_data() override {
105105
WS_DEBUG_PRINTLN("[UART, PM25] Reading data...");
106106
// Attempt to read the PM2.5 Sensor
107-
bool result;
108-
RETRY_FUNCTION_UNTIL_TIMEOUT(_aqi->read, bool, result,
109-
// lambda function to check if data is available
110-
[](bool res) {
107+
bool result = false;
108+
RETRY_FUNCTION_UNTIL_TIMEOUT(_aqi->read, bool, result,
109+
[](bool res) -> bool {
111110
WS_DEBUG_PRINT("UART IN TIMED CHECK, RES: "); WS_DEBUG_PRINTLN(res);
112-
return res==true; }
113-
, 5000, 250, &_data);
111+
return res==true;
112+
},
113+
500, 100, &_data);
114114
WS_DEBUG_PRINT("RESULT VAR: "); WS_DEBUG_PRINTLN(result);
115115

116116
if (!result) {

0 commit comments

Comments
 (0)