From 5416debc9822119e77f8c8a1d482faa50060c69d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Hru=C5=A1ka?= Date: Sun, 2 Jan 2022 23:44:37 +0100 Subject: [PATCH] better error reporting for co2 --- main/co2_sensor.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/main/co2_sensor.c b/main/co2_sensor.c index ed47a15..c3f8f19 100644 --- a/main/co2_sensor.c +++ b/main/co2_sensor.c @@ -36,6 +36,10 @@ static int mb_write_and_read(uint8_t *buffer, int num, size_t resplen) { num = uart_read_bytes(CO2_UART_NUM, buffer, resplen, pdMS_TO_TICKS(500)); ESP_LOGD(TAG, "Received %d bytes", num); ESP_LOG_BUFFER_HEXDUMP(TAG, buffer, num, ESP_LOG_DEBUG); + + if (num == 0) { + ESP_LOGE(TAG, "No modbus response!"); + } return num; }