mirror of
https://github.com/pascallanger/DIY-Multiprotocol-TX-Module.git
synced 2025-03-15 12:59:09 +00:00
Failsafe
This commit is contained in:
parent
fd4346cb64
commit
ed42bf311f
@ -14,27 +14,20 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef FAILSAFE_ENABLE
|
#ifdef FAILSAFE_ENABLE
|
||||||
#if FAILSAFE_THROTTLE_LOW < -125
|
//Convert from percentage to failsafe value
|
||||||
#undef FAILSAFE_THROTTLE_LOW
|
|
||||||
#define FAILSAFE_THROTTLE_LOW -125
|
|
||||||
#elif FAILSAFE_THROTTLE_LOW > 125
|
|
||||||
#undef FAILSAFE_THROTTLE_LOW
|
|
||||||
#define FAILSAFE_THROTTLE_LOW 125
|
|
||||||
#endif
|
|
||||||
#define FAILSAFE_THROTTLE_LOW_VAL (((FAILSAFE_THROTTLE_LOW+125)*1024)/125)
|
#define FAILSAFE_THROTTLE_LOW_VAL (((FAILSAFE_THROTTLE_LOW+125)*1024)/125)
|
||||||
#if FAILSAFE_THROTTLE_LOW_VAL == 0
|
#if FAILSAFE_THROTTLE_LOW_VAL <= 0
|
||||||
#undef FAILSAFE_THROTTLE_LOW_VAL
|
#undef FAILSAFE_THROTTLE_LOW_VAL
|
||||||
#define FAILSAFE_THROTTLE_LOW_VAL 1
|
#define FAILSAFE_THROTTLE_LOW_VAL 1
|
||||||
#elif (FAILSAFE_THROTTLE_LOW_VAL) >= 2046
|
#elif (FAILSAFE_THROTTLE_LOW_VAL) >= 2046
|
||||||
#undef FAILSAFE_THROTTLE_LOW_VAL
|
#undef FAILSAFE_THROTTLE_LOW_VAL
|
||||||
#define FAILSAFE_THROTTLE_LOW_VAL 2046
|
#define FAILSAFE_THROTTLE_LOW_VAL 2046
|
||||||
#endif
|
#endif
|
||||||
//#define FAILSAFE_THROTTLE_LOW_VAL FAILSAFE_THROTTLE_LOW
|
|
||||||
void InitFailsafe()
|
void InitFailsafe()
|
||||||
{
|
{
|
||||||
for(uint8_t i=0;i<NUM_CHN;i++)
|
for(uint8_t i=0;i<NUM_CHN;i++)
|
||||||
Failsafe_data[i]=1024;
|
Failsafe_data[i]=1024;
|
||||||
Failsafe_data[THROTTLE]=FAILSAFE_THROTTLE_LOW_VAL; //0=-125%, 204=-100%
|
Failsafe_data[THROTTLE]=(uint16_t)FAILSAFE_THROTTLE_LOW_VAL; //0=-125%, 204=-100%
|
||||||
FAILSAFE_VALUES_on;
|
FAILSAFE_VALUES_on;
|
||||||
#ifdef FAILSAFE_SERIAL_ONLY
|
#ifdef FAILSAFE_SERIAL_ONLY
|
||||||
if(mode_select == MODE_SERIAL)
|
if(mode_select == MODE_SERIAL)
|
||||||
|
@ -164,8 +164,8 @@
|
|||||||
//If you want to diasble failsafe globally comment the line below using "//".
|
//If you want to diasble failsafe globally comment the line below using "//".
|
||||||
#define FAILSAFE_ENABLE
|
#define FAILSAFE_ENABLE
|
||||||
|
|
||||||
//Failsafe throttle low value.
|
//Failsafe throttle low value in percentage.
|
||||||
//Value between -125% and +125%
|
//Value between -125% and +125%. Default -100.
|
||||||
#define FAILSAFE_THROTTLE_LOW -100
|
#define FAILSAFE_THROTTLE_LOW -100
|
||||||
|
|
||||||
//The radio using serial protocol can set failsafe data (ersky9x only for now).
|
//The radio using serial protocol can set failsafe data (ersky9x only for now).
|
||||||
|
Loading…
x
Reference in New Issue
Block a user