diff --git a/src/main.c b/src/main.c index 8283aa4..8211bc6 100644 --- a/src/main.c +++ b/src/main.c @@ -176,18 +176,18 @@ static void report_status(struct MeasurementResult *meas_data) rs485_enqueue(":"); rs485_enqueue(charge_control_is_discharge_blocked() ? "1" : "0"); - rs485_enqueue(":"); - if(bmp280_state != BMP280_NOT_PRESENT) { + if(bmp280_state != BMP280_NOT_PRESENT + && bmp280_are_measurements_valid()) { + rs485_enqueue(":"); fxp_format(bmp280_get_temperature(), number, 2); rs485_enqueue(number); rs485_enqueue(":"); fxp_format(bmp280_get_pressure(), number, 2); rs485_enqueue(number); - } else { - rs485_enqueue("-1:-1"); } + rs485_enqueue("\n"); } @@ -226,17 +226,17 @@ static void report_averaged(struct MeasurementResult *meas_data) rs485_enqueue(":"); rs485_enqueue(charge_control_is_discharge_blocked() ? "1" : "0"); - rs485_enqueue(":"); - if(bmp280_state != BMP280_NOT_PRESENT) { + if(bmp280_state != BMP280_NOT_PRESENT + && bmp280_are_measurements_valid()) { + rs485_enqueue(":"); + fxp_format(bmp280_get_temperature(), number, 2); rs485_enqueue(number); rs485_enqueue(":"); fxp_format(bmp280_get_pressure(), number, 2); rs485_enqueue(number); - } else { - rs485_enqueue("-1:-1"); } rs485_enqueue("\n");