Skip to content

FW 0.6.1 manual-collective rules, app simulator/HUD fixes, PC tools at parity, CI - #33

Merged
andrea-cirillo merged 4 commits into
mainfrom
claude/nifty-ramanujan-ykc1ax
Nov 4, 2026
Merged

andrea-cirillo merged 4 commits into
mainfrom
claude/nifty-ramanujan-ykc1ax

Conversation

@andrea-cirillo

Copy link
Copy Markdown
Collaborator

Review of the HANDOVER_FW / HANDOVER_APP contract, the app simulator and the firmware, with the fixes.

App (4084a46)

  • Simulator in ANGLE/ACRO: the throttle is the collective, as in the firmware (thrust = (stick + 1) / 2, centre = hover). Lift-off happens with the throttle, ANGLE sticks command an angle, ACRO sticks a rate. Before, the throttle was always a climb rate, so the drone never left the ground without TAKEOFF.
  • Cockpit safety fix: entering ACRO/ANGLE in the air put the throttle stick at the bottom, which is collective 0 on the real firmware. It now goes to the centre (hover); on the ground it still goes to the bottom.
  • HUD: the aircraft symbol was 12 px left of the centre of the pitch ladder, the horizon and the roll pivot. All elements now share one centre, and the roll scale is concentric with the pointer.
  • The simulator now sends CHECKS item 10. The ARM throttle rule uses the age of the last RC frame.
  • client.test.ts failed in UTC: -0 and 0 differ for Object.is.

Firmware 0.6.1 (b41b801), HANDOVER_FW §6, §7.3, §7.5

  1. Stale RC on the ground in ACRO/ANGLE gives an idle collective. Before, a stick left up followed by slide-to-arm spun the motors up.

  2. HOLD stick-cancel measures the throttle from its position when HOLD began, not from the centre.

  3. After any touchdown the motors stay at idle until the disarm, or until the stick has been at the bottom. Before, an auto LAND with the stick at the centre lifted off again.

  4. No altitude estimate:

    • in air is detected from the collective;
    • HOLD holds the hover collective, open loop;
    • LAND descends open loop at 0.85 × hover for at most 20 s.

    Before, the 10 s no-take-off auto-disarm could stop the motors in flight, and LAND kept the last collective.

  5. The geofence also applies in ACRO/ANGLE: the climb rate is limited to √(2·2.5·d) below the ceiling.

  6. Stick centre = learned hover, so mode changes have no thrust jump.

  • Bugs fixed:
    • flash changes are committed only once written, so a failed save leaves RAM unchanged;
    • CAL_SAVE, CAL_RESTORE and SET_NAME no longer write unsaved parameter edits;
    • the ACK cache is reset per link: a BLE re-subscribe no longer makes USB retries execute again.
  • Design:
    • CHECKS are built once per 100 ms;
    • STREAM_RATES last one session;
    • prev_auto is reset in fc_init;
    • MOTORS_N is the single source for the motor count (4/6/8, checked at compile time).
  • The simulator follows the same rules. HANDOVER_FW.md is updated, including its outdated USB and wall-clock notes, along with flight-core.md.

PC tools (435c3bf)

  • Python and MATLAB: since fw 0.6.0 the USB port also streams telemetry. Both download clients extended their wait on any frame, so a lost ACK made them hang. Now only log frames extend the wait. A regression test hangs on the old code.
  • MATLAB: acwingLogDownload is at parity with Python:
    • the last flight over BLE;
    • erase, with a typed confirmation;
    • setDTR(true) in the download, the viewer and the capture tools.
  • 00 - Matlab/tests/testFlightLog.m runs in MATLAB or Octave. The decoder gives the same numbers as Python on the firmware test vector.

CI (b41b801, 435c3bf, b74bfde)

  • New .github/workflows/ci.yml with four jobs:
    • firmware host tests (ASan/UBSan);
    • app (typecheck, tests, build);
    • Python pytest;
    • MATLAB tests in Octave.
  • add-to-project.yml retries transient Projects API errors: two runs failed when seven issues were opened together.

Tests

  • Firmware host tests: 366 + ext 12 + power 98 + log 63 + link 38 + iekf 32, all passing.
  • App: 42 tests, typecheck and build clean.
  • Python: 34. Octave: 17.
  • The CAL_SAVE rollback, unsaved-parameter and download-timeout tests fail on the old code.

Not verified here: manual checks


Generated by Claude Code

…fe throttle on mode change

Simulator (src/sim/simDrone.ts)
- ACRO/ANGLE fly the collective as the firmware does: thrust = (stick + 1) / 2,
  centre = hover, lift-off when thrust beats gravity, ANGLE stick = angle up to
  maxTilt, ACRO stick = rate (4 x maxYawRate, as fc_core.c), no self-levelling,
  touchdown with the stick at the bottom. Before, the throttle was always a
  climb rate and the drone never left the ground without TAKEOFF, and entering
  ANGLE/ACRO in the air made it sink.
- Stale RC (> 0.25 s): neutral attitude; on the ground the collective drops to
  idle, so a stale stick never lifts the drone off.
- ARM throttle rule and the new CHECKS item 10 use the age of the last RC frame
  (heartbeats do not count), as fc_core.c / checks.c.

Cockpit
- Entering ACRO/ANGLE in the air puts the throttle stick at the centre (hover)
  instead of the bottom, which would cut the collective to 0.

HUD
- The aircraft symbol was 12 px left of the centre of the pitch ladder, horizon
  gap and roll pivot (apex at x=248 instead of 260). All elements now share one
  centre; ladder labels symmetric; roll scale concentric with the pointer.

Tests
- src/sim/simDrone.test.ts: ANGLE lift-off/hover/forward/land/disarm, ACRO rate
  hold, no lift-off on stale RC after slide-to-arm.
- client.test.ts: tzMin comparison failed in UTC (-0 vs 0 with Object.is).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Td5hUZvPAagAsenMgqYCYn
…sim and contract; CI

Flight core (fc_core.c), HANDOVER_FW §6, §7.3, §7.5
1. Stale RC on the ground in ACRO/ANGLE: idle collective (was the last stick,
   so slide-to-arm after leaving the cockpit with the throttle up spun up).
2. HOLD stick-cancel: throttle measured from its position when HOLD began
   (in ACRO/ANGLE it is the collective, an absolute test cancelled at once).
3. After any touchdown: idle until disarm or until the stick has been at the
   bottom (an auto LAND with the stick at centre re-lifted at ~hover).
4. No altitude estimate: in air from the collective (> 0.8 x hover, 0.3 s),
   touchdown with the stick at the bottom; HOLD = open-loop hover; LAND/RTH =
   open-loop descent (0.85 x hover, at most 20 s). Before, the drone flown by
   hand stayed "on the ground": no in-air failsafe, 10 s auto-disarm in flight,
   and LAND kept the last collective.
5. Geofence also in ACRO/ANGLE: climb rate limited to sqrt(2 a d) below the
   ceiling (a = 2.5 m/s^2), EVENT 23 once.
6. Stick centre = learned hover (steady flight, 3 s); the altitude loop starts
   from the learned hover when it takes over: no thrust jump at mode changes.

AppTask
- Flash changes are made on a copy and committed only when written: a failed
  CAL_SAVE / CAL_RESTORE / PARAM_SAVE / SET_NAME leaves RAM unchanged.
- Only PARAM_SAVE writes the parameters; CAL_SAVE, CAL_RESTORE, SET_NAME and
  the battery record keep the last saved ones (unsaved edits stay dirty).
- ACK cache: a new session clears only its own link (ackc_reset_ops), so a
  BLE re-subscribe no longer makes USB retries re-execute, and a new USB
  session no longer answers fresh commands from the old cache.
- CHECKS built once per 100 ms, shared by ground info, stream and REQUEST.
- STREAM_RATES last one session (defaults at every subscribe / USB open).
- prev_auto and the stick state reset in fc_init; MOTORS_N single source for
  the core, CAPS and the PWM driver (4, 6 or 8, checked at compile time).

Tests: test_manual_collective, test_no_alt_estimate, CAL_SAVE rollback and
unsaved-parameter checks (fail on the old code), per-link ACK cache, rates.

App simulator: HOLD cancel and idle-after-touchdown as the firmware, stick
mapping centre = hover, CAPS fw 0.6.1; tests in simDrone.test.ts.
Docs: HANDOVER_FW (new rules, outdated USB / wall-clock notes fixed),
HANDOVER_APP header, 03 - Docs/firmware/flight-core.md.
CI: .github/workflows/ci.yml runs the firmware host tests (ASan/UBSan), the
app (typecheck, tests, build) and the Python tools, in UTC.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Td5hUZvPAagAsenMgqYCYn
…rity with Python

Since firmware 0.6.0 the FC USB port is a ground link that streams telemetry
(FLIGHT, STATE, STATUS...). Both download clients extended their wait on any
frame, so a lost ACK made them wait for ever.

Python (flightlog.py)
- FcLink._run: the wait is extended only by LOG_ENTRY / LOG_DATA frames.
- test_link_timeout_with_telemetry (ChattyFC): hangs on the old code.

MATLAB
- acwingLogDownload rewritten on a transport (USB serial, BLE, or a struct
  with write/read for tests): BLE last flight ('ble' / 'ble:NAME', raw
  commands, 32 KB chunks, STATE at 1 Hz during the download), erase over USB
  with a typed confirmation, only log frames kept and extending the wait,
  refusal reasons in words, LOG_DATA checked against the log id and size.
- setDTR(true) on the FC serial port in the download, the live viewer,
  tlmCapture and tlmSniffer: the drone opens its USB link on DTR.
- tests/testFlightLog.m (MATLAB or Octave): decoder on the firmware test
  vector (same numbers as Python), damaged record / header, USB list-read-
  erase, ARMED refusal, BLE last flight, telemetry + lost ACK -> timeout.

CI: an Octave job runs the MATLAB tests. Docs: logging.md, pc-tools.md,
repository.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Td5hUZvPAagAsenMgqYCYn
Seven issues opened within 30 s started seven runs at once: five added
their item, two failed with GraphQL errors from GitHub ("Something went
wrong while executing your query", "Unknown error: {}"). Same token and
project as the runs that succeeded: not a permission problem. Adding an
item is idempotent, so a failed attempt is retried twice after a pause.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Td5hUZvPAagAsenMgqYCYn
@github-project-automation github-project-automation Bot moved this to Backlog in @ACwing Nov 4, 2026
@andrea-cirillo
andrea-cirillo merged commit fd7988b into main Nov 4, 2026
7 checks passed
@github-project-automation github-project-automation Bot moved this from Backlog to Done in @ACwing Nov 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants