WIP
This commit is contained in:
parent
8129c7bbfe
commit
ddd2b405c9
@ -7,6 +7,6 @@
|
|||||||
|
|
||||||
// Auto generated header file containing the last git revision
|
// Auto generated header file containing the last git revision
|
||||||
|
|
||||||
#define GIT_HASH "a982c79"
|
#define GIT_HASH "5b2e03a"
|
||||||
|
|
||||||
#endif //FLOATPUMP_GIT_REVISION_TEMPLATE_H
|
#endif //FLOATPUMP_GIT_REVISION_TEMPLATE_H
|
@ -200,7 +200,7 @@ int main(void) {
|
|||||||
|
|
||||||
uint32_t last_menu_retrigger = 0;
|
uint32_t last_menu_retrigger = 0;
|
||||||
|
|
||||||
bool f_store, f_restore = false;
|
bool f_store = false, f_restore = false;
|
||||||
menu::Menu_Entry_Type_Execute t_MStore;
|
menu::Menu_Entry_Type_Execute t_MStore;
|
||||||
menu::Menu_Entry_Type_Execute t_MRestore;
|
menu::Menu_Entry_Type_Execute t_MRestore;
|
||||||
t_MStore.linkConfig(&f_store);
|
t_MStore.linkConfig(&f_store);
|
||||||
|
@ -14,20 +14,34 @@ namespace floatpump {
|
|||||||
public:
|
public:
|
||||||
Config_Store();
|
Config_Store();
|
||||||
|
|
||||||
static uint32_t Flash_Write (uint32_t StartPageAddress, uint32_t Data, uint16_t n_words) {
|
static uint32_t StoreInFlash(uint32_t StartAddress, uint32_t *Data, uint16_t nData) {
|
||||||
static FLASH_EraseInitTypeDef EraseInitStruct;
|
uint16_t progr = 0;
|
||||||
uint32_t PAGEError;
|
|
||||||
int sofar=0;
|
|
||||||
|
|
||||||
HAL_FLASH_Unlock();
|
HAL_FLASH_Unlock();
|
||||||
FLASH_Erase_Sector(FLASH_SECTOR_7, VOLTAGE_RANGE_1);
|
FLASH_Erase_Sector(FLASH_SECTOR_7, VOLTAGE_RANGE_1);
|
||||||
HAL_FLASH_Program(FLASH_TYPEPROGRAM_WORD, StartPageAddress, Data);
|
while( progr < nData) {
|
||||||
|
if(HAL_FLASH_Program(FLASH_TYPEPROGRAM_WORD, StartAddress, Data[progr]) == HAL_OK) {
|
||||||
|
progr++;
|
||||||
|
StartAddress += 4; } else {
|
||||||
|
return HAL_FLASH_GetError();
|
||||||
|
}
|
||||||
|
}
|
||||||
HAL_FLASH_Lock();
|
HAL_FLASH_Lock();
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void saveToFlash() {
|
void saveToFlash() {
|
||||||
Flash_Write(0x08060000, this->RefillBelow.getValue(), 0);
|
uint32_t data[10];
|
||||||
|
data[0] = TankCalibLow.getValue();
|
||||||
|
data[1] = TankCalibHigh.getValue();
|
||||||
|
data[2] = TankMinLevel.getValue();
|
||||||
|
data[3] = TankHysteresis.getValue();
|
||||||
|
data[4] = TankPumpInvert.getValue();
|
||||||
|
data[5] = RefillEnable.getValue();
|
||||||
|
data[6] = RefillBlockInvert.getValue();
|
||||||
|
data[7] = RefillBlockEnable.getValue();
|
||||||
|
data[8] = RefillBelow.getValue();
|
||||||
|
data[9] = RefillHysteresis.getValue();
|
||||||
|
|
||||||
|
StoreInFlash(0x08060000, data, 10);
|
||||||
};
|
};
|
||||||
|
|
||||||
void resetDefaults();
|
void resetDefaults();
|
||||||
|
Loading…
Reference in New Issue
Block a user