From 24da8002d8167ed9cbd53a988ee16a81afd6a212 Mon Sep 17 00:00:00 2001 From: nedko Date: Sat, 5 Nov 2022 17:36:39 +0200 Subject: [PATCH] Fixed some bugs update TODO with EEPROM info --- TODO | 2 +- code/main.c | 7 ++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/TODO b/TODO index f752793..ae60a18 100644 --- a/TODO +++ b/TODO @@ -1,2 +1,2 @@ -Fix EEPROM detection (and maybe read / write) +Fix EEPROM write - detection and read work (maybe algo failure?) Battery icon - how to calc percentage? diff --git a/code/main.c b/code/main.c index 2e65366..e4358b6 100644 --- a/code/main.c +++ b/code/main.c @@ -518,9 +518,6 @@ int main() attach_detach_spool(); display_enable(1); - print_mm(); - print_direction(); - print_battery_icon(); state = STATE_IDLE; sei(); @@ -1586,7 +1583,7 @@ void spool_count(uint8_t event) // Clear old cell & write to next one write_eeprom_val(eeprom_idx, 0xFFFFFFFF, 0xFF); ++eeprom_idx; - eeprom_idx %= EEPROM_SIZE; + eeprom_idx %= (EEPROM_SIZE / EEPROM_IDX_SIZE); write_eeprom_val(eeprom_idx, (uint32_t) count_value_fine, rot_dir_is_A); } count_value = (uint32_t) count_value_fine; @@ -1894,7 +1891,7 @@ void attach_detach_spool() // Clear old cell & write to next one write_eeprom_val(eeprom_idx, 0xFFFFFFFF, 0xFF); ++eeprom_idx; - eeprom_idx %= EEPROM_SIZE; + eeprom_idx %= (EEPROM_SIZE / EEPROM_IDX_SIZE); write_eeprom_val(eeprom_idx, (uint32_t) count_value_fine, rot_dir_is_A); spool_counting = 0;