Skip to content

Climb power bar, hand-controller emulator, crisper fonts - #131

Open
PaulDWhite wants to merge 2 commits into
masterfrom
feat/climb-rate-power-ratio
Open

PaulDWhite wants to merge 2 commits into
masterfrom
feat/climb-rate-power-ratio

Conversation

@PaulDWhite

Copy link
Copy Markdown
Collaborator

Addresses #57 (climb rate to power ratio).

Climb power bar

A thin bar under the kW readout (0–16 kW) that shows where to sit on the throttle for an efficient climb. It has no number readout.

Mark Meaning
Pink tick + small brackets Level-flight power. The brackets shrink as the estimate firms up.
Green band Most efficient sustainable climb power (within 5% of the best climb per kW)
Yellow zone Holding this power would reach a warning temperature
Red zone Holding this power would reach a critical temperature
White / black tick Current power
  • Level power is learned live from the controller barometer and pack power: recency-weighted, slope-corrected level-equivalent power, with a calibrated uncertainty margin.
  • Climb band comes from the model w = s(P−L)(1−q(P−L)), so best climb power is P* = √(L² + L/q). Only the level power L is learned per flight; q is the curve shape from real flights.
  • Thermal zones project each part's temperature over the next 5 minutes (or until 15% SOC) at a given power.
    • Motor and ESC (MOSFET, capacitor, MCU) use a live first-order fit.
    • Battery cells, BMS MOSFET and BMS balance use a pack-size-scaled heating model. Pack size is learned from SOC drop vs energy used.
    • Limits use the existing monitor_config.h warning and critical thresholds.
  • Nothing is shown before takeoff or until the current flight has enough data.
  • Everything runs on the ESP32 from the current flight only. Real flight logs were used offline to tune the priors and check the estimates.

Hand-controller emulator (tools/hc_emulator)

  • The real LVGL main screen built natively (hc_emulator), plus the estimator and thermal model on their own (climb_eff_replay).
  • A browser dashboard (server.py) with a flight simulator and OpenPPG app CSV log replay, including full-length real flights.
  • analysis/ holds the offline scripts used to build ground truth from real logs and score the estimator against it.

See tools/hc_emulator/README.md.

Display fixes

  • Crisper text: Montserrat regenerated with strong autohinting (tools/fonts/gen_hinted_fonts.py), so small glyph stems (e.g. M, m) land on whole pixels. Built-in LVGL fonts are disabled; flash use is 34.8%.
  • Dark mode: yellow temperature tiles use black text, and the SOC bar uses the normal yellow instead of the darker tint.
  • Alert names: sensor names moved from simple_monitor.cpp to sensor_names.cpp (no string changes), so the emulator and screenshot tests show the controller's real alert labels (e.g. MC-FT-H).

Testing

  • New native tests: test_climb_efficiency, test_thermal_headroom.
  • Screenshot references regenerated for the fonts, the bar and the dark-mode fixes.
  • Firmware builds for OpenPPG-CESP32S3-CAN-SP140; cpplint is clean.
  • Still needed: an in-flight check on hardware.

Climb efficiency (#57): a thin power bar under the kW readout.
- Pink tick: level-flight power, learned live from barometer altitude
  and pack power (recency-weighted, slope-corrected). Small brackets
  around it shrink as the estimate firms up.
- Green band: most efficient sustainable climb power (within 5% of the
  best climb per kW), from w = s(P-L)(1-q(P-L)) fitted to the flight.
- Yellow / red: power that, if held, would reach a warning / critical
  temperature within 5 minutes (or before 15% SOC). Motor and ESC use a
  live first-order thermal fit; battery cells and BMS parts use a
  pack-size-scaled heating model. Limits use the existing monitor
  thresholds.
- Nothing is shown until the current flight has enough data.
- Everything runs on the ESP32 from this flight's data; fleet logs were
  used only offline to tune the priors.

Hand-controller emulator (tools/hc_emulator): the real LVGL main screen
built natively, driven from a browser dashboard with a flight simulator
and OpenPPG app CSV log replay. Includes the offline analysis scripts
used to score the estimator against real flights.

Display:
- Montserrat regenerated with strong autohinting (tools/fonts), so small
  glyph stems land on whole pixels. Built-in LVGL fonts disabled.
- Dark mode: black text on yellow temperature tiles; SOC bar uses the
  normal yellow.

Sensor names moved from simple_monitor.cpp to sensor_names.cpp so the
emulator and screenshot tests show the controller's real alert labels.
@PaulDWhite
PaulDWhite marked this pull request as ready for review September 26, 2026 20:35
PaulDWhite added a commit that referenced this pull request Oct 31, 2026
#131 disabled LVGL's built-in Montserrat fonts in favour of the hinted
set, so the QC screen from #118 no longer compiled.
Brings in LVGL 9.6.0 (#136), the patch bumps (#135) and the ESP-IDF
time shim (5b64992).

- Fonts: reorder the seven montserrat_hinted_* lv_font_t initializers
  (dsc/fallback/user_data first), as LVGL 9.6 moved those fields and C++
  needs declaration order. Same change master made to roboto_mono_16.c.
  tools/fonts/gen_hinted_fonts.py still emits the old order.
- main.cpp: the two new millis() calls use timeMillis(), like the rest
  of master.
- Screenshot references regenerated from the merged tree. 33 of 34 are
  byte-identical to this branch's; main_armed_cruising_dark changes by
  184 px from master's dark-mode cruise icon fix (#130).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants