Skip to content

Commit 7e4de33

Browse files
committed
fix sending data to IO
1 parent 83c60c5 commit 7e4de33

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/components/uart/drivers/ws_uart_drv_pm25aqi.h

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -144,21 +144,18 @@ class ws_uart_drv_pm25aqi : public ws_uart_drv {
144144
wippersnapper_signal_v1_UARTResponse_init_zero;
145145
msgUARTResponse.which_payload =
146146
wippersnapper_signal_v1_UARTResponse_resp_uart_device_event_tag;
147-
// We'll be sending back six sensor_events: pm10_standard, pm25_standard,
148-
// pm100_standard, pm10_env, pm25_env, and pm100_env
149-
msgUARTResponse.payload.resp_uart_device_event.sensor_event_count = 6;
150-
Serial.print("Device ID: ");
151-
Serial.println(getDriverID());
152147
strcpy(msgUARTResponse.payload.resp_uart_device_event.device_id,
153-
"pm1006"); // TODO: Change to non-fixed value
148+
getDriverID());
154149

155150
// check if driverID is pm1006
156151
if (strcmp(getDriverID(), "pm1006") == 0) {
157152
// PM1006 returns only PM2.5_ENV readings
158-
packUARTResponse(&msgUARTResponse, 4,
153+
msgUARTResponse.payload.resp_uart_device_event.sensor_event_count = 1;
154+
packUARTResponse(&msgUARTResponse, 0,
159155
wippersnapper_i2c_v1_SensorType_SENSOR_TYPE_PM25_ENV,
160156
(float)_data.pm25_env);
161157
} else {
158+
msgUARTResponse.payload.resp_uart_device_event.sensor_event_count = 6;
162159
packUARTResponse(&msgUARTResponse, 0,
163160
wippersnapper_i2c_v1_SensorType_SENSOR_TYPE_PM10_STD,
164161
(float)_data.pm10_standard);

0 commit comments

Comments
 (0)