From 614fb33d6855d22486d61e26de7d73b00669c209 Mon Sep 17 00:00:00 2001 From: Eike Ahmels Date: Thu, 8 Aug 2024 23:53:02 +0200 Subject: [PATCH] fixed eeprom buffer alignment, fixed phaseout includes --- Inc/eeprom.h | 3 ++- Mcu/e230/Inc/phaseouts.h | 1 + Mcu/f031/Inc/phaseouts.h | 1 + Mcu/f051/Inc/phaseouts.h | 1 + Mcu/f415/Inc/phaseouts.h | 1 + Mcu/g071/Inc/phaseouts.h | 1 + Mcu/g431/Inc/phaseouts.h | 1 + Mcu/l431/Inc/phaseouts.h | 1 + Src/main.c | 7 +++++++ 9 files changed, 16 insertions(+), 1 deletion(-) diff --git a/Inc/eeprom.h b/Inc/eeprom.h index 667837f0..bb467e2f 100644 --- a/Inc/eeprom.h +++ b/Inc/eeprom.h @@ -50,8 +50,9 @@ typedef union EEprom_u { uint8_t tune[124]; // 52-175 //eeprom v3 uint8_t auto_advance; // 176 + char unused[7]; //177-183 }; - uint8_t buffer[177]; + uint8_t buffer[184]; } EEprom_t; extern EEprom_t eepromBuffer; diff --git a/Mcu/e230/Inc/phaseouts.h b/Mcu/e230/Inc/phaseouts.h index 37612388..8f30ce90 100644 --- a/Mcu/e230/Inc/phaseouts.h +++ b/Mcu/e230/Inc/phaseouts.h @@ -9,6 +9,7 @@ #define INC_PHASEOUTS_H_ #include "main.h" +#include "common.h" void allOff(); void comStep(int newStep); diff --git a/Mcu/f031/Inc/phaseouts.h b/Mcu/f031/Inc/phaseouts.h index 37612388..8f30ce90 100644 --- a/Mcu/f031/Inc/phaseouts.h +++ b/Mcu/f031/Inc/phaseouts.h @@ -9,6 +9,7 @@ #define INC_PHASEOUTS_H_ #include "main.h" +#include "common.h" void allOff(); void comStep(int newStep); diff --git a/Mcu/f051/Inc/phaseouts.h b/Mcu/f051/Inc/phaseouts.h index c66c8940..8a2167a6 100644 --- a/Mcu/f051/Inc/phaseouts.h +++ b/Mcu/f051/Inc/phaseouts.h @@ -9,6 +9,7 @@ #define INC_PHASEOUTS_H_ #include "main.h" +#include "common.h" void allOff(); void comStep(char newStep); diff --git a/Mcu/f415/Inc/phaseouts.h b/Mcu/f415/Inc/phaseouts.h index 37612388..8f30ce90 100644 --- a/Mcu/f415/Inc/phaseouts.h +++ b/Mcu/f415/Inc/phaseouts.h @@ -9,6 +9,7 @@ #define INC_PHASEOUTS_H_ #include "main.h" +#include "common.h" void allOff(); void comStep(int newStep); diff --git a/Mcu/g071/Inc/phaseouts.h b/Mcu/g071/Inc/phaseouts.h index 37612388..8f30ce90 100644 --- a/Mcu/g071/Inc/phaseouts.h +++ b/Mcu/g071/Inc/phaseouts.h @@ -9,6 +9,7 @@ #define INC_PHASEOUTS_H_ #include "main.h" +#include "common.h" void allOff(); void comStep(int newStep); diff --git a/Mcu/g431/Inc/phaseouts.h b/Mcu/g431/Inc/phaseouts.h index 37612388..8f30ce90 100644 --- a/Mcu/g431/Inc/phaseouts.h +++ b/Mcu/g431/Inc/phaseouts.h @@ -9,6 +9,7 @@ #define INC_PHASEOUTS_H_ #include "main.h" +#include "common.h" void allOff(); void comStep(int newStep); diff --git a/Mcu/l431/Inc/phaseouts.h b/Mcu/l431/Inc/phaseouts.h index c66c8940..8a2167a6 100644 --- a/Mcu/l431/Inc/phaseouts.h +++ b/Mcu/l431/Inc/phaseouts.h @@ -9,6 +9,7 @@ #define INC_PHASEOUTS_H_ #include "main.h" +#include "common.h" void allOff(); void comStep(char newStep); diff --git a/Src/main.c b/Src/main.c index 065261c6..1337a555 100644 --- a/Src/main.c +++ b/Src/main.c @@ -758,6 +758,13 @@ void loadEEpromSettings() high_rpm_level = motor_kv / 12 / (32 / eepromBuffer.motor_poles); } reverse_speed_threshold = map(motor_kv, 300, 3000, 1000, 500); + + if (eepromBuffer.eeprom_version > 2) { + if (eepromBuffer.auto_advance > 1) { + eepromBuffer.auto_advance = 0; + save_flash_nolib(eepromBuffer.buffer, sizeof(eepromBuffer.buffer), eeprom_address); + } + } // reverse_speed_threshold = 200; // if (!eepromBuffer.comp_pwm) { // eepromBuffer.bi_direction = 0;