Added dccd logic config
This commit is contained in:
@@ -11,15 +11,21 @@ static const uint16_t addr_bmode = 0x0001;
|
||||
static const uint16_t addr_pot_mode = 0x0002;
|
||||
static const uint16_t addr_dsp_brigth = 0x0003;
|
||||
static const uint16_t addr_dsp_dimm = 0x0004;
|
||||
static const uint16_t addr_lock_current = 0x0005;
|
||||
static const uint16_t addr_brake_force = 0x0005;
|
||||
static const uint16_t addr_max_hbrake_time = 0x0006;
|
||||
static const uint16_t addr_lock_current = 0x0008;
|
||||
|
||||
static const uint8_t def_btn_force = 0;
|
||||
static const uint8_t def_pot_mode = 0;
|
||||
static const uint8_t def_bmode = 0;
|
||||
static const uint8_t def_dimm = 50;
|
||||
static const uint8_t def_brigth = 100;
|
||||
static const uint8_t def_brake_force = 100;
|
||||
static const uint16_t def_max_hbrake_time = 1000;
|
||||
static const uint16_t def_lock_current = 4500;
|
||||
|
||||
static const uint16_t max_lock_current = 6000;
|
||||
|
||||
/**** Private variables ****/
|
||||
/**** Private function declarations ****/
|
||||
/**** Public function definitions ****/
|
||||
@@ -30,6 +36,8 @@ logic::CfgMemory::CfgMemory(void)
|
||||
this->mem_pot_mode = 0;
|
||||
this->mem_dsp_brigth = 0;
|
||||
this->mem_dsp_dimm = 0;
|
||||
this->mem_brake_force = 0;
|
||||
this->mem_max_hbrake_time = 0;
|
||||
this->mem_lock_current = 0;
|
||||
|
||||
this->restore();
|
||||
@@ -47,8 +55,11 @@ void logic::CfgMemory::init(void)
|
||||
this->mem_pot_mode = mcu::eeprom_read8b(addr_pot_mode);
|
||||
this->mem_dsp_brigth = mcu::eeprom_read8b(addr_dsp_brigth);
|
||||
this->mem_dsp_dimm = mcu::eeprom_read8b(addr_dsp_dimm);
|
||||
this->mem_brake_force = mcu::eeprom_read8b(addr_brake_force);
|
||||
this->mem_max_hbrake_time = mcu::eeprom_read16b(addr_max_hbrake_time);
|
||||
this->mem_lock_current = mcu::eeprom_read16b(addr_lock_current);
|
||||
|
||||
// Validate EEPROM data
|
||||
if(this->mem_btn_force > 100)
|
||||
{
|
||||
this->mem_btn_force = def_btn_force;
|
||||
@@ -79,7 +90,22 @@ void logic::CfgMemory::init(void)
|
||||
mcu::eeprom_write8b(addr_dsp_dimm, this->mem_dsp_dimm);
|
||||
};
|
||||
|
||||
if(this->mem_lock_current > 6000)
|
||||
if(this->mem_brake_force > 100)
|
||||
{
|
||||
this->mem_brake_force = def_brake_force;
|
||||
mcu::eeprom_write8b(addr_brake_force, this->mem_brake_force);
|
||||
};
|
||||
|
||||
/*
|
||||
No wrong value
|
||||
if(this->mem_max_hbrake_time > 1000)
|
||||
{
|
||||
this->mem_max_hbrake_time = def_max_hbrake_time;
|
||||
mcu::eeprom_write16b(addr_lock_current, this->mem_max_hbrake_time);
|
||||
};
|
||||
*/
|
||||
|
||||
if(this->mem_lock_current > max_lock_current)
|
||||
{
|
||||
this->mem_lock_current = def_lock_current;
|
||||
mcu::eeprom_write16b(addr_lock_current, this->mem_lock_current);
|
||||
@@ -125,10 +151,22 @@ void logic::CfgMemory::save_all(void)
|
||||
mcu::eeprom_write8b(addr_dsp_dimm, this->mem_dsp_dimm);
|
||||
};
|
||||
|
||||
if(this->brake_force != this->mem_brake_force)
|
||||
{
|
||||
this->mem_brake_force = this->brake_force;
|
||||
mcu::eeprom_write8b(addr_brake_force, this->mem_brake_force);
|
||||
};
|
||||
|
||||
if(this->max_hbrake_time != this->mem_max_hbrake_time)
|
||||
{
|
||||
this->mem_max_hbrake_time = this->max_hbrake_time;
|
||||
mcu::eeprom_write16b(addr_max_hbrake_time, this->mem_max_hbrake_time);
|
||||
};
|
||||
|
||||
if(this->lock_current != this->mem_lock_current)
|
||||
{
|
||||
this->mem_lock_current = this->lock_current;
|
||||
mcu::eeprom_write8b(addr_lock_current, this->mem_lock_current);
|
||||
mcu::eeprom_write16b(addr_lock_current, this->mem_lock_current);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -139,6 +177,8 @@ void logic::CfgMemory::restore(void)
|
||||
this->pot_mode = this->mem_pot_mode;
|
||||
this->dsp_brigth = this->mem_dsp_brigth;
|
||||
this->dsp_dimm = this->mem_dsp_dimm;
|
||||
this->brake_force = this->mem_brake_force;
|
||||
this->max_hbrake_time = this->mem_max_hbrake_time;
|
||||
this->lock_current = this->mem_lock_current;
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,8 @@ class CfgMemory
|
||||
uint8_t mem_pot_mode;
|
||||
uint8_t mem_dsp_brigth;
|
||||
uint8_t mem_dsp_dimm;
|
||||
uint8_t mem_brake_force;
|
||||
uint16_t mem_max_hbrake_time;
|
||||
uint16_t mem_lock_current;
|
||||
|
||||
public:
|
||||
@@ -28,6 +30,8 @@ class CfgMemory
|
||||
uint8_t pot_mode;
|
||||
uint8_t dsp_brigth;
|
||||
uint8_t dsp_dimm;
|
||||
uint8_t brake_force;
|
||||
uint16_t max_hbrake_time;
|
||||
uint16_t lock_current;
|
||||
|
||||
void init(void);
|
||||
|
||||
Reference in New Issue
Block a user