STAR
Cal STAR — firmware, DAQ server, and engine design
Loading...
Searching...
No Matches
flight_state.h
Go to the documentation of this file.
1#ifndef STAR_FLIGHT_STATE_H
2#define STAR_FLIGHT_STATE_H
3
4/*
5 * The flight computer's top-level states, as drawn in Flight_computer.drawio:
6 *
7 * power on -> SELF_TEST -(done)-> IDLE -(Arm)-> ARMED -(launch)-> LAUNCHED
8 * ^ | |
9 * +--(Un-arm)---+ (apogee)
10 * v
11 * RECOVERY
12 *
13 * This file is only the transition table: which event moves which state
14 * where. It does no I/O and owns no timers, so it runs unchanged on a laptop
15 * (tests/emmc) and on the board. Launch and apogee detection do not exist
16 * yet; nothing raises those events today.
17 */
18
19#include <stdbool.h>
20
21#ifdef __cplusplus
22extern "C" {
23#endif
24
33
42
43/*
44 * The state after `event` arrives in `state`. An event the diagram does not
45 * draw from that state leaves it unchanged: Un-arm after launch is ignored,
46 * Arm while armed is ignored. An out-of-range state or event also returns
47 * `state` unchanged.
48 */
50
51/*
52 * Whether the eMMC flight log records in this state. At this stage it starts
53 * at ARMED, not LAUNCHED, because launch detection is not implemented: a log
54 * that waited for "launch detected" would never start. ARMED, LAUNCHED and
55 * RECOVERY record; SELF_TEST and IDLE leave the eMMC untouched.
56 */
58
59/* Upper-case name for logs and the ground station ("ARMED"); "?" if bad. */
61
62#ifdef __cplusplus
63}
64#endif
65#endif
flight_state_t flight_state_next(flight_state_t state, flight_event_t event)
Definition flight_state.c:3
const char * flight_state_name(flight_state_t state)
flight_state_t
@ FLIGHT_RECOVERY
@ FLIGHT_SELF_TEST
@ FLIGHT_ARMED
@ FLIGHT_IDLE
@ FLIGHT_LAUNCHED
@ FLIGHT_STATE_COUNT
flight_event_t
@ FLIGHT_EV_LAUNCH_DETECTED
@ FLIGHT_EV_ARM
@ FLIGHT_EV_UNARM
@ FLIGHT_EV_APOGEE_DETECTED
@ FLIGHT_EV_SELF_TEST_DONE
@ FLIGHT_EVENT_COUNT
bool flight_state_logs_to_emmc(flight_state_t state)
static ActuatorControllerState state
Definition main.cpp:57