STAR
Cal STAR — firmware, DAQ server, and engine design
Loading...
Searching...
No Matches
mode_core.c
Go to the documentation of this file.
1#include "mode_core.h"
2
4 mode_outputs_t o = {false, false, false, false, false};
5 switch (state) {
6 case FLIGHT_IDLE:
7 o.idle_loop = true;
8 o.radio_sniff = true; /* ~0.15 mA instead of ~4.6 mA listening */
9 break;
10 case FLIGHT_ARMED:
11 case FLIGHT_LAUNCHED:
12 case FLIGHT_RECOVERY:
13 o.sensors = true;
14 o.gps = true;
15 o.ethernet = true;
16 break;
17 default: /* SELF_TEST, out of range: nothing new started */
18 break;
19 }
20 return o;
21}
22
24 flight_state_t* next) {
25 if (state == FLIGHT_IDLE) {
26 return MODE_TO_IDLE_LOOP;
27 }
31 if (to == state) {
32 return MODE_IGNORE;
33 }
34 if (next) {
35 *next = to;
36 }
37 return MODE_TRANSITION;
38}
flight_state_t
@ FLIGHT_RECOVERY
@ FLIGHT_ARMED
@ FLIGHT_IDLE
@ FLIGHT_LAUNCHED
flight_event_t
@ FLIGHT_EV_ARM
@ FLIGHT_EV_UNARM
static ActuatorControllerState state
Definition main.cpp:57
flight_state_t flight_state_next(flight_state_t state, flight_event_t event)
Definition flight_state.c:3
return o
Definition json.hpp:13897
mode_route_t mode_route_command(flight_state_t state, mode_command_t command, flight_state_t *next)
Definition mode_core.c:23
mode_outputs_t mode_outputs(flight_state_t state)
Definition mode_core.c:3
mode_route_t
Definition mode_core.h:45
@ MODE_TRANSITION
Definition mode_core.h:47
@ MODE_TO_IDLE_LOOP
Definition mode_core.h:46
@ MODE_IGNORE
Definition mode_core.h:48
mode_command_t
Definition mode_core.h:43
@ MODE_CMD_ARM
Definition mode_core.h:43