From 6f6b059403af13a5485293896324be967cf394d1 Mon Sep 17 00:00:00 2001 From: Chris Date: Thu, 13 May 2021 11:57:09 -0400 Subject: [PATCH] flipped some bits and it work now yay --- DesktopCAN_API | 2 +- main.cpp | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/DesktopCAN_API b/DesktopCAN_API index 72c2a78..045e474 160000 --- a/DesktopCAN_API +++ b/DesktopCAN_API @@ -1 +1 @@ -Subproject commit 72c2a781e0e160019dbfff13c58dc1ba4232faaa +Subproject commit 045e474d508ec7ff20614b337ff36d60cc0349a9 diff --git a/main.cpp b/main.cpp index fb92ea0..8aa4096 100644 --- a/main.cpp +++ b/main.cpp @@ -135,9 +135,9 @@ void readTheCanBusYo() uint32_t id = rx_data.getId(); if (id == ELCON_READ_ADDR) { - actual_current = ((double) ((rx_data.data[0] << 8) + actual_voltage = ((double) ((rx_data.data[0] << 8) | (rx_data.data[1]))) / 10; - actual_voltage = ((double) ((rx_data.data[2] << 8) + actual_current = ((double) ((rx_data.data[2] << 8) | (rx_data.data[3]))) / 10; if (!gui_items.terminate) { @@ -172,11 +172,11 @@ void elconsChargeTheCarYo() target_voltage = gui_items.target_voltage->value() * 10; } - to_send[0] = request_current >> 8; - to_send[1] = request_current; - to_send[2] = target_voltage >> 8; - to_send[3] = target_voltage; - to_send[4] = 1; + to_send[0] = target_voltage >> 8; + to_send[1] = target_voltage; + to_send[2] = request_current >> 8; + to_send[3] = request_current; + to_send[4] = 0; if (can_if) { @@ -189,7 +189,7 @@ void elconsChargeTheCarYo() to_send[1] = 0; to_send[2] = 0; to_send[3] = 0; - to_send[4] = 0; + to_send[4] = 1; if (can_if) { can_if->writeCanData(ELCON_WRITE_ADDR, 5, to_send);