I don't have a large enough screen on anything to make that worth while really. What I've done for my M5stack Basic is write some bespoke outputs that let me more easily create simple block screen layouts. The Basic is not touch screen, it just has 3 buttons.
So I have a common.h
with things like this in it:
#ifdef FONT_SIZE_22
//auto PRINT_FONT = id(print_font);
//#define ICON_FONT id(icon_font)
const int FONT_SIZE = 22;
const int HEADER_HT = FONT_SIZE+4; // Header height
const int FOOTER_HT = HEADER_HT; // Footer height
const int LINE_SIZE = FONT_SIZE+2; // fontsize + 2
const int LINE_1 = HEADER_HT+1; // header + 1
const int LINE_2 = LINE_1 + FONT_SIZE + 2; // Previous line + 2
const int LINE_3 = LINE_2 + FONT_SIZE + 2; // Previous line + 2
const int LINE_4 = LINE_3 + FONT_SIZE + 2; // Previous line + 2
const int LINE_5 = LINE_4 + FONT_SIZE + 2; // Previous line + 2
const int LINE_6 = LINE_5 + FONT_SIZE + 2; // Previous line + 2
const int TEXT_COL_LEFT = 1;
const int TEXT_BLOCK_CENTER = 10 * FONT_SIZE;
#endif
And then a number of "page" yaml files like this:
- id: page1
# Initial page. Header (Pg, status, time), Footer (buttons)
lambda: |-
static int num_executions = 0;
num_executions += 1;
/* @see lib\common.h for constant definitions such as lines and columns */
/* ---- Header ---- */
auto nowtime = id(sntp_time).now();
auto wifiStatus = WiFi.status();
it.filled_rectangle(0,0, it.get_width(), HEADER_HT, id(COLOR_CSS_DEEPSKYBLUE));
if (WiFi.status() == WL_CONNECTED) {
it.print(TEXT_BLOCK_1, HEADER_Y, id(icon_font), id(COLOR_CSS_BLACK), TextAlign::LEFT, "");
} else {
it.print(TEXT_BLOCK_1, HEADER_Y, id(icon_font), id(COLOR_CSS_RED), TextAlign::LEFT, "");
}
if (nowtime.is_valid()) {
it.strftime(it.get_width()-1, HEADER_Y, id(print_font), id(COLOR_CSS_BLACK), TextAlign::TOP_RIGHT, "%Y-%m-%d %H:%M", nowtime);
} else {
it.print(it.get_width()-1, HEADER_Y, id(print_font), id(COLOR_CSS_BLACK), TextAlign::TOP_RIGHT, "----/--/-- --:--");
}
/* ---- Footer ---- */
it.filled_rectangle(0,it.get_height()-FOOTER_HT, it.get_width(), FOOTER_HT, id(COLOR_CSS_LIGHTBLUE));
/* ---- Main ---- */
//it.printf(TEXT_BLOCK_1, LINE_1, id(print_font), id(COLOR_CSS_WHITE), TextAlign::LEFT, "%s", me.c_str());
// Here
double t_float = id(temperature).state;
double h_float = id(humidity).state;
it.print(TEXT_BLOCK_1, LINE_1, id(print_font), id(COLOR_CSS_WHITE), TextAlign::TOP_LEFT, "Here");
it.print(TEXT_BLOCK_1+6, LINE_2, id(icon_font), id(COLOR_CSS_WHITE), TextAlign::TOP_CENTER, "");
it.print(TEXT_BLOCK_1+6, LINE_3, id(icon_font), id(COLOR_CSS_WHITE), TextAlign::TOP_CENTER, "");
it.printf(TEXT_BLOCK_1+LINE_SIZE, LINE_2, id(print_font), t_float>22.0?id(COLOR_CSS_RED):id(COLOR_CSS_WHITE), TextAlign::LEFT, "%.1f°C", t_float);
it.printf(TEXT_BLOCK_1+LINE_SIZE, LINE_3, id(print_font), h_float>70?id(COLOR_CSS_RED):id(COLOR_CSS_WHITE), TextAlign::LEFT, "%.1f%%", h_float);
// Landing (D1M04)
t_float = strToFloat( id(landing_temperature).state );
h_float = strToFloat( id(landing_humidity).state );
it.print(TEXT_BLOCK_2, LINE_1, id(print_font), id(COLOR_CSS_WHITE), TextAlign::TOP_LEFT, "Landing");
it.print(TEXT_BLOCK_2+6, LINE_2, id(icon_font), id(COLOR_CSS_WHITE), TextAlign::TOP_CENTER, "");
it.print(TEXT_BLOCK_2+6, LINE_3, id(icon_font), id(COLOR_CSS_WHITE), TextAlign::TOP_CENTER, "");
if (t_float == 0.00) {
it.print(TEXT_BLOCK_2+LINE_SIZE, LINE_2, id(print_font), id(COLOR_CSS_LINEN), TextAlign::LEFT, "--.-°C");
} else {
it.printf(TEXT_BLOCK_2+LINE_SIZE, LINE_2, id(print_font), t_float>22.0?id(COLOR_CSS_RED):id(COLOR_CSS_WHITE), TextAlign::LEFT, "%.1f°C", t_float);
}
if (h_float == 0.00) {
it.print(TEXT_BLOCK_2+LINE_SIZE, LINE_3, id(print_font), id(COLOR_CSS_LINEN), TextAlign::LEFT, "--.-%");
} else {
it.printf(TEXT_BLOCK_2+LINE_SIZE, LINE_3, id(print_font), h_float>70?id(COLOR_CSS_RED):id(COLOR_CSS_WHITE), TextAlign::LEFT, "%.1f%%", h_float);
}
// Bathroom
t_float = strToFloat( id(bathroom_temperature).state );
h_float = strToFloat( id(bathroom_humidity).state );
it.print(TEXT_BLOCK_3, LINE_1, id(print_font), id(COLOR_CSS_WHITE), TextAlign::TOP_LEFT, "Bathroom");
it.print(TEXT_BLOCK_3+6, LINE_2, id(icon_font), id(COLOR_CSS_WHITE), TextAlign::TOP_CENTER, "");
it.print(TEXT_BLOCK_3+6, LINE_3, id(icon_font), id(COLOR_CSS_WHITE), TextAlign::TOP_CENTER, "");
if (t_float == 0.00) {
it.print(TEXT_BLOCK_3+LINE_SIZE, LINE_2, id(print_font), id(COLOR_CSS_LINEN), TextAlign::LEFT, "--.-°C");
} else {
it.printf(TEXT_BLOCK_3+LINE_SIZE, LINE_2, id(print_font), t_float>22.0?id(COLOR_CSS_RED):id(COLOR_CSS_WHITE), TextAlign::LEFT, "%.1f°C", t_float);
}
if (h_float == 0.00) {
it.print(TEXT_BLOCK_3+LINE_SIZE, LINE_3, id(print_font), id(COLOR_CSS_LINEN), TextAlign::LEFT, "--.-%");
} else {
it.printf(TEXT_BLOCK_3+LINE_SIZE, LINE_3, id(print_font), h_float>70?id(COLOR_CSS_RED):id(COLOR_CSS_WHITE), TextAlign::LEFT, "%.1f%%", h_float);
}
// Front Hall
t_float = strToFloat( id(front_hall_temperature).state );
//h_float = strToFloat( id(front_hall_humidity).state );
it.print(TEXT_BLOCK_1, LINE_4, id(print_font), id(COLOR_CSS_WHITE), TextAlign::TOP_LEFT, "F Hall");
it.print(TEXT_BLOCK_1+6, LINE_5, id(icon_font), id(COLOR_CSS_WHITE), TextAlign::TOP_CENTER, "");
it.print(TEXT_BLOCK_1+6, LINE_6, id(icon_font), id(COLOR_CSS_WHITE), TextAlign::TOP_CENTER, "");
if (t_float == 0.00) {
it.print(TEXT_BLOCK_1+LINE_SIZE, LINE_5, id(print_font), id(COLOR_CSS_LINEN), TextAlign::LEFT, "--.-°C");
} else {
it.printf(TEXT_BLOCK_1+LINE_SIZE, LINE_5, id(print_font), t_float>22.0?id(COLOR_CSS_RED):id(COLOR_CSS_WHITE), TextAlign::LEFT, "%.1f°C", t_float);
}
it.print(TEXT_BLOCK_1+LINE_SIZE, LINE_6, id(print_font), id(COLOR_CSS_LINEN), TextAlign::LEFT, "--.-%");
// Rear Hall
t_float = strToFloat( id(rear_hall_temperature).state );
h_float = strToFloat( id(rear_hall_humidity).state );
it.print(TEXT_BLOCK_2, LINE_4, id(print_font), id(COLOR_CSS_WHITE), TextAlign::TOP_LEFT, "R Hall");
it.print(TEXT_BLOCK_2+6, LINE_5, id(icon_font), id(COLOR_CSS_WHITE), TextAlign::TOP_CENTER, "");
it.print(TEXT_BLOCK_2+6, LINE_6, id(icon_font), id(COLOR_CSS_WHITE), TextAlign::TOP_CENTER, "");
if (t_float == 0.00) {
it.print(TEXT_BLOCK_2+LINE_SIZE, LINE_5, id(print_font), id(COLOR_CSS_LINEN), TextAlign::LEFT, "--.-°C");
} else {
it.printf(TEXT_BLOCK_2+LINE_SIZE, LINE_5, id(print_font), t_float>22.0?id(COLOR_CSS_RED):id(COLOR_CSS_WHITE), TextAlign::LEFT, "%.1f°C", t_float);
}
if (h_float == 0.00) {
it.print(TEXT_BLOCK_2+LINE_SIZE, LINE_6, id(print_font), id(COLOR_CSS_LINEN), TextAlign::LEFT, "--.-%");
} else {
it.printf(TEXT_BLOCK_2+LINE_SIZE, LINE_6, id(print_font), h_float>70?id(COLOR_CSS_RED):id(COLOR_CSS_WHITE), TextAlign::LEFT, "%.1f%%", h_float);
}
// Kitchen
t_float = strToFloat( id(kitchen_temperature).state );
//h_float = strToFloat( id(kitchen_humidity).state );
it.print(TEXT_BLOCK_3, LINE_4, id(print_font), id(COLOR_CSS_WHITE), TextAlign::TOP_LEFT, "Kitchen");
it.print(TEXT_BLOCK_3+6, LINE_5, id(icon_font), id(COLOR_CSS_WHITE), TextAlign::TOP_CENTER, "");
it.print(TEXT_BLOCK_3+6, LINE_6, id(icon_font), id(COLOR_CSS_WHITE), TextAlign::TOP_CENTER, "");
if (t_float == 0.00) {
it.print(TEXT_BLOCK_3+LINE_SIZE, LINE_5, id(print_font), id(COLOR_CSS_LINEN), TextAlign::LEFT, "--.-°C");
} else {
it.printf(TEXT_BLOCK_3+LINE_SIZE, LINE_5, id(print_font), t_float>22.0?id(COLOR_CSS_RED):id(COLOR_CSS_WHITE), TextAlign::LEFT, "%.1f°C", t_float);
}
it.print(TEXT_BLOCK_3+LINE_SIZE, LINE_6, id(print_font), id(COLOR_CSS_LINEN), TextAlign::LEFT, "--.-%");
So I can get things to line up pretty easily. Nothing like as nice as your touchscreen setup though of course.