Do not send BMP280 data if invalid
This commit is contained in:
parent
5090b7de4a
commit
a140b3ade6
14
src/main.c
14
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");
|
||||
|
||||
if(bmp280_state != BMP280_NOT_PRESENT
|
||||
&& bmp280_are_measurements_valid()) {
|
||||
rs485_enqueue(":");
|
||||
|
||||
if(bmp280_state != BMP280_NOT_PRESENT) {
|
||||
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");
|
||||
|
|
Loading…
Reference in a new issue