add more information to flipper zero
This commit is contained in:
@@ -331,23 +331,38 @@ class PageManager:
|
||||
lines = []
|
||||
|
||||
if state:
|
||||
# Get all values - returns dict of PID -> PIDValue
|
||||
all_values = state.get_all()
|
||||
_logger.debug(f"Live data: got {len(all_values)} PIDs from state")
|
||||
|
||||
if all_values:
|
||||
# Priority order for display
|
||||
priority_pids = [0x0C, 0x0D, 0x05, 0x11, 0x2F, 0x5C, 0x04, 0x0F, 0x10]
|
||||
# Format functions for different value types
|
||||
def fmt_int(val):
|
||||
return f"{val.value:.0f} {val.unit}"
|
||||
|
||||
def fmt_float(val):
|
||||
return f"{val.value:.1f} {val.unit}"
|
||||
|
||||
# Display order with custom formatting
|
||||
display_order = [
|
||||
(0x0C, "RPM", fmt_int), # Engine RPM
|
||||
(0x0D, "Speed", fmt_int), # Vehicle speed
|
||||
(0x05, "Coolant", fmt_int), # Coolant temp
|
||||
(0x5C, "Oil temp", fmt_int), # Oil temp
|
||||
(0x0F, "Intake temp", fmt_int), # Intake temp
|
||||
(0x11, "Throttle", fmt_float), # Throttle pos
|
||||
(0x04, "Engine load", fmt_float), # Engine load
|
||||
(0x2F, "Fuel level", fmt_float), # Fuel level
|
||||
(0x10, "MAF", fmt_float), # MAF rate
|
||||
]
|
||||
|
||||
# Add priority PIDs first
|
||||
shown_pids = set()
|
||||
for pid_code in priority_pids:
|
||||
for pid_code, label, formatter in display_order:
|
||||
if pid_code in all_values:
|
||||
val = all_values[pid_code]
|
||||
lines.append(f"{val.name}: {val.value:.1f} {val.unit}")
|
||||
lines.append(f"{label}: {formatter(val)}")
|
||||
shown_pids.add(pid_code)
|
||||
|
||||
# Add any remaining PIDs
|
||||
# Add any other PIDs not in the display order
|
||||
for pid_code, val in sorted(all_values.items()):
|
||||
if pid_code not in shown_pids:
|
||||
lines.append(f"{val.name}: {val.value:.1f} {val.unit}")
|
||||
|
||||
Reference in New Issue
Block a user