Public Access
Red alert: keep the warning text clear of the frame and each other
The top pill now stops before the wider ALERT CONDITION RED title, the printer lines sit higher with room between them and the bottom pill, and the sweeping rectangles are clipped to the area above those lines. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
f46f7ab6c5
commit
8f0662e939
1 file changed
+12
-5
@@ -106,25 +106,32 @@ void lcars_status(EL512Display &it, const Fonts &f, const HomeData &d, ESPTime n
|
||||
if (!(alert ? blink : r % 7 == 0))
|
||||
block(it, f.pixel, 0, 104 + i * 26, 72, 22, serial(hash(i, 4)).c_str());
|
||||
}
|
||||
pill(it, 306, 0, 50, 18);
|
||||
const char *title = alert ? "ALERT CONDITION RED" : "SHIP STATUS";
|
||||
// The top pill stops short of the title, which is wider in red alert.
|
||||
const int pill_w = std::min(50, 508 - text_width(it, f.medium, title) - 8 - 306);
|
||||
if (pill_w >= 18)
|
||||
pill(it, 306, 0, pill_w, 18);
|
||||
pill(it, 306, 238, 70, 18);
|
||||
it.print(508, 22, f.medium, TextAlign::BASELINE_RIGHT, alert ? "ALERT CONDITION RED" : "SHIP STATUS");
|
||||
it.print(508, 22, f.medium, TextAlign::BASELINE_RIGHT, title);
|
||||
it.printf(508, 256, f.small, TextAlign::BASELINE_RIGHT, "STARDATE %.1f", stardate(now));
|
||||
|
||||
if (alert) {
|
||||
// Red alert: bars sweep outward from the centre around the warning.
|
||||
const int cx = 292, cy = 128;
|
||||
// The sweep stays between the frame, the title and the lines below it.
|
||||
const int cx = 296, cy = 98;
|
||||
const int phase = (int) (t % 900) * 120 / 900;
|
||||
it.start_clipping(84, 30, 508, 164);
|
||||
for (int k = 0; k < 3; k++) {
|
||||
const int s = (phase + k * 40) % 120;
|
||||
it.rectangle(cx - 70 - s, cy - 30 - s / 3, 140 + 2 * s, 60 + 2 * (s / 3));
|
||||
}
|
||||
it.end_clipping();
|
||||
if ((t % 1000) < 700) {
|
||||
it.filled_rectangle(cx - 110, cy - 34, 220, 68, COLOR_OFF);
|
||||
it.print(cx, cy + 4, f.large, TextAlign::CENTER, "RED ALERT");
|
||||
}
|
||||
it.print(cx, 196, f.medium, TextAlign::TOP_CENTER, d.printer == "error" ? "3D PRINTER ERROR" : "3D PRINTER PAUSED");
|
||||
it.print(cx, 222, f.small, TextAlign::TOP_CENTER, "REPORT TO THE FABRICATION BAY");
|
||||
it.print(cx, 170, f.medium, TextAlign::TOP_CENTER, d.printer == "error" ? "3D PRINTER ERROR" : "3D PRINTER PAUSED");
|
||||
it.print(cx, 204, f.small, TextAlign::TOP_CENTER, "REPORT TO THE FABRICATION BAY");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user