Add calendar styling and WiFi indicator
This commit is contained in:
+45
-10
@@ -15,7 +15,7 @@ esphome:
|
||||
priority: -10
|
||||
then:
|
||||
- delay: 10s
|
||||
- display.page.show: environment # temporary for power page dev
|
||||
- display.page.show: calendar # temporary for power page dev
|
||||
- component.update: epaper
|
||||
|
||||
esp32:
|
||||
@@ -46,6 +46,9 @@ api:
|
||||
encryption:
|
||||
key: !secret apikey
|
||||
|
||||
# Include ArduinoJson support for the compact calendar event feed.
|
||||
json:
|
||||
|
||||
ota:
|
||||
platform: esphome
|
||||
password: !secret ota
|
||||
@@ -248,6 +251,12 @@ font:
|
||||
id: roboto_med_30
|
||||
size: 30
|
||||
|
||||
# Small, digits-only font used to emphasize the current date in the month grid.
|
||||
- file: "fonts/Roboto-Bold.ttf"
|
||||
id: calendar_day_bold
|
||||
size: 15
|
||||
glyphs: ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]
|
||||
|
||||
- file: "fonts/Roboto-Regular.ttf"
|
||||
id: footer_font
|
||||
size: 15
|
||||
@@ -1136,7 +1145,7 @@ display:
|
||||
|
||||
/* LEFT PANE: agenda */
|
||||
it.image(10, 10, id(c1024_logo));
|
||||
it.print(100, 27, id(roboto_med_30), TextAlign::BASELINE_LEFT, "TERMINE");
|
||||
it.print(226, 38, id(roboto_med_30), TextAlign::BASELINE_CENTER, "TERMINE");
|
||||
it.line(10, 55, 355, 55);
|
||||
it.line(365, 10, 365, 352);
|
||||
|
||||
@@ -1201,7 +1210,6 @@ display:
|
||||
char month_title[24];
|
||||
snprintf(month_title, sizeof(month_title), "%s %d", months[month - 1], year);
|
||||
it.printf(502, 18, id(sensor_unit), TextAlign::TOP_CENTER, "%s", month_title);
|
||||
it.line(375, 28, 630, 28);
|
||||
it.print(384, 47, id(footer_font), TextAlign::TOP_CENTER, "KW");
|
||||
for (int column = 0; column < 7; column++) {
|
||||
it.printf(415 + column * 30, 47, id(footer_font), TextAlign::TOP_CENTER, "%s", weekdays[column]);
|
||||
@@ -1237,8 +1245,8 @@ display:
|
||||
if (day < 1 || day > month_days) continue;
|
||||
const int cell_x = 415 + column * 30;
|
||||
if (day == today) {
|
||||
it.filled_rectangle(cell_x - 12, cell_y - 2, 25, 18, Color::BLACK);
|
||||
it.printf(cell_x, cell_y, id(footer_font), Color::WHITE, TextAlign::TOP_CENTER, "%d", day);
|
||||
it.filled_rectangle(cell_x - 12, cell_y - 2, 25, 18, COLOR_ON);
|
||||
it.printf(cell_x, cell_y, id(calendar_day_bold), COLOR_OFF, TextAlign::TOP_CENTER, "%d", day);
|
||||
} else {
|
||||
it.printf(cell_x, cell_y, id(footer_font), TextAlign::TOP_CENTER, "%d", day);
|
||||
}
|
||||
@@ -1246,12 +1254,39 @@ display:
|
||||
}
|
||||
|
||||
/* RIGHT BOTTOM: quote placeholder, intentionally inverted */
|
||||
it.filled_rectangle(375, 220, 255, 130, Color::BLACK);
|
||||
it.print(502, 234, id(footer_font), Color::WHITE, TextAlign::TOP_CENTER, "DEMOTIVATION");
|
||||
it.print(502, 267, id(sensor_unit), Color::WHITE, TextAlign::TOP_CENTER, "Es ist nie zu spät,");
|
||||
it.print(502, 291, id(sensor_unit), Color::WHITE, TextAlign::TOP_CENTER, "die Erwartungen zu senken.");
|
||||
it.print(502, 326, id(footer_font), Color::WHITE, TextAlign::TOP_CENTER, "Zitatquelle folgt");
|
||||
it.filled_rectangle(375, 220, 255, 130, COLOR_ON);
|
||||
it.print(502, 246, id(sensor_unit), COLOR_OFF, TextAlign::TOP_CENTER, "Es ist nie zu spät,");
|
||||
it.print(502, 271, id(sensor_unit), COLOR_OFF, TextAlign::TOP_CENTER, "die Erwartungen zu");
|
||||
it.print(502, 296, id(sensor_unit), COLOR_OFF, TextAlign::TOP_CENTER, "senken.");
|
||||
it.print(502, 326, id(footer_font), COLOR_OFF, TextAlign::TOP_CENTER, "Zitatquelle folgt");
|
||||
|
||||
/* FOOTER */
|
||||
it.strftime(614, 380, id(footer_font), TextAlign::BASELINE_RIGHT,
|
||||
"Aktualisiert um %d.%m.%Y %H:%M", now);
|
||||
|
||||
/* WiFi Signal Strenght */
|
||||
if(id(wifisignal).has_state()) {
|
||||
int x = 630;
|
||||
int y = 384;
|
||||
if (id(wifisignal).state >= -50) {
|
||||
// Excellent
|
||||
it.print(x, y, id(mdi_wifi), TextAlign::BASELINE_CENTER, "");
|
||||
ESP_LOGI("WiFi", "Excellent");
|
||||
} else if (id(wifisignal).state >= -60) {
|
||||
// Good
|
||||
it.print(x, y, id(mdi_wifi), TextAlign::BASELINE_CENTER, "");
|
||||
ESP_LOGI("WiFi", "Good");
|
||||
} else if (id(wifisignal).state >= -75) {
|
||||
// Fair
|
||||
it.print(x, y, id(mdi_wifi), TextAlign::BASELINE_CENTER, "");
|
||||
ESP_LOGI("WiFi", "Fair");
|
||||
} else if (id(wifisignal).state >= -100) {
|
||||
// Weak
|
||||
it.print(x, y, id(mdi_wifi), TextAlign::BASELINE_CENTER, "");
|
||||
ESP_LOGI("WiFi", "Weak");
|
||||
} else {
|
||||
// Unlikely working signal
|
||||
it.print(x, y, id(mdi_wifi), TextAlign::BASELINE_CENTER, "");
|
||||
ESP_LOGI("WiFi", "Unlikely");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user