add more information to flipper zero
This commit is contained in:
@@ -331,23 +331,38 @@ class PageManager:
|
|||||||
lines = []
|
lines = []
|
||||||
|
|
||||||
if state:
|
if state:
|
||||||
# Get all values - returns dict of PID -> PIDValue
|
|
||||||
all_values = state.get_all()
|
all_values = state.get_all()
|
||||||
_logger.debug(f"Live data: got {len(all_values)} PIDs from state")
|
_logger.debug(f"Live data: got {len(all_values)} PIDs from state")
|
||||||
|
|
||||||
if all_values:
|
if all_values:
|
||||||
# Priority order for display
|
# Format functions for different value types
|
||||||
priority_pids = [0x0C, 0x0D, 0x05, 0x11, 0x2F, 0x5C, 0x04, 0x0F, 0x10]
|
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()
|
shown_pids = set()
|
||||||
for pid_code in priority_pids:
|
for pid_code, label, formatter in display_order:
|
||||||
if pid_code in all_values:
|
if pid_code in all_values:
|
||||||
val = all_values[pid_code]
|
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)
|
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()):
|
for pid_code, val in sorted(all_values.items()):
|
||||||
if pid_code not in shown_pids:
|
if pid_code not in shown_pids:
|
||||||
lines.append(f"{val.name}: {val.value:.1f} {val.unit}")
|
lines.append(f"{val.name}: {val.value:.1f} {val.unit}")
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ class PIDRegistry:
|
|||||||
self.register(
|
self.register(
|
||||||
PID(
|
PID(
|
||||||
code=0x04,
|
code=0x04,
|
||||||
name="ENGINE_LOAD",
|
name="Engine load",
|
||||||
description="Calculated engine load",
|
description="Calculated engine load",
|
||||||
unit="%",
|
unit="%",
|
||||||
min_value=0,
|
min_value=0,
|
||||||
@@ -134,7 +134,7 @@ class PIDRegistry:
|
|||||||
self.register(
|
self.register(
|
||||||
PID(
|
PID(
|
||||||
code=0x10,
|
code=0x10,
|
||||||
name="MAF_RATE",
|
name="MAF rate",
|
||||||
description="Mass air flow rate",
|
description="Mass air flow rate",
|
||||||
unit="g/s",
|
unit="g/s",
|
||||||
min_value=0,
|
min_value=0,
|
||||||
@@ -204,7 +204,7 @@ class PIDRegistry:
|
|||||||
self.register(
|
self.register(
|
||||||
PID(
|
PID(
|
||||||
code=0x5C,
|
code=0x5C,
|
||||||
name="OIL_TEMP",
|
name="Oil temperature",
|
||||||
description="Engine oil temperature",
|
description="Engine oil temperature",
|
||||||
unit="°C",
|
unit="°C",
|
||||||
min_value=-40,
|
min_value=-40,
|
||||||
|
|||||||
Reference in New Issue
Block a user