40{
41 struct tm local_time;
42 int64_t now_epoch = 0;
43 char time_line[16];
44 char status_line[20];
45 char alarm_indicator[10];
47 static uint32_t alarm_blink_counter = 0;
48
49 (void)now_epoch;
50
53
55 u8g2_SetFont(
s_u8g2, u8g2_font_6x10_tf);
56 u8g2_DrawStr(
s_u8g2, 20, 10,
"ALARM ACTIVE!");
57
58
59 if ((alarm_blink_counter / 2) % 2 == 0) {
60 if (time_valid) {
61 snprintf(time_line, sizeof(time_line), "%02d:%02d:%02d",
62 local_time.tm_hour, local_time.tm_min, local_time.tm_sec);
63 u8g2_SetFont(
s_u8g2, u8g2_font_logisoso20_tn);
64 u8g2_DrawStr(
s_u8g2, 0, 38, time_line);
65 }
66 }
67
68 alarm_blink_counter++;
70 return;
71 }
72
73 alarm_blink_counter = 0;
74
75
76
78 snprintf(status_line, sizeof(status_line), "Setup AP");
80 snprintf(status_line,
sizeof(status_line),
"%s", snapshot->
runtime.
sta_ip);
81 } else {
82 snprintf(status_line, sizeof(status_line), "No WiFi");
83 }
84
85 alarm_indicator[0] = '\0';
86 {
87 int first_h = -1, first_m = -1;
88 int enabled_count = 0;
89 uint8_t i;
90
93 if (first_h < 0) {
96 }
97 enabled_count++;
98 }
99 }
100
101 if (enabled_count == 1) {
102 snprintf(alarm_indicator, sizeof(alarm_indicator), "%02d:%02d", first_h, first_m);
103 } else if (enabled_count > 1) {
104
105 snprintf(alarm_indicator, sizeof(alarm_indicator), "%02d:%02d+", first_h, first_m);
106 }
107 }
108
109 u8g2_SetFont(
s_u8g2, u8g2_font_6x10_tf);
110 u8g2_DrawStr(
s_u8g2, 0, 10, status_line);
111 if (alarm_indicator[0] != '\0') {
112 u8g2_uint_t aw = u8g2_GetStrWidth(
s_u8g2, alarm_indicator);
113 u8g2_DrawStr(
s_u8g2, (u8g2_uint_t)(128u - aw), 10, alarm_indicator);
114 }
115
116
117 u8g2_DrawHLine(
s_u8g2, 0, 14, 128);
118
119
120
121 if (time_valid) {
122 snprintf(time_line, sizeof(time_line), "%02d:%02d:%02d",
123 local_time.tm_hour, local_time.tm_min, local_time.tm_sec);
124 u8g2_SetFont(
s_u8g2, u8g2_font_logisoso24_tn);
125 u8g2_DrawStr(
s_u8g2, 10, 48, time_line);
126 } else {
127 snprintf(time_line, sizeof(time_line), "TIME NOT SET");
128 u8g2_SetFont(
s_u8g2, u8g2_font_6x10_tf);
129 u8g2_DrawStr(
s_u8g2, 28, 30, time_line);
130 }
131
133}
#define APP_ALARM_MAX_COUNT
Maximum number of configurable alarms.
alarm_entry_t alarms[APP_ALARM_MAX_COUNT]
char sta_ip[APP_IP_ADDRESS_MAX_LEN]
bool time_service_get_local_time(struct tm *out_tm, int64_t *out_epoch)
Get local time adjusted by the configured timezone offset.