State Machine
The system always operates within one of the defined states, also known as modes, represented internally as numerical values. The state machine implements priority-based ordering - lower numbers indicate higher priority. This ensures deterministic behavior in all situations (e.g., simultaneous accelerator and brake activation).
LYNX Mode Descriptions
Modes represent the operational states of the LYNX application, determined by the state machine. These modes aid in debugging by indicating the controller's current status.
The mode value is accessible via the /mode
variable in the root directory and is broadcast periodically over CAN in the 0x600 - LYNX status message.
Mode Name | Mode Value | Description |
---|---|---|
MODE_STOP | 0 | Driver or common block error detected Verify /driver/error and /common/error |
MODE_INVALID_INPUTS | 2 | Invalid controller GPIO readings Verify /common/state |
MODE_BMS_ERROR | 6 | BMS communication timeout detected |
MODE_IDENT | 9 | Motor identification in progress |
MODE_INIT | 10 | LYNX initialization (duration: /best/reset_time ) |
MODE_CAN_TIMEOUT | 20 | 200ms timeout on CAN 0x5FF - Control input message |
MODE_WELDING | 30 | Controller operating as stick welder (FW VECTOR_LYNX_welding only) |
MODE_CHARGE_EXT_FOREVER | 65 | BMS indicates charging Riding disabled until next power cycle |
MODE_CHARGE_EXT | 68 | BMS indicates charging Riding enabled when charging completes |
MODE_CHARGE | 70 | Controller functioning as step-up converter for battery charging (Requires special hardware) |
MODE_SLAVE | 79 | Device operating under Master controller in multi-controller configuration |
MODE_OVR | 80 | Driver override via Driver API or terminal |
MODE_LOCK | 90 | Device locked |
MODE_SEAT_SWITCH | 95 | Seat switch activated |
MODE_STANDBY | 100 | Device ready, motor freewheeling, no inputs active |
MODE_BRAKE | 101 | Braking active |
MODE_ACCELERATE | 102 | Accelerator-induced acceleration active |
MODE_KICKBACK | 104 | Kickback assist active |
MODE_ASSIST | 105 | PAS acceleration active |
MODE_CRUISE | 110 | Cruise control active |
MODE_DISARMED_FOREVER | 120 | LYNX permanently disarmed - accelerator input disabled |