@@ -292,10 +292,11 @@ Flash_values default_flash_values = {.startup_temperature = 330,
292
292
.temp_cal_450 = 450 ,
293
293
.serial_debug_print = 0 ,
294
294
.displayed_temp_filter = 5 ,
295
- .startup_temp_is_previous_temp = 0 };
295
+ .startup_temp_is_previous_temp = 0 ,
296
+ .three_button_mode = 0 };
296
297
297
298
/* List of names for settings menu */
298
- #define menu_length 26
299
+ #define menu_length 27
299
300
char menu_names [menu_length ][30 ] = { "Startup Temp °C " ,
300
301
"Temp Offset °C " ,
301
302
"Standby Temp °C " ,
@@ -319,6 +320,7 @@ char menu_names[menu_length][30] = { "Startup Temp °C ",
319
320
"Serial DEBUG " ,
320
321
"Disp Temp. filter " ,
321
322
"Start at prev. temp " ,
323
+ "3-button mode " ,
322
324
"-Load Default- " ,
323
325
"-Save and Reboot- " ,
324
326
"-Exit no Save- " };
@@ -640,7 +642,7 @@ void settings_menu(){
640
642
((float * )& flash_values )[menu_cursor_position ] = (float )old_value + (float )(TIM2 -> CNT - 1000.0 ) / 2.0 - (float )menu_cursor_position ;
641
643
}
642
644
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 )){
645
+ 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 ) ){
644
646
((float * )& flash_values )[menu_cursor_position ] = fmod (round (fmod (fabs (((float * )& flash_values )[menu_cursor_position ]), 2 )), 2 );
645
647
}
646
648
else if (menu_cursor_position == 9 ){
@@ -955,14 +957,18 @@ void LCD_draw_main_screen(){
955
957
UG_DrawLine (0 , 296 , 240 , 296 , RGB_to_BRG (C_DARK_SEA_GREEN ));
956
958
UG_DrawLine (0 , 297 , 240 , 297 , RGB_to_BRG (C_DARK_SEA_GREEN ));
957
959
958
-
959
- LCD_PutStr (11 , 301 , "PRESETS" , FONT_arial_20X23 , RGB_to_BRG (C_DARK_SEA_GREEN ), RGB_to_BRG (C_BLACK ));
960
- memset (DISPLAY_buffer , '\0' , sizeof (DISPLAY_buffer ));
961
- sprintf (DISPLAY_buffer , "%.0f" , convert_temperature (flash_values .preset_temp_1 ));
962
- LCD_PutStr (130 , 301 , DISPLAY_buffer , FONT_arial_20X23 , RGB_to_BRG (C_DARK_SEA_GREEN ), RGB_to_BRG (C_BLACK ));
963
- memset (DISPLAY_buffer , '\0' , sizeof (DISPLAY_buffer ));
964
- sprintf (DISPLAY_buffer , "%.0f" , convert_temperature (flash_values .preset_temp_2 ));
965
- LCD_PutStr (190 , 301 , DISPLAY_buffer , FONT_arial_20X23 , RGB_to_BRG (C_DARK_SEA_GREEN ), RGB_to_BRG (C_BLACK ));
960
+ if (flash_values .three_button_mode == 1 ){
961
+ LCD_PutStr (11 , 301 , "TEMP DOWN UP" , FONT_arial_20X23 , RGB_to_BRG (C_DARK_SEA_GREEN ), RGB_to_BRG (C_BLACK ));
962
+ }
963
+ else {
964
+ LCD_PutStr (11 , 301 , "PRESETS" , FONT_arial_20X23 , RGB_to_BRG (C_DARK_SEA_GREEN ), RGB_to_BRG (C_BLACK ));
965
+ memset (DISPLAY_buffer , '\0' , sizeof (DISPLAY_buffer ));
966
+ sprintf (DISPLAY_buffer , "%.0f" , convert_temperature (flash_values .preset_temp_1 ));
967
+ LCD_PutStr (130 , 301 , DISPLAY_buffer , FONT_arial_20X23 , RGB_to_BRG (C_DARK_SEA_GREEN ), RGB_to_BRG (C_BLACK ));
968
+ memset (DISPLAY_buffer , '\0' , sizeof (DISPLAY_buffer ));
969
+ sprintf (DISPLAY_buffer , "%.0f" , convert_temperature (flash_values .preset_temp_2 ));
970
+ LCD_PutStr (190 , 301 , DISPLAY_buffer , FONT_arial_20X23 , RGB_to_BRG (C_DARK_SEA_GREEN ), RGB_to_BRG (C_BLACK ));
971
+ }
966
972
967
973
UG_DrawFrame (208 , 64 , 232 , 270 , RGB_to_BRG (C_WHITE ));
968
974
UG_DrawFrame (209 , 65 , 231 , 269 , RGB_to_BRG (C_WHITE ));
@@ -1024,19 +1030,26 @@ void LCD_draw_main_screen(){
1024
1030
UG_DrawLine (315 , 0 , 315 , 240 , RGB_to_BRG (C_DARK_SEA_GREEN ));
1025
1031
UG_DrawLine (316 , 0 , 316 , 240 , RGB_to_BRG (C_DARK_SEA_GREEN ));
1026
1032
1027
- LCD_PutStr (285 , 75 , "P" , FONT_arial_20X23 , RGB_to_BRG (C_DARK_SEA_GREEN ), RGB_to_BRG (C_BLACK ));
1028
- LCD_PutStr (285 , 97 , "R" , FONT_arial_20X23 , RGB_to_BRG (C_DARK_SEA_GREEN ), RGB_to_BRG (C_BLACK ));
1029
- LCD_PutStr (285 , 119 , "E" , FONT_arial_20X23 , RGB_to_BRG (C_DARK_SEA_GREEN ), RGB_to_BRG (C_BLACK ));
1030
- LCD_PutStr (285 , 141 , "S" , FONT_arial_20X23 , RGB_to_BRG (C_DARK_SEA_GREEN ), RGB_to_BRG (C_BLACK ));
1031
- LCD_PutStr (285 , 163 , "E" , FONT_arial_20X23 , RGB_to_BRG (C_DARK_SEA_GREEN ), RGB_to_BRG (C_BLACK ));
1032
- LCD_PutStr (285 , 185 , "T" , FONT_arial_20X23 , RGB_to_BRG (C_DARK_SEA_GREEN ), RGB_to_BRG (C_BLACK ));
1033
- LCD_PutStr (285 , 207 , "S" , FONT_arial_20X23 , RGB_to_BRG (C_DARK_SEA_GREEN ), RGB_to_BRG (C_BLACK ));
1034
- memset (& DISPLAY_buffer , '\0' , sizeof (DISPLAY_buffer ));
1035
- sprintf (DISPLAY_buffer , "%.0f" , flash_values .preset_temp_1 );
1036
- LCD_PutStr (272 , 40 , DISPLAY_buffer , FONT_arial_20X23 , RGB_to_BRG (C_DARK_SEA_GREEN ), RGB_to_BRG (C_BLACK ));
1037
- memset (& DISPLAY_buffer , '\0' , sizeof (DISPLAY_buffer ));
1038
- sprintf (DISPLAY_buffer , "%.0f" , flash_values .preset_temp_2 );
1039
- LCD_PutStr (272 , 10 , DISPLAY_buffer , FONT_arial_20X23 , RGB_to_BRG (C_DARK_SEA_GREEN ), RGB_to_BRG (C_BLACK ));
1033
+ if (flash_values .three_button_mode == 1 ){
1034
+ LCD_PutStr (269 , 90 , "DEC" , FONT_arial_20X23 , RGB_to_BRG (C_DARK_SEA_GREEN ), RGB_to_BRG (C_BLACK ));
1035
+ LCD_PutStr (269 , 10 , "INC" , FONT_arial_20X23 , RGB_to_BRG (C_DARK_SEA_GREEN ), RGB_to_BRG (C_BLACK ));
1036
+ }
1037
+ else {
1038
+ LCD_PutStr (285 , 75 , "P" , FONT_arial_20X23 , RGB_to_BRG (C_DARK_SEA_GREEN ), RGB_to_BRG (C_BLACK ));
1039
+ LCD_PutStr (285 , 97 , "R" , FONT_arial_20X23 , RGB_to_BRG (C_DARK_SEA_GREEN ), RGB_to_BRG (C_BLACK ));
1040
+ LCD_PutStr (285 , 119 , "E" , FONT_arial_20X23 , RGB_to_BRG (C_DARK_SEA_GREEN ), RGB_to_BRG (C_BLACK ));
1041
+ LCD_PutStr (285 , 141 , "S" , FONT_arial_20X23 , RGB_to_BRG (C_DARK_SEA_GREEN ), RGB_to_BRG (C_BLACK ));
1042
+ LCD_PutStr (285 , 163 , "E" , FONT_arial_20X23 , RGB_to_BRG (C_DARK_SEA_GREEN ), RGB_to_BRG (C_BLACK ));
1043
+ LCD_PutStr (285 , 185 , "T" , FONT_arial_20X23 , RGB_to_BRG (C_DARK_SEA_GREEN ), RGB_to_BRG (C_BLACK ));
1044
+ LCD_PutStr (285 , 207 , "S" , FONT_arial_20X23 , RGB_to_BRG (C_DARK_SEA_GREEN ), RGB_to_BRG (C_BLACK ));
1045
+ memset (& DISPLAY_buffer , '\0' , sizeof (DISPLAY_buffer ));
1046
+ sprintf (DISPLAY_buffer , "%.0f" , flash_values .preset_temp_1 );
1047
+ LCD_PutStr (272 , 40 , DISPLAY_buffer , FONT_arial_20X23 , RGB_to_BRG (C_DARK_SEA_GREEN ), RGB_to_BRG (C_BLACK ));
1048
+ memset (& DISPLAY_buffer , '\0' , sizeof (DISPLAY_buffer ));
1049
+ sprintf (DISPLAY_buffer , "%.0f" , flash_values .preset_temp_2 );
1050
+ LCD_PutStr (272 , 10 , DISPLAY_buffer , FONT_arial_20X23 , RGB_to_BRG (C_DARK_SEA_GREEN ), RGB_to_BRG (C_BLACK ));
1051
+ }
1052
+
1040
1053
1041
1054
1042
1055
UG_DrawFrame (8 , 30 , 32 , 212 , RGB_to_BRG (C_WHITE ));
@@ -1076,7 +1089,12 @@ void LCD_draw_earth_fault_popup(){
1076
1089
void get_set_temperature (){
1077
1090
if (custom_temperature_on == 0 ){
1078
1091
TIM2 -> CNT = clamp (TIM2 -> CNT , MIN_SELECTABLE_TEMPERATURE , MAX_SELECTABLE_TEMPERATURE );
1079
- sensor_values .set_temperature = (uint16_t )(TIM2 -> CNT /2 ) * 2 ;
1092
+ if (flash_values .three_button_mode == 1 ){
1093
+ sensor_values .set_temperature = (uint16_t )(TIM2 -> CNT );
1094
+ }
1095
+ else {
1096
+ sensor_values .set_temperature = (uint16_t )(TIM2 -> CNT /2 ) * 2 ;
1097
+ }
1080
1098
}
1081
1099
}
1082
1100
@@ -1159,12 +1177,22 @@ void handle_button_status(){
1159
1177
/* Set "set temp" to preset temp 1 */
1160
1178
if (SW_2_pressed == 1 ){
1161
1179
SW_2_pressed = 0 ;
1162
- TIM2 -> CNT = flash_values .preset_temp_1 ;
1180
+ if (flash_values .three_button_mode == 1 ){
1181
+ TIM2 -> CNT -= 5 ;
1182
+ }
1183
+ else {
1184
+ TIM2 -> CNT = flash_values .preset_temp_1 ;
1185
+ }
1163
1186
}
1164
1187
/* Set "set temp" to preset temp 2 */
1165
1188
if (SW_3_pressed == 1 ){
1166
1189
SW_3_pressed = 0 ;
1167
- TIM2 -> CNT = flash_values .preset_temp_2 ;
1190
+ if (flash_values .three_button_mode == 1 ){
1191
+ TIM2 -> CNT += 5 ;
1192
+ }
1193
+ else {
1194
+ TIM2 -> CNT = flash_values .preset_temp_2 ;
1195
+ }
1168
1196
}
1169
1197
}
1170
1198
0 commit comments