@@ -160,6 +160,9 @@ uint8_t startup_done = 0;
160
160
/* Flag to indicate that settings menu is active */
161
161
uint8_t settings_menu_active = 0 ;
162
162
163
+ /* Flag to indicate if beep has been done at set temperature */
164
+ uint8_t beeped_at_set_temp = 0 ;
165
+
163
166
/* Variables for thermocouple outlier detection */
164
167
float TC_temp_from_ADC = 0 ;
165
168
float TC_temp_from_ADC_previous = 0 ;
@@ -296,10 +299,11 @@ Flash_values default_flash_values = {.startup_temperature = 330,
296
299
.serial_debug_print = 0 ,
297
300
.displayed_temp_filter = 5 ,
298
301
.startup_temp_is_previous_temp = 0 ,
299
- .three_button_mode = 0 };
302
+ .three_button_mode = 0 ,
303
+ .beep_at_set_temp = 0 };
300
304
301
305
/* List of names for settings menu */
302
- #define menu_length 27
306
+ #define menu_length 28
303
307
char menu_names [menu_length ][30 ] = { "Startup Temp °C " ,
304
308
"Temp Offset °C " ,
305
309
"Standby Temp °C " ,
@@ -324,6 +328,7 @@ char menu_names[menu_length][30] = { "Startup Temp °C ",
324
328
"Disp Temp. filter " ,
325
329
"Start at prev. temp " ,
326
330
"3-button mode " ,
331
+ "Beep at set temp " ,
327
332
"-Load Default- " ,
328
333
"-Save and Reboot- " ,
329
334
"-Exit no Save- " };
@@ -461,6 +466,10 @@ void change_state(mainstates new_state){
461
466
else {
462
467
HAL_GPIO_WritePin (GPIOB , USR_4_Pin , GPIO_PIN_RESET );
463
468
}
469
+ if ((sensor_values .previous_state != RUN ) && (sensor_values .current_state == RUN )){
470
+ beeped_at_set_temp = 0 ;
471
+ }
472
+
464
473
}
465
474
466
475
/* Function to get the filtered MCU temperature */
@@ -647,7 +656,7 @@ void settings_menu(){
647
656
((float * )& flash_values )[menu_cursor_position ] = (float )old_value + (float )(TIM2 -> CNT - 1000.0 ) / 2.0 - (float )menu_cursor_position ;
648
657
}
649
658
650
- 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 ) || (menu_cursor_position == 23 )){
659
+ 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 ) || (menu_cursor_position == 23 ) || ( menu_cursor_position == 24 ) ){
651
660
((float * )& flash_values )[menu_cursor_position ] = fmod (round (fmod (fabs (((float * )& flash_values )[menu_cursor_position ]), 2 )), 2 );
652
661
}
653
662
else if (menu_cursor_position == 9 ){
@@ -1301,6 +1310,18 @@ void set_handle_values(){
1301
1310
}
1302
1311
}
1303
1312
1313
+ void beep_at_set_temp (){
1314
+ if (flash_values .beep_at_set_temp == 1 ){
1315
+ if (beeped_at_set_temp == 0 ){
1316
+ if ((sensor_values .thermocouple_temperature_filtered > (sensor_values .set_temperature - 5 )) && (sensor_values .thermocouple_temperature_filtered < (sensor_values .set_temperature + 5 ))){
1317
+ beeped_at_set_temp = 1 ;
1318
+ //beep(flash_values.buzzer_enabled);
1319
+ beep_double (flash_values .buzzer_enabled );
1320
+ }
1321
+ }
1322
+ }
1323
+ }
1324
+
1304
1325
/* Interrupts at button press */
1305
1326
volatile static uint16_t btnPressed = 0 ;
1306
1327
volatile static uint16_t debounceDone = 0 ;
@@ -1616,7 +1637,7 @@ int main(void)
1616
1637
LCD_draw_main_screen ();
1617
1638
1618
1639
/* Start-up beep */
1619
- beep_startup (flash_values .startup_beep );
1640
+ beep_double (flash_values .startup_beep );
1620
1641
1621
1642
//Flag to indicate that the startup sequence is done
1622
1643
startup_done = 1 ;
@@ -1639,6 +1660,7 @@ int main(void)
1639
1660
get_bus_voltage ();
1640
1661
get_heater_current ();
1641
1662
get_mcu_temp ();
1663
+ beep_at_set_temp ();
1642
1664
previous_sensor_update_low_update = HAL_GetTick ();
1643
1665
}
1644
1666
0 commit comments