Failsafe modification

The following protocols are supporting failsafe: FrSkyX, Devo, WK2x01, SFHSS, HISKY/HK310 and AFHDS2A
In Serial mode failsafe is configured on the radio itself.
In PPM mode and only after the module is up and fully operational, press the bind button for at least 5sec to send the current stick positions as failsafe to the RX.
This commit is contained in:
pascallanger
2019-09-27 16:20:43 +02:00
parent 18af4a0724
commit e783ce5788
4 changed files with 39 additions and 46 deletions

View File

@@ -653,6 +653,7 @@ uint8_t Update_All()
Channel_data[i]=val;
}
PPM_FLAG_off; // wait for next frame before update
PPM_failsafe();
update_channels_aux();
INPUT_SIGNAL_on; // valid signal received
last_signal=millis();
@@ -693,6 +694,32 @@ uint8_t Update_All()
return 0;
}
#ifdef ENABLE_PPM
void PPM_failsafe()
{
static uint8_t counter=0;
if(IS_BIND_IN_PROGRESS || IS_FAILSAFE_VALUES_on) // bind is not finished yet or Failsafe already being sent
return;
BIND_SET_INPUT;
BIND_SET_PULLUP;
if(IS_BIND_BUTTON_on)
{// bind button pressed
counter++;
if(counter>227)
{ //after 5s with PPM frames @22ms
counter=0;
for(uint8_t i=0;i<NUM_CHN;i++)
Failsafe_data[i]=Channel_data[i];
FAILSAFE_VALUES_on;
}
}
else
counter=0;
BIND_SET_OUTPUT;
}
#endif
// Update channels direction and Channel_AUX flags based on servo AUX positions
static void update_channels_aux(void)
{
@@ -927,7 +954,7 @@ static void protocol_init()
set_rx_tx_addr(MProtocol_id);
#ifdef FAILSAFE_ENABLE
InitFailsafe();
FAILSAFE_VALUES_off;
#endif
blink=millis();