Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uart pm25 retry #683

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

Uart pm25 retry #683

wants to merge 6 commits into from

Conversation

tyeth
Copy link
Contributor

@tyeth tyeth commented Jan 22, 2025

There's a related issue with the driver repo, but until that's resolved, and probably anyway, we can add some retry logic around the data read.

This has been running for hours, mostly with 0 retries, sometimes 1, and sometimes the mega-load (the wrapper / glue driver does maximum of 500millis of retry attempts with 100ms waits).

I'll clean this up, but wanted to stick the log with the code so raised the PR:

Uart Log Details

02:35:07:770 -> Sending MQTT PING: SUCCESS!
02:35:07:962 -> WiFi RSSI: -59
02:35:12:483 -> Sending MQTT PING: SUCCESS!
02:35:12:665 -> WiFi RSSI: -60
02:35:14:006 -> [UART, PM25] Reading data...
02:35:14:006 -> PM25: Serial data fetch done
02:35:14:006 -> PM25: Serial data checksum incorrect
02:35:14:006 -> UART IN TIMED CHECK, RES: 0
02:35:14:108 -> PM25: Serial data fetch done
02:35:14:108 -> PM25: Serial data checksum incorrect
02:35:14:108 -> UART IN TIMED CHECK, RES: 0
02:35:14:209 -> PM25: Serial peek failed
02:35:14:209 -> UART IN TIMED CHECK, RES: 0
02:35:14:319 -> PM25: Serial data fetch done
02:35:14:319 -> PM25: Serial data start incorrect (not pm1006)
02:35:14:319 -> UART IN TIMED CHECK, RES: 0
02:35:14:429 -> PM25: Serial data fetch done
02:35:14:429 -> PM25: Serial data checks complete, about to calculate AQIs
02:35:14:429 -> PM25: Calculated AQIs, returning TRUE for read()
02:35:14:429 -> UART IN TIMED CHECK, RES: 1
02:35:14:429 -> RESULT VAR: 1
02:35:14:429 -> [UART, PM25] Read data OK
02:35:14:429 ->
02:35:14:429 -> ---------------------------------------
02:35:14:430 -> Concentration Units (standard)
02:35:14:430 -> ---------------------------------------
02:35:14:430 -> PM 1.0: 329 PM 2.5: 753 PM 10: 921
02:35:14:430 -> Concentration Units (environmental)
02:35:14:430 -> ---------------------------------------
02:35:14:430 -> PM 1.0: 218 PM 2.5: 502 PM 10: 613
02:35:14:430 -> ---------------------------------------
02:35:14:430 -> [UART] Publishing event to IO..Published!
02:35:17:173 -> Sending MQTT PING: SUCCESS!
02:35:17:276 -> WiFi RSSI: -58
02:35:21:796 -> Sending MQTT PING: SUCCESS!
02:35:21:988 -> WiFi RSSI: -60
02:35:26:489 -> Sending MQTT PING: SUCCESS!
02:35:26:592 -> WiFi RSSI: -59
02:35:31:112 -> Sending MQTT PING: SUCCESS!
02:35:31:305 -> WiFi RSSI: -58
02:35:33:626 -> STATUS LED BLINK KAT
02:35:35:806 -> Sending MQTT PING: SUCCESS!
02:35:36:019 -> WiFi RSSI: -60
02:35:40:539 -> Sending MQTT PING: SUCCESS!
02:35:40:722 -> WiFi RSSI: -61
02:35:44:623 -> [UART, PM25] Reading data...
02:35:44:623 -> PM25: Serial data fetch done
02:35:44:623 -> PM25: Serial data checks complete, about to calculate AQIs
02:35:44:623 -> PM25: Calculated AQIs, returning TRUE for read()
02:35:44:623 -> UART IN TIMED CHECK, RES: 1
02:35:44:623 -> RESULT VAR: 1
02:35:44:623 -> [UART, PM25] Read data OK
02:35:44:623 ->
02:35:44:623 -> ---------------------------------------
02:35:44:623 -> Concentration Units (standard)
02:35:44:623 -> ---------------------------------------
02:35:44:623 -> PM 1.0: 329 PM 2.5: 753 PM 10: 921
02:35:44:623 -> Concentration Units (environmental)
02:35:44:623 -> ---------------------------------------
02:35:44:623 -> PM 1.0: 218 PM 2.5: 502 PM 10: 613
02:35:44:623 -> ---------------------------------------
02:35:44:624 -> [UART] Publishing event to IO..Published!
02:35:45:226 -> Sending MQTT PING: SUCCESS!
02:35:45:339 -> WiFi RSSI: -56
02:35:49:840 -> Sending MQTT PING: SUCCESS!
02:35:49:943 -> WiFi RSSI: -57
02:35:54:463 -> Sending MQTT PING: SUCCESS!
02:35:54:655 -> WiFi RSSI: -61
02:35:59:157 -> Sending MQTT PING: SUCCESS!
02:35:59:259 -> WiFi RSSI: -59
02:36:03:761 -> Sending MQTT PING: SUCCESS!
02:36:03:873 -> WiFi RSSI: -59
02:36:08:394 -> Sending MQTT PING: SUCCESS!
02:36:08:576 -> WiFi RSSI: -60
02:36:13:082 -> Sending MQTT PING: SUCCESS!
02:36:13:190 -> WiFi RSSI: -59
02:36:14:831 -> [UART, PM25] Reading data...
02:36:14:831 -> PM25: Serial data fetch done
02:36:14:831 -> PM25: Serial data checksum incorrect
02:36:14:831 -> UART IN TIMED CHECK, RES: 0
02:36:14:932 -> PM25: Serial data fetch done
02:36:14:932 -> PM25: Serial data checks complete, about to calculate AQIs
02:36:14:933 -> PM25: Calculated AQIs, returning TRUE for read()
02:36:14:933 -> UART IN TIMED CHECK, RES: 1
02:36:14:933 -> RESULT VAR: 1
02:36:14:933 -> [UART, PM25] Read data OK
02:36:14:933 ->
02:36:14:933 -> ---------------------------------------
02:36:14:933 -> Concentration Units (standard)
02:36:14:933 -> ---------------------------------------
02:36:14:933 -> PM 1.0: 314 PM 2.5: 723 PM 10: 852
02:36:14:933 -> Concentration Units (environmental)
02:36:14:933 -> ---------------------------------------
02:36:14:933 -> PM 1.0: 209 PM 2.5: 481 PM 10: 567
02:36:14:933 -> ---------------------------------------
02:36:14:933 -> [UART] Publishing event to IO..Published!
02:36:17:697 -> Sending MQTT PING: SUCCESS!
02:36:17:799 -> WiFi RSSI: -59

@brentru
Copy link
Member

brentru commented Jan 22, 2025

@tyeth Is this ready for reivew?

@tyeth tyeth marked this pull request as ready for review January 23, 2025 18:38
@tyeth
Copy link
Contributor Author

tyeth commented Jan 23, 2025

@brentru this should be ready for review now

@tyeth tyeth requested a review from brentru January 23, 2025 20:08
@brentru
Copy link
Member

brentru commented Jan 23, 2025

The delay worries me, I2C reads are not supposed to retry from the driver-side. I am going to ask Carter for a status update on the PR, maybe we can implement passive mode as specified.

@tyeth
Copy link
Contributor Author

tyeth commented Jan 23, 2025 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants