![]() |
ACwing FC firmware
STM32WB55: attitude IEKF, altitude Kalman filter, flight core, protocol v2
|
Last (op, seq) -> ACK pairs (HANDOVER_FW.md §5, "Sequence and ACK rules"). More...
#include <stdint.h>Go to the source code of this file.
Macros | |
| #define | ACK_CACHE_LEN 32u |
| >= 16 required | |
Enumerations | |
| enum | { ACKC_NEW = 0 , ACKC_PENDING = 1 , ACKC_DONE = 2 } |
Functions | |
| void | ackc_reset (void) |
| uint8_t | ackc_begin (uint8_t op, uint8_t seq, uint8_t *result, uint8_t *reason) |
| Looks up (op, seq). | |
| void | ackc_finish (uint8_t op, uint8_t seq, uint8_t result, uint8_t reason) |
| Completes the entry (or creates it if it was evicted meanwhile). | |
Last (op, seq) -> ACK pairs (HANDOVER_FW.md §5, "Sequence and ACK rules").
The app re-sends a command without ACK after 600 ms, twice at most, with the same seq. A repeated (op, seq) must get the cached ACK again and must NOT be executed a second time (a repeated ARM, TAKEOFF or MOTOR_TEST must not happen twice). Entries are PENDING while the flight core has not answered yet: a repeat of a pending command is ignored (its ACK will come).
Host-testable.
Definition in file ack_cache.h.
| #define ACK_CACHE_LEN 32u |
>= 16 required
Definition at line 18 of file ack_cache.h.
| anonymous enum |
| Enumerator | |
|---|---|
| ACKC_NEW | |
| ACKC_PENDING | |
| ACKC_DONE | |
Definition at line 19 of file ack_cache.h.
| void ackc_reset | ( | void | ) |
Definition at line 12 of file ack_cache.c.
Referenced by app_init(), and app_step().
| uint8_t ackc_begin | ( | uint8_t | op, |
| uint8_t | seq, | ||
| uint8_t * | result, | ||
| uint8_t * | reason | ||
| ) |
Looks up (op, seq).
ACKC_DONE: result/reason filled, re-send them. ACKC_PENDING: ignore. ACKC_NEW: a pending entry was created, execute it.
Definition at line 31 of file ack_cache.c.
References ACKC_DONE, ACKC_NEW, ACKC_PENDING, entry_t::age, find(), entry_t::op, entry_t::reason, result(), entry_t::result, s_clock, seq, entry_t::seq, slot(), entry_t::state, and entry_t::used.
Referenced by commands(), and usb_commands().
| void ackc_finish | ( | uint8_t | op, |
| uint8_t | seq, | ||
| uint8_t | result, | ||
| uint8_t | reason | ||
| ) |
Completes the entry (or creates it if it was evicted meanwhile).
Definition at line 44 of file ack_cache.c.
References ACKC_DONE, entry_t::age, find(), entry_t::op, entry_t::reason, result(), entry_t::result, s_clock, seq, entry_t::seq, slot(), entry_t::state, and entry_t::used.
Referenced by ack_link().