Skip to content
Snippets Groups Projects
Commit d47b0a2e authored by mfenner's avatar mfenner
Browse files

Bootloader corrected to support empty eeproms

parent 78663fbb
No related branches found
No related tags found
No related merge requests found
No preview for this file type
This diff is collapsed.
......@@ -220,5 +220,7 @@ void eeprom_write_upgrade_started( void )
bool eeprom_is_pending( void )
{
return eeprom_read_byte(EEPROM_ADDR_FWUPGRADE) == EEPROM_FWUPGRADE_STARTED;
uint8_t value = eeprom_read_byte(EEPROM_ADDR_FWUPGRADE);
return (value == EEPROM_FWUPGRADE_STARTED) ||
(value != EEPROM_FWREADY_VALUE && value != EEPROM_FWUPGRADE_VALUE);
}
......@@ -50,12 +50,12 @@ static void tc_overflow_callback(void) //100 ms
sec_counter++;
idle_counter++;
timer_100ms_flag = true;
if(sec_counter == 5)
if(sec_counter == 10)
{
ioport_toggle_pin(MMC_LED);
sec_counter = 0;
}
//RESET after 10 s of inactivity
//RESET after 20 s of inactivity
if (idle_counter == INACTIVITY_BEFORE_RESET_S*10)
{
//reset processor
......
......@@ -28,7 +28,7 @@
#ifndef TIMER_LIB_H_
#define TIMER_LIB_H_
#define INACTIVITY_BEFORE_RESET_S 10
#define INACTIVITY_BEFORE_RESET_S 20
extern volatile bool timer_100ms_flag;
......
......@@ -37,6 +37,7 @@ void initEEPROM( void )
{
if (eeprom_read_byte(EEPROM_ADDR_INIT) != EEPROM_INIT_VALUE)
{
printf("!Initializing EEPROM with default values\r\n");
eeprom_write_byte(EEPROM_ADDR_LIMIT_MASK, 0xFF);
eeprom_write_dword(EEPROM_ADDR_LIMIT_CHANNEL0, MAX_CURRENT_LIMIT);
eeprom_write_dword(EEPROM_ADDR_LIMIT_CHANNEL1, MAX_CURRENT_LIMIT);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment