Improve spacing between nail panels
- Expanded panel width from 20 to 29 characters per nail - Better formatted text with more descriptive labels - Full 'Nail 1' and 'Nail 2' names instead of abbreviations - More readable temperature and error displays - Improved overall visual separation and readability - Deployed and verified on Pi
This commit is contained in:
@@ -156,50 +156,49 @@ class StatusDisplay:
|
||||
lines = []
|
||||
|
||||
# Header
|
||||
nail_name = "N1" if nail_id == "nail1" else "N2"
|
||||
nail_name = "Nail 1" if nail_id == "nail1" else "Nail 2"
|
||||
enabled = status.get("enabled", False)
|
||||
has_error = status.get("error", False)
|
||||
icon = self.format_status_icon(enabled, has_error)
|
||||
|
||||
lines.append("{}{}{}{}".format(
|
||||
status_text = "ONLINE" if enabled else "OFFLINE"
|
||||
lines.append("{}{} {} {}{}".format(
|
||||
Colors.BOLD, nail_name, icon,
|
||||
"ON" if enabled else "OFF"
|
||||
) + Colors.RESET)
|
||||
status_text,
|
||||
Colors.RESET
|
||||
))
|
||||
|
||||
# Temperature display
|
||||
current = float(status.get("current_temp", 0))
|
||||
setpoint = float(status.get("setpoint", 0))
|
||||
lines.append("T:{} S:{}".format(
|
||||
"{:5.0f}F".format(current) if current else "ERR",
|
||||
"{:5.0f}F".format(setpoint)
|
||||
))
|
||||
temp_str = "{:6.1f}F".format(current) if current else "ERROR"
|
||||
setpt_str = "{:6.1f}F".format(setpoint)
|
||||
lines.append("Temp: {} / {}".format(temp_str, setpt_str))
|
||||
|
||||
# Error display
|
||||
error = float(status.get("error", 0))
|
||||
error_color = Colors.RED if abs(error) > 20 else Colors.YELLOW if abs(error) > 5 else Colors.GREEN
|
||||
lines.append("{}E:{:+6.1f}{}".format(error_color, error, Colors.RESET))
|
||||
lines.append("{}Error: {:+7.1f}F{}".format(error_color, error, Colors.RESET))
|
||||
|
||||
# PID Output bar
|
||||
output = float(status.get("output", 0))
|
||||
output_pct = min(100.0, max(0.0, output * 100))
|
||||
bar_filled = int(output_pct / 10)
|
||||
bar = "{}|{}{}|{}".format(
|
||||
bar = "{}[{}{}]{}".format(
|
||||
Colors.BRIGHT_GREEN,
|
||||
"=" * bar_filled,
|
||||
" " * (10 - bar_filled),
|
||||
Colors.RESET
|
||||
)
|
||||
lines.append("Out: {} {:3.0f}%".format(bar, output_pct))
|
||||
lines.append("Output: {} {:5.1f}%".format(bar, output_pct))
|
||||
|
||||
# Flight mode and phase
|
||||
mode = status.get("flight_mode", "grounded")
|
||||
phase = status.get("phase", "idle")
|
||||
mode_short = mode[:4].upper()
|
||||
phase_short = phase[:4].upper()
|
||||
lines.append("{}M:{} P:{}{}".format(
|
||||
lines.append("{}Mode: {:<10} Phase: {}{}".format(
|
||||
Colors.CYAN,
|
||||
mode_short,
|
||||
phase_short,
|
||||
mode[:10],
|
||||
phase[:8],
|
||||
Colors.RESET
|
||||
))
|
||||
|
||||
@@ -209,7 +208,7 @@ class StatusDisplay:
|
||||
tc_ok = safety.get("tc_ok", True)
|
||||
watchdog_ok = safety.get("watchdog_ok", True)
|
||||
|
||||
safety_status = "{}S:OK{}".format(Colors.GREEN, Colors.RESET) if (temp_ok and tc_ok and watchdog_ok) else "{}S:WARN{}".format(Colors.RED, Colors.RESET)
|
||||
safety_status = "{}Safety: OK{}".format(Colors.GREEN, Colors.RESET) if (temp_ok and tc_ok and watchdog_ok) else "{}Safety: WARN{}".format(Colors.RED, Colors.RESET)
|
||||
lines.append(safety_status)
|
||||
|
||||
return lines
|
||||
@@ -270,18 +269,18 @@ class StatusDisplay:
|
||||
while len(nail2_lines) < max_lines:
|
||||
nail2_lines.append("")
|
||||
|
||||
# Draw side-by-side panels
|
||||
lines.append("{}┌─ NAIL 1 ────────────┬─ NAIL 2 ────────────┐{}".format(
|
||||
# Draw side-by-side panels with better spacing
|
||||
lines.append("{}┌─ NAIL 1 ─────────────────────┬─ NAIL 2 ─────────────────────┐{}".format(
|
||||
Colors.CYAN, Colors.RESET))
|
||||
|
||||
for n1_line, n2_line in zip(nail1_lines, nail2_lines):
|
||||
# Left pad lines to 20 chars, right pad n2 lines
|
||||
left = "│ {:<18} ".format(n1_line[:18])
|
||||
right = "│ {:<18} │".format(n2_line[:18])
|
||||
# Pad lines to 29 chars with good spacing
|
||||
left = "│ {:<27} ".format(n1_line[:27])
|
||||
right = "│ {:<27} │".format(n2_line[:27])
|
||||
lines.append("{}{}{}".format(left, right, Colors.RESET))
|
||||
|
||||
# Footer
|
||||
lines.append("{}└────────────────────┴────────────────────┘{}".format(
|
||||
lines.append("{}└───────────────────────────────┴───────────────────────────────┘{}".format(
|
||||
Colors.CYAN, Colors.RESET))
|
||||
|
||||
return "\n".join(lines)
|
||||
|
||||
Reference in New Issue
Block a user