Explorar el Código

Display temperature

k4be hace 1 año
padre
commit
aa6bf4f43e
Se han modificado 3 ficheros con 11 adiciones y 0 borrados
  1. 9 0
      soft/display.c
  2. 1 0
      soft/display.h
  3. 1 0
      soft/working_modes.c

+ 9 - 0
soft/display.c

@@ -211,6 +211,14 @@ void disp_time(__attribute__ ((unused)) unsigned char changed) {
 	xsprintf(disp.line2, PSTR("%d:%02d:%02d"), ct->tm_hour, ct->tm_min, ct->tm_sec);
 }
 
+void disp_func_temperature(__attribute__ ((unused)) unsigned char changed) {
+	strcpy_P(disp.line1, PSTR("Temperatura"));
+	if (System.temperature_ok) {
+		xsprintf(disp.line2, PSTR("%.1f stC"), System.temperature);
+	} else {
+		strcpy_P(disp.line2, PSTR("Blad!"));
+	}
+}
 void disp_func_main_menu(__attribute__ ((unused)) unsigned char changed) {
 	display_main_menu_item();
 }
@@ -235,6 +243,7 @@ void (*__flash const disp_funcs[])(unsigned char) = {
 	[DISPLAY_STATE_TIME] = disp_time,
 	[DISPLAY_STATE_MAIN_MENU] = disp_func_main_menu,
 	[DISPLAY_STATE_SETTINGS_MENU] = disp_func_settings_menu,
+	[DISPLAY_STATE_TEMPERATURE] = disp_func_temperature,
 };
 
 void display_refresh(unsigned char newstate) {

+ 1 - 0
soft/display.h

@@ -16,6 +16,7 @@
 #define DISPLAY_STATE_TIME	13
 #define DISPLAY_STATE_MAIN_MENU	14
 #define DISPLAY_STATE_SETTINGS_MENU	15
+#define DISPLAY_STATE_TEMPERATURE 16
 
 struct disp_s {
 	char line1[16];

+ 1 - 0
soft/working_modes.c

@@ -16,6 +16,7 @@ __flash const unsigned char main_display_modes[] = {
 	DISPLAY_STATE_DIST_TIME,
 	DISPLAY_STATE_SPEED,
 	DISPLAY_STATE_TIME,
+	DISPLAY_STATE_TEMPERATURE,
 };
 
 const char *enter_settings_get_name(void) {