From 11c95d9fd640ffec65047435d983555c06740440 Mon Sep 17 00:00:00 2001 From: Klagarge Date: Fri, 1 Sep 2023 18:41:25 +0200 Subject: [PATCH] fix eeprom --- 306-controller_interface.X/app/can_message.c | 2 +- 306-controller_interface.X/app/eeprom.c | 18 +++++---- .../nbproject/configurations.xml | 4 +- .../queuelogs/debugtool | 0 busmaster_config.cfx | 40 +++++++++---------- 5 files changed, 33 insertions(+), 31 deletions(-) create mode 100644 306-controller_interface.X/queuelogs/debugtool diff --git a/306-controller_interface.X/app/can_message.c b/306-controller_interface.X/app/can_message.c index 72ff705..89e21df 100644 --- a/306-controller_interface.X/app/can_message.c +++ b/306-controller_interface.X/app/can_message.c @@ -68,7 +68,7 @@ void CM_processIncome(uint8_t idSender, uint8_t idMsg, uint32_t data){ // valHH valH valL valLL KART_CST.CONTROL_POWER_FACTOR = data; MEM_write_4_byte(MEMADD_CONTROL_POWER_FACTOR, KART_CST.CONTROL_POWER_FACTOR); - + CAN_Send(0, 5, KART_CST.CONTROL_POWER_FACTOR); } if(idMsg == 0x3) { // CONTROL_STEERING_FACTOR diff --git a/306-controller_interface.X/app/eeprom.c b/306-controller_interface.X/app/eeprom.c index 2e1ba5d..4efdbf8 100644 --- a/306-controller_interface.X/app/eeprom.c +++ b/306-controller_interface.X/app/eeprom.c @@ -7,6 +7,7 @@ #include "eeprom.h" #include "../app/car.h" +#include "../middleware/can_interface.h" typedef union { struct { @@ -21,12 +22,12 @@ typedef union { void MEM_init(){ uint8_t check = MEM_read_1_byte(0x0); - if(check != 0x2A){ + if(check != 0x42){ KART_CST.CONTROL_STEERING_MODE = 0; KART_CST.CONTROL_ALIVE_TIME = 50; - KART_CST.CONTROL_SPEED_FACTOR = 111111; - KART_CST.CONTROL_POWER_FACTOR = 10000; - KART_CST.CONTROL_STEERING_FACTOR = 400000000; + KART_CST.CONTROL_SPEED_FACTOR = 111111; // 111'111 + KART_CST.CONTROL_POWER_FACTOR = 10000; // 10'000 + KART_CST.CONTROL_STEERING_FACTOR = 400000000; // 400'000'000 KART_CST.CONTROL_MAX_SPEED_FW = 50; KART_CST.CONTROL_MAX_SPEED_BW = 25; @@ -74,13 +75,13 @@ void MEM_init(){ MEM_write_1_byte(MEMADD_BATTERY_ENERGY_TIME, KART_CST.BATTERY_ENERGY_TIME); MEM_write_1_byte(MEMADD_BATTERY_ALIVE_TIME, KART_CST.BATTERY_ALIVE_TIME); - MEM_write_1_byte(0x0, 0x2A); + MEM_write_1_byte(0x0, 0x42); } else { KART_CST.CONTROL_STEERING_MODE = MEM_read_1_byte(MEMADD_CONTROL_STEERING_MODE); KART_CST.CONTROL_ALIVE_TIME = MEM_read_1_byte(MEMADD_CONTROL_ALIVE_TIME); - KART_CST.CONTROL_SPEED_FACTOR = MEM_read_1_byte(MEMADD_CONTROL_SPEED_FACTOR); - KART_CST.CONTROL_POWER_FACTOR = MEM_read_1_byte(MEMADD_CONTROL_POWER_FACTOR); - KART_CST.CONTROL_STEERING_FACTOR = MEM_read_1_byte(MEMADD_CONTROL_STEERING_FACTOR); + KART_CST.CONTROL_SPEED_FACTOR = MEM_read_4_byte(MEMADD_CONTROL_SPEED_FACTOR); + KART_CST.CONTROL_POWER_FACTOR = MEM_read_4_byte(MEMADD_CONTROL_POWER_FACTOR); + KART_CST.CONTROL_STEERING_FACTOR = MEM_read_4_byte(MEMADD_CONTROL_STEERING_FACTOR); KART_CST.CONTROL_MAX_SPEED_FW = MEM_read_1_byte(MEMADD_CONTROL_MAX_SPEED_FW); KART_CST.CONTROL_MAX_SPEED_BW = MEM_read_1_byte(MEMADD_CONTROL_MAX_SPEED_BW); @@ -103,6 +104,7 @@ void MEM_init(){ KART_CST.BATTERY_ALIVE_TIME = MEM_read_1_byte(MEMADD_BATTERY_ALIVE_TIME); } + CAN_Send(0, 5, KART_CST.CONTROL_POWER_FACTOR); } void MEM_reset() { diff --git a/306-controller_interface.X/nbproject/configurations.xml b/306-controller_interface.X/nbproject/configurations.xml index 2d248e4..ded209f 100644 --- a/306-controller_interface.X/nbproject/configurations.xml +++ b/306-controller_interface.X/nbproject/configurations.xml @@ -245,7 +245,7 @@ - + @@ -292,7 +292,7 @@ - + diff --git a/306-controller_interface.X/queuelogs/debugtool b/306-controller_interface.X/queuelogs/debugtool new file mode 100644 index 0000000..e69de29 diff --git a/busmaster_config.cfx b/busmaster_config.cfx index f5a4e23..d41b117 100644 --- a/busmaster_config.cfx +++ b/busmaster_config.cfx @@ -366,9 +366,9 @@ 452 - 147 + 94 94 - 139 + 189 94 @@ -436,7 +436,7 @@ SHOWNORMAL - SHOWNORMAL + HIDE 291 205 957 @@ -567,9 +567,9 @@ SHOWNORMAL RESTORETOMAXIMIZED - 173 + 179 10 - 451 + 457 359 @@ -577,8 +577,8 @@ 1 - 0 - 0 + 1 + 19 Time @@ -650,11 +650,11 @@ Data Byte(s) 13 1 - 720 + 701 1 - 1 - 0 + 0 + 1 SYSTEM SHOWNORMAL @@ -667,9 +667,9 @@ SHOWNORMAL RESTORETOMAXIMIZED - 173 + 179 10 - 451 + 457 359 @@ -680,8 +680,8 @@ 1 - 0 - 0 + 1 + 19 Time @@ -735,11 +735,11 @@ Checksum 10 1 - 734 + 715 1 - 1 - 0 + 0 + 1 SYSTEM SHOWNORMAL @@ -752,9 +752,9 @@ SHOWNORMAL RESTORETOMAXIMIZED - 173 + 179 10 - 451 + 457 359 @@ -798,7 +798,7 @@ FALSE FALSE 4 - 0,0,0,0 + 0,0,39,16 10 FALSE a