Improve GUI
This commit is contained in:
		
							
								
								
									
										7
									
								
								stm-firmware/include/reflow-controller/ui/gui-config.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								stm-firmware/include/reflow-controller/ui/gui-config.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,7 @@
 | 
			
		||||
#ifndef _GUI_CONFIG_H_
 | 
			
		||||
#define _GUI_CONFIG_H_
 | 
			
		||||
 | 
			
		||||
#define GUI_MONITORING_INTERVAL_MS 500U
 | 
			
		||||
#define GUI_TEMP_DRIVER_REFRESH_MS 750U
 | 
			
		||||
 | 
			
		||||
#endif /* _GUI_CONFIG_H_ */
 | 
			
		||||
@@ -19,6 +19,7 @@
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
#include <reflow-controller/ui/gui.h>
 | 
			
		||||
#include <reflow-controller/ui/gui-config.h>
 | 
			
		||||
#include <reflow-controller/ui/menu.h>
 | 
			
		||||
#include <reflow-controller/ui/lcd.h>
 | 
			
		||||
#include <reflow-controller/rotary-encoder.h>
 | 
			
		||||
@@ -70,7 +71,7 @@ static void gui_menu_monitor(struct lcd_menu *menu, enum menu_entry_func_entry e
 | 
			
		||||
		menu_display_clear(menu);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (systick_ticks_have_passed(my_timestamp, 250)) {
 | 
			
		||||
	if (systick_ticks_have_passed(my_timestamp, GUI_MONITORING_INTERVAL_MS)) {
 | 
			
		||||
		my_timestamp = systick_get_global_tick();
 | 
			
		||||
		adc_pt1000_get_current_resistance(&tmp);
 | 
			
		||||
		snprintf(line, sizeof(line), "Res: %.1f " LCD_OHM_SYMBOL_STRING, tmp);
 | 
			
		||||
@@ -304,12 +305,17 @@ static void gui_menu_constant_temperature_driver(struct lcd_menu *menu, enum men
 | 
			
		||||
	static void IN_SECTION(.ccm.bss) *my_parent;
 | 
			
		||||
	static int16_t IN_SECTION(.ccm.bss) temperature;
 | 
			
		||||
	static bool IN_SECTION(.ccm.bss) fine;
 | 
			
		||||
	static uint64_t IN_SECTION(.ccm.bss) last_temp_refresh;
 | 
			
		||||
	static float IN_SECTION(.ccm.bss) last_temp;
 | 
			
		||||
	enum button_state button;
 | 
			
		||||
	float current_temp;
 | 
			
		||||
	int status;
 | 
			
		||||
	int16_t rot;
 | 
			
		||||
	int16_t temp_old;
 | 
			
		||||
 | 
			
		||||
	if (entry_type == MENU_ENTRY_FIRST_ENTER) {
 | 
			
		||||
		my_parent = parent;
 | 
			
		||||
		last_temp = -2000.0f;
 | 
			
		||||
		temperature = 30;
 | 
			
		||||
		menu_display_clear(menu);
 | 
			
		||||
		menu_lcd_outputf(menu, 0, "Temp Controller");
 | 
			
		||||
@@ -350,7 +356,17 @@ static void gui_menu_constant_temperature_driver(struct lcd_menu *menu, enum men
 | 
			
		||||
	} else {
 | 
			
		||||
		if (temperature != temp_old) {
 | 
			
		||||
			oven_pid_set_target_temperature((float)temperature);
 | 
			
		||||
			menu_lcd_outputf(menu, 1, "Temp: %d " LCD_DEGREE_SYMBOL_STRING "C", (int)temperature);
 | 
			
		||||
			menu_lcd_outputf(menu, 1, "Target: %d " LCD_DEGREE_SYMBOL_STRING "C", (int)temperature);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if (entry_type == MENU_ENTRY_FIRST_ENTER || systick_ticks_have_passed(last_temp_refresh, GUI_TEMP_DRIVER_REFRESH_MS)) {
 | 
			
		||||
			(void)adc_pt1000_get_current_resistance(¤t_temp);
 | 
			
		||||
			status = temp_converter_convert_resistance_to_temp(current_temp, ¤t_temp);
 | 
			
		||||
			if (current_temp != last_temp) {
 | 
			
		||||
				last_temp = current_temp;
 | 
			
		||||
				menu_lcd_outputf(menu, 2, "Current: %s%.1f", current_temp, (status < 0 ? "<" : status > 0 ? ">" : ""));
 | 
			
		||||
			}
 | 
			
		||||
			last_temp_refresh = systick_get_global_tick();
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user