Skip to content

Commit cf60674

Browse files
author
Peter Wegmann
committed
bug fixes
-options are saved when shutdown via options menu - "eeprom might be invalid" message on startup now only goes away after user enters calibration mode once
1 parent 943083b commit cf60674

File tree

7 files changed

+23
-14
lines changed

7 files changed

+23
-14
lines changed

Controller/diagnostic_mode.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include <stdbool.h>
1010
#include <string.h>
1111
#include <stdio.h>
12+
#include <avr/eeprom.h>
1213

1314
#include "base_controller.h"
1415
#include "diagnostic_mode.h"
@@ -173,6 +174,10 @@ void diag_pressedNONE(Controller_Model *Model){
173174

174175
void calibration(Controller_Model *Model){
175176
LCD_Cls(BGC);
177+
178+
// User entered calibration --> this disables warning on startup
179+
eeprom_write_word(&LVM.eeprom->eeprom_changed,LVM.version->Fw_version);
180+
176181
if(LCD_Dialog(STR_CALIBRATION, STR_SET_RESISTANCE_OR_NZERO_TO_DEFAULT , D_FGC, D_BGC,CALIBRATE_TIMEOUT_TIME))
177182
{
178183
// User answered "Yes"

Controller/option_mode.c

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -265,10 +265,10 @@ void option_pre_Switch_case_Tasks(Controller_Model *Model){
265265
set_timeout(OPT_TIMEOUT_TIME, TIMER_3, USE_TIMER);
266266
}
267267

268-
if(!set_timeout(0,TIMER_3, USE_TIMER)) //shutdown after shutdown_timout if no key was pressed
268+
if(!set_timeout(0,TIMER_3, USE_TIMER)) //exit options if no key was pressed
269269
{
270270
option_model.options_changed = false;
271-
option_exit(Model);
271+
option_exit(Model, 0);
272272
}
273273
}
274274

@@ -280,7 +280,7 @@ void option_post_Switch_case_Tasks(Controller_Model *Model){
280280
if ((option_model.page == 0)||(option_model.page == 7))
281281
{
282282
set_OptionModel(1,1,0);
283-
option_exit(Model);
283+
option_exit(Model, 0);
284284
ready_for_new_key();
285285
return;
286286
}
@@ -387,9 +387,11 @@ void Bool_valueChange (ValueOptions *optEntry, int key)
387387
void Bool_valueChange_Shutdown(ValueOptions *optEntry, int key){
388388
if(LCD_Dialog(STR_SHUTDOWN_OPT,STR_DO_YOU_REALLY_WANT_SHUTDOWN, D_FGC, D_BGC,SHUTDOWN_TIMEOUT_TIME))
389389
{
390+
Controller_Model * Model = (Controller_Model *) &option_model;
391+
option_exit(Model,1);
390392
LCD_Cls(BGC);
391393

392-
Controller_Model * Model = (Controller_Model *) &option_model;
394+
393395
shutdown_LVM(Model);
394396
}
395397
else {
@@ -1115,7 +1117,7 @@ void opt_ValueChange(){
11151117

11161118

11171119

1118-
void option_exit(Controller_Model * Model){
1120+
void option_exit(Controller_Model * Model, uint8_t headless){
11191121
// Set buffered variables
11201122
LVM.options->display_reversed = option_model.display_reversed_buff;
11211123
LVM.options->batt_min = option_model.batt_min_buff;
@@ -1166,7 +1168,11 @@ void option_exit(Controller_Model * Model){
11661168
}
11671169

11681170
}
1169-
paint_main(Time, Model->mode->netstat, PAINT_ALL);
1171+
if (!headless)
1172+
{
1173+
paint_main(Time, Model->mode->netstat, PAINT_ALL);
1174+
}
1175+
11701176
Model->mode->next = ex_main;
11711177
option_model.options_changed = false;
11721178

Controller/option_mode.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ void opt_drawPage(void);
213213

214214
void opt_ValueChange(void);
215215

216-
void option_exit(Controller_Model * Model);
216+
void option_exit(Controller_Model * Model, uint8_t headless);
217217

218218

219219

LHe-Level-Meter.cproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
<ToolName>STK500</ToolName>
5555
</com_atmel_avrdbg_tool_stk500>
5656
<avrtoolinterface>ISP</avrtoolinterface>
57-
<avrtoolinterfaceclock>999946</avrtoolinterfaceclock>
57+
<avrtoolinterfaceclock>944399</avrtoolinterfaceclock>
5858
<com_atmel_avrdbg_tool_simulator>
5959
<ToolOptions>
6060
<InterfaceProperties>
@@ -69,7 +69,7 @@
6969
<com_atmel_avrdbg_tool_powerdebugger>
7070
<ToolOptions>
7171
<InterfaceProperties>
72-
<IspClock>999946</IspClock>
72+
<IspClock>944399</IspClock>
7373
<JtagDbgClock>220000</JtagDbgClock>
7474
<JtagEnableExtResetOnStartSession>true</JtagEnableExtResetOnStartSession>
7575
<JtagInChain>false</JtagInChain>

config.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313

1414

15-
#define FIRMWARE_VERSION 221
15+
#define FIRMWARE_VERSION 222
1616

1717
#define BRANCH_ID 1
1818
#define LAST_FIRMWARE_EEPROM_CHANGED 220

display_utilities.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -380,8 +380,6 @@ void paint_time_pressure(struct tm ltime, double lpress, _Bool update)
380380
LCD_Print(xbee_get_coordID(),X_PTP_COORDINATOR +xoff-strlen(xbee_get_coordID())*FONT1_W,Y_PTP_COORDINATOR,1,1,1,color,BGC);
381381

382382

383-
if (!update)
384-
{
385383

386384
//autofill indicator
387385
uint8_t boxheight = AUTOFILL_BOX_WIDTH;
@@ -396,7 +394,7 @@ void paint_time_pressure(struct tm ltime, double lpress, _Bool update)
396394
LCD_Box(x0,y0,x0+boxheight,y0+boxheight,green);
397395
LCD_Box(x0+1,y0+1,x0+boxheight-1,y0+boxheight-1,BGC);
398396
}
399-
}
397+
400398

401399

402400

main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -822,7 +822,7 @@ int main(void)
822822
if (((LVM.vars->eeprom_changed != LVM.version->Fw_version) && LVM.version->FW_eeprom_changed > LVM.vars->eeprom_changed) || LVM.vars->eeprom_changed > LVM.version->Fw_version ){
823823
// DIALOG --> eeprom values might be undefined pls recalibrate
824824
if(LCD_Dialog(STR_EEPROM_UNDEFINED,STR_VALUES_MIGHT_BE_UNDEFINED,D_BGC,D_FGC,30)){
825-
eeprom_write_word(&LVM.eeprom->eeprom_changed,LVM.version->Fw_version);
825+
826826
}
827827

828828
ready_for_new_key();

0 commit comments

Comments
 (0)