mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-05-17 23:54:34 +08:00
494e3f3ad9
When adding a test node to a makefile section, with required compilation flags, include and other options, all the files (not arch dependent files) can be compiled with a TAP compatible program, included in the standard tests of the CI servers. Not all module's XML files are converted, but a large part of the most important parts are already covered. More will be added later. The number of tested airframes (full compilation of all targets) have been reduced to speed the CI compile time but still covers the relevant architecture and boards. The main benefit is that the overall coverage is already better than before as previous test aircraft were compiling more or less the same part of the airborne code, while this new mechanism is more efficient to test modules not included in any config.
134 lines
5.8 KiB
C
134 lines
5.8 KiB
C
/* This file has been generated by gen_radio from /home/gautier/dev/paparazzi/conf/radios/T10CG_SBUS.xml */
|
|
#ifndef RADIO_H
|
|
#define RADIO_H
|
|
|
|
#define RADIO_NAME Futaba T10CG with SBUS
|
|
|
|
#define RADIO_CTL_NB 7
|
|
|
|
#define RADIO_FILTER 7
|
|
|
|
#define RADIO_ROLL 0
|
|
#define RADIO_ROLL_NEUTRAL 1520
|
|
#define RADIO_ROLL_MIN 1107
|
|
#define RADIO_ROLL_MAX 1932
|
|
|
|
#define RADIO_PITCH 1
|
|
#define RADIO_PITCH_NEUTRAL 1520
|
|
#define RADIO_PITCH_MIN 1107
|
|
#define RADIO_PITCH_MAX 1932
|
|
|
|
#define RADIO_THROTTLE 2
|
|
#define RADIO_THROTTLE_NEUTRAL 1932
|
|
#define RADIO_THROTTLE_MIN 1932
|
|
#define RADIO_THROTTLE_MAX 1107
|
|
|
|
#define RADIO_YAW 3
|
|
#define RADIO_YAW_NEUTRAL 1520
|
|
#define RADIO_YAW_MIN 1107
|
|
#define RADIO_YAW_MAX 1932
|
|
|
|
#define RADIO_MODE 4
|
|
#define RADIO_MODE_NEUTRAL 1520
|
|
#define RADIO_MODE_MIN 2072
|
|
#define RADIO_MODE_MAX 966
|
|
|
|
#define RADIO_GAIN1 5
|
|
#define RADIO_GAIN1_NEUTRAL 1520
|
|
#define RADIO_GAIN1_MIN 966
|
|
#define RADIO_GAIN1_MAX 2072
|
|
|
|
#define RADIO_GAIN2 6
|
|
#define RADIO_GAIN2_NEUTRAL 1520
|
|
#define RADIO_GAIN2_MIN 966
|
|
#define RADIO_GAIN2_MAX 2072
|
|
|
|
#define PPM_PULSE_TYPE PPM_PULSE_TYPE_POSITIVE
|
|
#define PPM_DATA_MIN_LEN (900ul)
|
|
#define PPM_DATA_MAX_LEN (2100ul)
|
|
#define PPM_SYNC_MIN_LEN (5000ul)
|
|
#define PPM_SYNC_MAX_LEN (15000ul)
|
|
|
|
#define NormalizePpmFIR(_ppm, _rc) {\
|
|
static uint8_t avg_cpt = 0; /* Counter for averaging */\
|
|
int16_t tmp_radio;\
|
|
tmp_radio = _ppm[RADIO_ROLL] - RC_PPM_TICKS_OF_USEC(1520);\
|
|
_rc.values[RADIO_ROLL] = tmp_radio * (tmp_radio >=0 ? (MAX_PPRZ/(float)(RC_PPM_SIGNED_TICKS_OF_USEC(1932-1520))) : (MIN_PPRZ/(float)(RC_PPM_SIGNED_TICKS_OF_USEC(1107-1520))));\
|
|
Bound(_rc.values[RADIO_ROLL], MIN_PPRZ, MAX_PPRZ); \
|
|
\
|
|
tmp_radio = _ppm[RADIO_PITCH] - RC_PPM_TICKS_OF_USEC(1520);\
|
|
_rc.values[RADIO_PITCH] = tmp_radio * (tmp_radio >=0 ? (MAX_PPRZ/(float)(RC_PPM_SIGNED_TICKS_OF_USEC(1932-1520))) : (MIN_PPRZ/(float)(RC_PPM_SIGNED_TICKS_OF_USEC(1107-1520))));\
|
|
Bound(_rc.values[RADIO_PITCH], MIN_PPRZ, MAX_PPRZ); \
|
|
\
|
|
tmp_radio = _ppm[RADIO_THROTTLE] - RC_PPM_TICKS_OF_USEC(1932);\
|
|
_rc.values[RADIO_THROTTLE] = tmp_radio * (MAX_PPRZ / (float)(RC_PPM_SIGNED_TICKS_OF_USEC(1107-1932)));\
|
|
Bound(_rc.values[RADIO_THROTTLE], 0, MAX_PPRZ); \
|
|
\
|
|
tmp_radio = _ppm[RADIO_YAW] - RC_PPM_TICKS_OF_USEC(1520);\
|
|
_rc.values[RADIO_YAW] = tmp_radio * (tmp_radio >=0 ? (MAX_PPRZ/(float)(RC_PPM_SIGNED_TICKS_OF_USEC(1932-1520))) : (MIN_PPRZ/(float)(RC_PPM_SIGNED_TICKS_OF_USEC(1107-1520))));\
|
|
Bound(_rc.values[RADIO_YAW], MIN_PPRZ, MAX_PPRZ); \
|
|
\
|
|
_rc.avg_values[RADIO_MODE] += _ppm[RADIO_MODE];\
|
|
tmp_radio = _ppm[RADIO_GAIN1] - RC_PPM_TICKS_OF_USEC(1520);\
|
|
_rc.values[RADIO_GAIN1] = tmp_radio * (tmp_radio >=0 ? (MAX_PPRZ/(float)(RC_PPM_SIGNED_TICKS_OF_USEC(2072-1520))) : (MIN_PPRZ/(float)(RC_PPM_SIGNED_TICKS_OF_USEC(966-1520))));\
|
|
Bound(_rc.values[RADIO_GAIN1], MIN_PPRZ, MAX_PPRZ); \
|
|
\
|
|
tmp_radio = _ppm[RADIO_GAIN2] - RC_PPM_TICKS_OF_USEC(1520);\
|
|
_rc.values[RADIO_GAIN2] = tmp_radio * (tmp_radio >=0 ? (MAX_PPRZ/(float)(RC_PPM_SIGNED_TICKS_OF_USEC(2072-1520))) : (MIN_PPRZ/(float)(RC_PPM_SIGNED_TICKS_OF_USEC(966-1520))));\
|
|
Bound(_rc.values[RADIO_GAIN2], MIN_PPRZ, MAX_PPRZ); \
|
|
\
|
|
avg_cpt++;\
|
|
if (avg_cpt == RC_AVG_PERIOD) {\
|
|
avg_cpt = 0;\
|
|
tmp_radio = _rc.avg_values[RADIO_MODE] / RC_AVG_PERIOD - RC_PPM_TICKS_OF_USEC(1520);\
|
|
_rc.values[RADIO_MODE] = tmp_radio * (tmp_radio >=0 ? (MAX_PPRZ/(float)(RC_PPM_SIGNED_TICKS_OF_USEC(966-1520))) : (MIN_PPRZ/(float)(RC_PPM_SIGNED_TICKS_OF_USEC(2072-1520))));\
|
|
_rc.avg_values[RADIO_MODE] = 0;\
|
|
Bound(_rc.values[RADIO_MODE], MIN_PPRZ, MAX_PPRZ); \
|
|
\
|
|
}\
|
|
}
|
|
|
|
#define NormalizePpmIIR(_ppm, _rc) {\
|
|
int32_t tmp_radio;\
|
|
int32_t tmp_value;\
|
|
\
|
|
tmp_radio = _ppm[RADIO_ROLL] - RC_PPM_TICKS_OF_USEC(1520);\
|
|
tmp_value = (tmp_radio >=0 ? (tmp_radio * MAX_PPRZ) / (RC_PPM_SIGNED_TICKS_OF_USEC(1932-1520)) : (tmp_radio * MIN_PPRZ) / (RC_PPM_SIGNED_TICKS_OF_USEC(1107-1520)));\
|
|
Bound(tmp_value, MIN_PPRZ, MAX_PPRZ); \
|
|
_rc.values[RADIO_ROLL] = (pprz_t)(tmp_value);\
|
|
\
|
|
tmp_radio = _ppm[RADIO_PITCH] - RC_PPM_TICKS_OF_USEC(1520);\
|
|
tmp_value = (tmp_radio >=0 ? (tmp_radio * MAX_PPRZ) / (RC_PPM_SIGNED_TICKS_OF_USEC(1932-1520)) : (tmp_radio * MIN_PPRZ) / (RC_PPM_SIGNED_TICKS_OF_USEC(1107-1520)));\
|
|
Bound(tmp_value, MIN_PPRZ, MAX_PPRZ); \
|
|
_rc.values[RADIO_PITCH] = (pprz_t)(tmp_value);\
|
|
\
|
|
tmp_radio = _ppm[RADIO_THROTTLE] - RC_PPM_TICKS_OF_USEC(1932);\
|
|
tmp_value = (tmp_radio * MAX_PPRZ) / (RC_PPM_SIGNED_TICKS_OF_USEC(1107-1932));\
|
|
Bound(tmp_value, 0, MAX_PPRZ); \
|
|
_rc.values[RADIO_THROTTLE] = (pprz_t)(tmp_value);\
|
|
\
|
|
tmp_radio = _ppm[RADIO_YAW] - RC_PPM_TICKS_OF_USEC(1520);\
|
|
tmp_value = (tmp_radio >=0 ? (tmp_radio * MAX_PPRZ) / (RC_PPM_SIGNED_TICKS_OF_USEC(1932-1520)) : (tmp_radio * MIN_PPRZ) / (RC_PPM_SIGNED_TICKS_OF_USEC(1107-1520)));\
|
|
Bound(tmp_value, MIN_PPRZ, MAX_PPRZ); \
|
|
_rc.values[RADIO_YAW] = (pprz_t)(tmp_value);\
|
|
\
|
|
tmp_radio = _ppm[RADIO_MODE] - RC_PPM_TICKS_OF_USEC(1520);\
|
|
tmp_value = (tmp_radio >=0 ? (tmp_radio * MAX_PPRZ) / (RC_PPM_SIGNED_TICKS_OF_USEC(966-1520)) : (tmp_radio * MIN_PPRZ) / (RC_PPM_SIGNED_TICKS_OF_USEC(2072-1520)));\
|
|
Bound(tmp_value, MIN_PPRZ, MAX_PPRZ); \
|
|
_rc.values[RADIO_MODE] = (pprz_t)((RADIO_FILTER * _rc.values[RADIO_MODE] + tmp_value) / (RADIO_FILTER + 1));\
|
|
\
|
|
tmp_radio = _ppm[RADIO_GAIN1] - RC_PPM_TICKS_OF_USEC(1520);\
|
|
tmp_value = (tmp_radio >=0 ? (tmp_radio * MAX_PPRZ) / (RC_PPM_SIGNED_TICKS_OF_USEC(2072-1520)) : (tmp_radio * MIN_PPRZ) / (RC_PPM_SIGNED_TICKS_OF_USEC(966-1520)));\
|
|
Bound(tmp_value, MIN_PPRZ, MAX_PPRZ); \
|
|
_rc.values[RADIO_GAIN1] = (pprz_t)(tmp_value);\
|
|
\
|
|
tmp_radio = _ppm[RADIO_GAIN2] - RC_PPM_TICKS_OF_USEC(1520);\
|
|
tmp_value = (tmp_radio >=0 ? (tmp_radio * MAX_PPRZ) / (RC_PPM_SIGNED_TICKS_OF_USEC(2072-1520)) : (tmp_radio * MIN_PPRZ) / (RC_PPM_SIGNED_TICKS_OF_USEC(966-1520)));\
|
|
Bound(tmp_value, MIN_PPRZ, MAX_PPRZ); \
|
|
_rc.values[RADIO_GAIN2] = (pprz_t)(tmp_value);\
|
|
\
|
|
}
|
|
|
|
|
|
#endif // RADIO_H
|