From 8dd5c8121ff22f62ad3c7219a0d12e3176c67d45 Mon Sep 17 00:00:00 2001 From: Thomas Kolb Date: Sun, 19 Sep 2021 14:21:00 +0200 Subject: [PATCH] Send error state over RS485 --- src/main.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/main.c b/src/main.c index d88c8f0..bb7a1d3 100644 --- a/src/main.c +++ b/src/main.c @@ -154,6 +154,12 @@ static void report_status(struct MeasurementResult *meas_data) fxp_format(meas_data->temperature, number, 2); rs485_enqueue(number); + rs485_enqueue(":"); + + rs485_enqueue(charge_control_is_charge_blocked() ? "1" : "0"); + rs485_enqueue(":"); + + rs485_enqueue(charge_control_is_discharge_blocked() ? "1" : "0"); rs485_enqueue("\n"); } @@ -186,6 +192,12 @@ static void report_averaged(struct MeasurementResult *meas_data) fxp_format(meas_data->avg_temperature, number, 2); rs485_enqueue(number); + rs485_enqueue(":"); + + rs485_enqueue(charge_control_is_charge_blocked() ? "1" : "0"); + rs485_enqueue(":"); + + rs485_enqueue(charge_control_is_discharge_blocked() ? "1" : "0"); rs485_enqueue("\n"); }