Skip to main content
NewEpisode 3a is out: Carry the conversation onWatch →

This part is for members

Membership opens soon. Leave your email and we'll tell you the day it does. Founding members get the launch price.

Keep watching the free parts
Skeleton · 8d

Two state machines 4: one run through both machines

Episodes 8a, 8b and 8c tied together and taken slowly. The two state machines never call each other; they meet only in three values: ① motor_enable (may the motor drive?), ② the control layer's mode motor_ctl_sm_config.mode (which loops run), ③ the position command pos_cmd_p (where the rotor should be this tick), plus gate 4, hw_ready_state. As a stage: the lights, the set, the next line, the curtain. Every position tick PosSpeedLoopCtrl runs four steps in a fixed order: the app's AppRun writes, the control layer's PosSpeedCtlLoopTask reads, the PWM is switched or calibrated, and gate 4 is written last, so both machines read the gate from the tick before. One real run (mode 3, then 1, two turns) in seven stops: the mode write at 1000.00 (set_app_Modes_of_operation → set_app → PpModeInit writes 0 to ①), the 1, tick 1000.05 line by line through both machines (the edge, ModeCheckInInit sets ③ to 39227, ModeRun skipped), 102 ms behind the curtain (1026 calls of PpModeStart), curtain up at 1102.55 (PP's own edge restarts the planner, which writes ③; in the same tick ModeRun → PositionStep reads it), and the move to 301372. Then all nine traps of 8a–8c, each one change to this same run, grouped by the value that went wrong. New measurements: with mode 4, or set_app alone, PP's planner still writes the whole move into ③ (301342 at 1400 ms) while the rotor stands still; in seven of the nine runs an app shows RUNNING while the motor is off. One table, and four questions for a motor that won't move. Your turn: 1 before the mode, then 1 again at 1010 ms.

Up next8e · Skeleton recap: from power-up to moving, on one page→