@@ -93,6 +93,9 @@ uint32_t interval_sensor_update_high_update = 10;
93
93
uint32_t previous_sensor_update_low_update = 0 ;
94
94
uint32_t interval_sensor_update_low_update = 100 ;
95
95
96
+ uint32_t previous_millis_popup = 0 ;
97
+ uint32_t interval_popup = 2000 ;
98
+
96
99
/* Handles */
97
100
enum handles {
98
101
NT115 ,
@@ -163,6 +166,9 @@ uint8_t settings_menu_active = 0;
163
166
/* Flag to indicate if beep has been done at set temperature */
164
167
uint8_t beeped_at_set_temp = 0 ;
165
168
169
+ /* Flag to indicate if a popup is shown */
170
+ uint8_t popup_shown = 0 ;
171
+
166
172
/* Variables for thermocouple outlier detection */
167
173
float TC_temp_from_ADC = 0 ;
168
174
float TC_temp_from_ADC_previous = 0 ;
@@ -466,10 +472,9 @@ void change_state(mainstates new_state){
466
472
else {
467
473
HAL_GPIO_WritePin (GPIOB , USR_4_Pin , GPIO_PIN_RESET );
468
474
}
469
- if ((sensor_values .previous_state != RUN ) && (sensor_values .current_state == RUN )){
470
- beeped_at_set_temp = 0 ;
471
- }
472
-
475
+ if ((sensor_values .previous_state != RUN ) && (sensor_values .current_state == RUN )){
476
+ beeped_at_set_temp = 0 ;
477
+ }
473
478
}
474
479
475
480
/* Function to get the filtered MCU temperature */
@@ -615,7 +620,7 @@ void settings_menu(){
615
620
if (HAL_GPIO_ReadPin (GPIOB , SW_1_Pin ) == 1 ){
616
621
settings_menu_active = 1 ;
617
622
618
- UG_FillScreen (RGB_to_BRG (C_BLACK ));
623
+ UG_FillScreen (RGB_to_BRG (C_BLACK ));
619
624
char str [32 ];
620
625
memset (& str , '\0' , strlen (str ));
621
626
if ((flash_values .screen_rotation == 0 ) || (flash_values .screen_rotation == 2 )){
@@ -1080,8 +1085,8 @@ void show_popup(char *text){
1080
1085
UG_FillFrame (10 , 50 , 235 , 105 , RGB_to_BRG (C_ORANGE ));
1081
1086
UG_FillFrame (15 , 55 , 230 , 100 , RGB_to_BRG (C_WHITE ));
1082
1087
LCD_PutStr (20 , 70 , text , FONT_arial_20X23 , RGB_to_BRG (C_ORANGE ), RGB_to_BRG (C_WHITE ));
1083
- HAL_Delay ( 2000 ) ;
1084
- LCD_draw_main_screen ();
1088
+ popup_shown = 1 ;
1089
+ previous_millis_popup = HAL_GetTick ();
1085
1090
standby_state_written_to_LCD = 0 ;
1086
1091
sleep_state_written_to_LCD = 0 ;
1087
1092
}
@@ -1119,7 +1124,6 @@ void handle_delta_temperature(){
1119
1124
if ((startup_done == 1 ) && ((sensor_values .thermocouple_temperature - sensor_values .thermocouple_temperature_previous ) > MAX_TC_DELTA_FAULTDETECTION )){
1120
1125
heater_off ();
1121
1126
sensor_values .heater_current = 0 ;
1122
- update_display ();
1123
1127
show_popup ("No or Faulty tip!" );
1124
1128
change_state (EMERGENCY_SLEEP );
1125
1129
}
@@ -1195,7 +1199,7 @@ void handle_button_status(){
1195
1199
/* start settings menu */
1196
1200
settings_menu ();
1197
1201
}
1198
-
1202
+
1199
1203
/* Set "set temp" to preset temp 1 */
1200
1204
if (SW_2_pressed == 1 ){
1201
1205
SW_2_pressed = 0 ;
@@ -1218,7 +1222,7 @@ void handle_button_status(){
1218
1222
sleep_state_written_to_LCD = 0 ;
1219
1223
}
1220
1224
}
1221
-
1225
+
1222
1226
/* Set "set temp" to preset temp 2 */
1223
1227
if (SW_3_pressed == 1 ){
1224
1228
SW_3_pressed = 0 ;
@@ -1240,6 +1244,7 @@ void handle_button_status(){
1240
1244
LCD_draw_main_screen ();
1241
1245
sleep_state_written_to_LCD = 0 ;
1242
1246
}
1247
+ }
1243
1248
}
1244
1249
1245
1250
/* Get the status of handle in/on stand to trigger SLEEP */
@@ -1341,7 +1346,6 @@ void beep_at_set_temp(){
1341
1346
if (beeped_at_set_temp == 0 ){
1342
1347
if ((sensor_values .thermocouple_temperature_filtered > (sensor_values .set_temperature - 5 )) && (sensor_values .thermocouple_temperature_filtered < (sensor_values .set_temperature + 5 ))){
1343
1348
beeped_at_set_temp = 1 ;
1344
- //beep(flash_values.buzzer_enabled);
1345
1349
beep_double (flash_values .buzzer_enabled );
1346
1350
}
1347
1351
}
@@ -1663,7 +1667,7 @@ int main(void)
1663
1667
LCD_draw_main_screen ();
1664
1668
1665
1669
/* Start-up beep */
1666
- beep_double (flash_values .startup_beep );
1670
+ beep_double (flash_values .startup_beep );
1667
1671
1668
1672
//Flag to indicate that the startup sequence is done
1669
1673
startup_done = 1 ;
@@ -1759,12 +1763,20 @@ int main(void)
1759
1763
sensor_values .heater_current = 1 ; // If the current is not measured, apply a dummy value to heater_current
1760
1764
}
1761
1765
1762
- /* Update display */
1763
- if (HAL_GetTick () - previous_millis_display >= interval_display ){
1764
- sensor_values .requested_power_filtered = clamp (Moving_Average_Compute (sensor_values .requested_power , & requested_power_filtered_filter_struct ), 0 , PID_MAX_OUTPUT );
1765
- update_display ();
1766
- previous_millis_display = HAL_GetTick ();
1767
- }
1766
+ if (popup_shown == 1 ){
1767
+ if (HAL_GetTick () - previous_millis_popup >= interval_popup ){
1768
+ popup_shown = 0 ;
1769
+ LCD_draw_main_screen ();
1770
+ }
1771
+ }
1772
+ else {
1773
+ /* Update display */
1774
+ if (HAL_GetTick () - previous_millis_display >= interval_display ){
1775
+ sensor_values .requested_power_filtered = clamp (Moving_Average_Compute (sensor_values .requested_power , & requested_power_filtered_filter_struct ), 0 , PID_MAX_OUTPUT );
1776
+ update_display ();
1777
+ previous_millis_display = HAL_GetTick ();
1778
+ }
1779
+ }
1768
1780
/* USER CODE END WHILE */
1769
1781
1770
1782
/* USER CODE BEGIN 3 */
0 commit comments