From bd05fbc9923a5bda89c67a5603983c47ec48e3f7 Mon Sep 17 00:00:00 2001 From: Daniel Date: Mon, 24 Jul 2023 22:01:04 +0300 Subject: [PATCH] Always send initial CAN once --- Software/BYD-CAN.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Software/BYD-CAN.cpp b/Software/BYD-CAN.cpp index b2b9b9f1..d04f93d3 100644 --- a/Software/BYD-CAN.cpp +++ b/Software/BYD-CAN.cpp @@ -27,6 +27,7 @@ CAN_frame_t BYD_210 = {.FIR = {.B = {.DLC = 8,.FF = CAN_frame_std,}},.MsgID = 0x static int discharge_current = 0; static int charge_current = 0; +static int initialDataSent = 0; void update_values_can_byd() { //This function maps all the values fetched from battery CAN to the correct CAN messages @@ -101,6 +102,12 @@ void receive_can_byd(CAN_frame_t rx_frame) void send_can_byd() { unsigned long currentMillis = millis(); + // Send initial CAN data once on bootup + if (!initialDataSent) + { + send_intial_data(); + initialDataSent = 1; + } // Send 2s CAN Message if (currentMillis - previousMillis2s >= interval2s) {