| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109 |
- #ifndef __SOFT_RC_INPUT_H
- #define __SOFT_RC_INPUT_H
- #include "common.h"
- #include "stdbool.h"
- // S.BUS的通道数
- #define SBUS_CH 18
- // const unsigned char CH1=0,CH2=1,CH3=2,CH4=3,CH5=4,CH6=5,CH7=6;
- #define RC_INPUT_CH_NUM 16
- #define RC_CH1 0
- #define RC_CH2 1
- #define RC_CH3 2
- #define RC_CH4 3
- #define RC_CH5 4
- #define RC_CH6 5
- #define RC_CH7 6
- #define RC_CH8 7
- #define RC_CH9 8
- #define RC_CH10 9
- #define RC_CH11 10
- #define RC_CH12 11
- #define RC_CH13 12
- #define RC_CH14 13
- #define RC_CH15 14
- #define RC_CH16 15
- #define RC_ROLL RC_CH1
- #define RC_PITCH RC_CH2
- #define RC_THR RC_CH3
- #define RC_YAW RC_CH4
- typedef enum
- {
- // 信号正常
- RC_SIGNAL_HEALTH = 0,
- RC_SIGNAL_FAIL = 1,
- // 信号超允许范围
- RC_SIGNAL_BAD = 2
- } RcSignalHealthType;
- extern RcSignalHealthType rc_signal_health;
- // 遥控器是否有效
- extern comp_status comp_rc_status;
- //===================失控保护的油门量========================
- #define RC_FS_MIN 800
- #define RC_FS_MAX 980
- #define RC_IN_MIN 980
- #define RC_IN_MAX 2020
- #define RC_DEAD_ZONE 50
- #define ROCK_DEAD_ZONE 100
- #define MIN_S 1000
- #define MIN_E 1333
- #define MID_S 1334
- #define MID_E 1666
- #define MAX_S 1667
- #define MAX_E 2000
- typedef enum
- {
- RC_CALIB_NO = 0,
- RC_CALIB_START = 1,
- RC_CALIB_END = 2
- } RCCalibStatusType;
- extern RCCalibStatusType rc_cal_flag;
- //需要校准的通道
- #define RC_CALIB_CH_NUM 4
- extern short rc_in[RC_INPUT_CH_NUM];
- extern short raw_rc_in[RC_INPUT_CH_NUM];
- extern short tmp_rc_in[RC_INPUT_CH_NUM];
- extern short rc_cal_offset[RC_CALIB_CH_NUM];
- extern short rc_cal_factor_up[RC_CALIB_CH_NUM];
- extern short rc_cal_factor_down[RC_CALIB_CH_NUM];
- extern bool rc_offset_capture_flag;
- void rc_input_initial(void);
- void get_rc_value(void);
- void check_sbus_link_status(float dt_s);
- extern unsigned int rc_cal_time;
- void rc_input_calib_start(void);
- void rc_input_calib_end(void);
- void rc_input_calibration(void);
- void calc_rcfactor_calibration(void);
- #define KEY_UP 1
- #define KEY_DOWN 0
- extern short rock_in[4];
- extern char rock_key;
- #endif
|