Skip to content

Commit

Permalink
flipped some bits and it work now yay
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris committed May 13, 2021
1 parent 895b114 commit 6f6b059
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion DesktopCAN_API
16 changes: 8 additions & 8 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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)
{
Expand All @@ -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);
Expand Down

0 comments on commit 6f6b059

Please sign in to comment.