mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-20 14:55:21 +03:00
decouple failsafe from the rest of the system.
Note: the pwm_common driver has a dependency on the main failsafe code, the solution is probably to move some of the code into rx_pwm.
This commit is contained in:
parent
aef28c1c08
commit
e969d184e6
29 changed files with 224 additions and 119 deletions
|
@ -26,8 +26,12 @@ static uint16_t sumdReadRawRC(rxConfig_t *rxConfig, rxRuntimeConfig_t *rxRuntime
|
|||
|
||||
static uint32_t sumdChannelData[SUMD_MAX_CHANNEL];
|
||||
|
||||
void sumdInit(rxConfig_t *rxConfig, rxRuntimeConfig_t *rxRuntimeConfig, rcReadRawDataPtr *callback)
|
||||
failsafe_t *failsafe;
|
||||
|
||||
void sumdInit(rxConfig_t *rxConfig, rxRuntimeConfig_t *rxRuntimeConfig, failsafe_t *initialFailsafe, rcReadRawDataPtr *callback)
|
||||
{
|
||||
failsafe = initialFailsafe;
|
||||
|
||||
serialPorts.rcvrport = uartOpen(USART2, sumdDataReceive, 115200, MODE_RX);
|
||||
if (callback)
|
||||
*callback = sumdReadRawRC;
|
||||
|
@ -74,7 +78,7 @@ bool sumdFrameComplete(void)
|
|||
if (sumdFrameDone) {
|
||||
sumdFrameDone = false;
|
||||
if (sumd[1] == 0x01) {
|
||||
failsafeCnt = 0;
|
||||
failsafe->vTable->reset();
|
||||
if (sumdSize > SUMD_MAX_CHANNEL)
|
||||
sumdSize = SUMD_MAX_CHANNEL;
|
||||
for (b = 0; b < sumdSize; b++)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue