fix eeprom

This commit is contained in:
Rémi Heredero 2023-09-01 18:41:25 +02:00
parent 57b19e59d9
commit 11c95d9fd6
5 changed files with 33 additions and 31 deletions

View File

@ -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

View File

@ -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() {

View File

@ -245,7 +245,7 @@
<property key="programoptions.preservedataflash" value="false"/>
<property key="programoptions.preservedataflash.ranges"
value="${programoptions.preservedataflash.ranges}"/>
<property key="programoptions.preserveeeprom" value="true"/>
<property key="programoptions.preserveeeprom" value="false"/>
<property key="programoptions.preserveeeprom.ranges" value="310000-3103ff"/>
<property key="programoptions.preserveprogram.ranges" value=""/>
<property key="programoptions.preserveprogramrange" value="false"/>
@ -292,7 +292,7 @@
<property key="programoptions.preservedataflash" value="false"/>
<property key="programoptions.preservedataflash.ranges"
value="${programoptions.preservedataflash.ranges}"/>
<property key="programoptions.preserveeeprom" value="true"/>
<property key="programoptions.preserveeeprom" value="false"/>
<property key="programoptions.preserveeeprom.ranges" value="310000-3103ff"/>
<property key="programoptions.preserveprogram.ranges" value=""/>
<property key="programoptions.preserveprogramrange" value="false"/>

View File

@ -366,9 +366,9 @@
<Bottom>452</Bottom>
</Window_Position>
<COLUMN_WIDTH>
<MESSAGE_COLUMN>147</MESSAGE_COLUMN>
<MESSAGE_COLUMN>94</MESSAGE_COLUMN>
<Raw_Val_Column>94</Raw_Val_Column>
<Physical_Val_Column>139</Physical_Val_Column>
<Physical_Val_Column>189</Physical_Val_Column>
<Signal_Column>94</Signal_Column>
</COLUMN_WIDTH>
</CAN_Signal_Watch>
@ -436,7 +436,7 @@
</GRAPH_ELEMENT>
<Window_Position>
<Visibility>SHOWNORMAL</Visibility>
<Window_Position>SHOWNORMAL</Window_Position>
<Window_Position>HIDE</Window_Position>
<Top>291</Top>
<Left>205</Left>
<Bottom>957</Bottom>
@ -567,9 +567,9 @@
<Interpretation_Window_Position>
<Visibility>SHOWNORMAL</Visibility>
<WindowPlacement>RESTORETOMAXIMIZED</WindowPlacement>
<Top>173</Top>
<Top>179</Top>
<Left>10</Left>
<Bottom>451</Bottom>
<Bottom>457</Bottom>
<Right>359</Right>
</Interpretation_Window_Position>
</CAN_Message_Window>
@ -577,8 +577,8 @@
<COLUMN>
<ID/>
<Order>1</Order>
<IsVisible>0</IsVisible>
<Width>0</Width>
<IsVisible>1</IsVisible>
<Width>19</Width>
</COLUMN>
<COLUMN>
<ID>Time</ID>
@ -650,11 +650,11 @@
<ID>Data Byte(s)</ID>
<Order>13</Order>
<IsVisible>1</IsVisible>
<Width>720</Width>
<Width>701</Width>
</COLUMN>
<IsHex>1</IsHex>
<IsAppend>1</IsAppend>
<IsInterpret>0</IsInterpret>
<IsAppend>0</IsAppend>
<IsInterpret>1</IsInterpret>
<Time_Mode>SYSTEM</Time_Mode>
<Window_Position>
<Visibility>SHOWNORMAL</Visibility>
@ -667,9 +667,9 @@
<Interpretation_Window_Position>
<Visibility>SHOWNORMAL</Visibility>
<WindowPlacement>RESTORETOMAXIMIZED</WindowPlacement>
<Top>173</Top>
<Top>179</Top>
<Left>10</Left>
<Bottom>451</Bottom>
<Bottom>457</Bottom>
<Right>359</Right>
</Interpretation_Window_Position>
</J1939_Message_Window>
@ -680,8 +680,8 @@
<COLUMN>
<ID/>
<Order>1</Order>
<IsVisible>0</IsVisible>
<Width>0</Width>
<IsVisible>1</IsVisible>
<Width>19</Width>
</COLUMN>
<COLUMN>
<ID>Time</ID>
@ -735,11 +735,11 @@
<ID>Checksum</ID>
<Order>10</Order>
<IsVisible>1</IsVisible>
<Width>734</Width>
<Width>715</Width>
</COLUMN>
<IsHex>1</IsHex>
<IsAppend>1</IsAppend>
<IsInterpret>0</IsInterpret>
<IsAppend>0</IsAppend>
<IsInterpret>1</IsInterpret>
<Time_Mode>SYSTEM</Time_Mode>
<Window_Position>
<Visibility>SHOWNORMAL</Visibility>
@ -752,9 +752,9 @@
<Interpretation_Window_Position>
<Visibility>SHOWNORMAL</Visibility>
<WindowPlacement>RESTORETOMAXIMIZED</WindowPlacement>
<Top>173</Top>
<Top>179</Top>
<Left>10</Left>
<Bottom>451</Bottom>
<Bottom>457</Bottom>
<Right>359</Right>
</Interpretation_Window_Position>
</LIN_Message_Window>
@ -798,7 +798,7 @@
<IsExtended>FALSE</IsExtended>
<IsRtr>FALSE</IsRtr>
<DLC>4</DLC>
<DataBytes>0,0,0,0</DataBytes>
<DataBytes>0,0,39,16</DataBytes>
<Repetion>10</Repetion>
<Repetition_Enabled>FALSE</Repetition_Enabled>
<Key_Value>a</Key_Value>