@@ -291,10 +291,11 @@ Flash_values default_flash_values = {.startup_temperature = 330,
291
291
.temp_cal_400 = 400 ,
292
292
.temp_cal_450 = 450 ,
293
293
.serial_debug_print = 0 ,
294
- .displayed_temp_filter = 5 };
294
+ .displayed_temp_filter = 5 ,
295
+ .startup_temp_is_previous_temp = 0 };
295
296
296
297
/* List of names for settings menu */
297
- #define menu_length 25
298
+ #define menu_length 26
298
299
char menu_names [menu_length ][30 ] = { "Startup Temp °C " ,
299
300
"Temp Offset °C " ,
300
301
"Standby Temp °C " ,
@@ -317,6 +318,7 @@ char menu_names[menu_length][30] = { "Startup Temp °C ",
317
318
"Temp cal 450 " ,
318
319
"Serial DEBUG " ,
319
320
"Disp Temp. filter " ,
321
+ "Start at prev. temp " ,
320
322
"-Load Default- " ,
321
323
"-Save and Reboot- " ,
322
324
"-Exit no Save- " };
@@ -443,6 +445,11 @@ uint16_t RGB_to_BRG(uint16_t color){
443
445
void change_state (mainstates new_state ){
444
446
sensor_values .previous_state = sensor_values .current_state ;
445
447
sensor_values .current_state = new_state ;
448
+ if ((sensor_values .current_state == RUN ) && (flash_values .startup_temp_is_previous_temp == 1 )){
449
+ flash_values .startup_temperature = sensor_values .set_temperature ;
450
+ FlashWrite (& flash_values );
451
+ }
452
+
446
453
if ((sensor_values .current_state == RUN ) && (flash_values .GPIO4_ON_at_run == 1 )){
447
454
HAL_GPIO_WritePin (GPIOB , USR_4_Pin , GPIO_PIN_SET );
448
455
}
@@ -633,7 +640,7 @@ void settings_menu(){
633
640
((double * )& flash_values )[menu_cursor_position ] = (float )old_value + (float )(TIM2 -> CNT - 1000.0 ) / 2.0 - (float )menu_cursor_position ;
634
641
}
635
642
636
- if ((menu_cursor_position == 5 ) || (menu_cursor_position == 8 ) || (menu_cursor_position == 11 ) || (menu_cursor_position == 12 ) || (menu_cursor_position == 13 ) || (menu_cursor_position == 20 )){
643
+ if ((menu_cursor_position == 5 ) || (menu_cursor_position == 8 ) || (menu_cursor_position == 11 ) || (menu_cursor_position == 12 ) || (menu_cursor_position == 13 ) || (menu_cursor_position == 20 ) || ( menu_cursor_position == 22 ) ){
637
644
((double * )& flash_values )[menu_cursor_position ] = fmod (round (fmod (fabs (((double * )& flash_values )[menu_cursor_position ]), 2 )), 2 );
638
645
}
639
646
else if (menu_cursor_position == 9 ){
0 commit comments