mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-06-06 07:53:43 +08:00
downlink macros with transport and device arguments
This commit is contained in:
@@ -7,6 +7,7 @@
|
|||||||
<!ATTLIST process
|
<!ATTLIST process
|
||||||
name CDATA #REQUIRED
|
name CDATA #REQUIRED
|
||||||
channel CDATA "DefaultChannel"
|
channel CDATA "DefaultChannel"
|
||||||
|
device CDATA "DefaultDevice"
|
||||||
>
|
>
|
||||||
<!ATTLIST mode
|
<!ATTLIST mode
|
||||||
name CDATA #REQUIRED
|
name CDATA #REQUIRED
|
||||||
|
|||||||
@@ -4,45 +4,45 @@
|
|||||||
extern char ivy_buf[];
|
extern char ivy_buf[];
|
||||||
extern char* ivy_p;
|
extern char* ivy_p;
|
||||||
|
|
||||||
#define IvyTransportCheckFreeSpace(_) TRUE
|
#define IvyTransportCheckFreeSpace(_dev,_) TRUE
|
||||||
|
|
||||||
#define IvyTransportSizeOf(x) (x)
|
#define IvyTransportSizeOf(x) (x)
|
||||||
|
|
||||||
#define IvyTransportHeader(len) ivy_p=ivy_buf;
|
#define IvyTransportHeader(_dev,len) ivy_p=ivy_buf;
|
||||||
|
|
||||||
#define IvyTransportTrailer() { *ivy_p = '\0'; IvySendMsg("%s",ivy_buf); }
|
#define IvyTransportTrailer(_dev) { *ivy_p = '\0'; IvySendMsg("%s",ivy_buf); }
|
||||||
|
|
||||||
#define IvyTransportPutUint8(x) { ivy_p += sprintf(ivy_p, "%u ", x); }
|
#define IvyTransportPutUint8(_dev,x) { ivy_p += sprintf(ivy_p, "%u ", x); }
|
||||||
#define IvyTransportPutNamedUint8(_name, _x) { ivy_p += sprintf(ivy_p, "%s ", _name); }
|
#define IvyTransportPutNamedUint8(_dev,_name, _x) { ivy_p += sprintf(ivy_p, "%s ", _name); }
|
||||||
|
|
||||||
#define Space() ivy_p += sprintf(ivy_p, " ");
|
#define Space() ivy_p += sprintf(ivy_p, " ");
|
||||||
#define Comma() ivy_p += sprintf(ivy_p, ",");
|
#define Comma() ivy_p += sprintf(ivy_p, ",");
|
||||||
|
|
||||||
#define IvyTransportPutUintByAddr(x) ivy_p += sprintf(ivy_p, "%u", *x);
|
#define IvyTransportPutUintByAddr(_dev,x) ivy_p += sprintf(ivy_p, "%u", *x);
|
||||||
#define IvyTransportPutUint8ByAddr(x) IvyTransportPutUintByAddr(x) Space()
|
#define IvyTransportPutUint8ByAddr(_dev,x) IvyTransportPutUintByAddr(_dev,x) Space()
|
||||||
#define IvyTransportPutUint16ByAddr(x) IvyTransportPutUintByAddr(x) Space()
|
#define IvyTransportPutUint16ByAddr(_dev,x) IvyTransportPutUintByAddr(_dev,x) Space()
|
||||||
#define IvyTransportPutUint32ByAddr(x) IvyTransportPutUintByAddr(x) Space()
|
#define IvyTransportPutUint32ByAddr(_dev,x) IvyTransportPutUintByAddr(_dev,x) Space()
|
||||||
|
|
||||||
#define IvyTransportPutIntByAddr(x) ivy_p += sprintf(ivy_p, "%d", *x);
|
#define IvyTransportPutIntByAddr(_dev,x) ivy_p += sprintf(ivy_p, "%d", *x);
|
||||||
#define IvyTransportPutInt8ByAddr(x) IvyTransportPutIntByAddr(x) Space()
|
#define IvyTransportPutInt8ByAddr(_dev,x) IvyTransportPutIntByAddr(_dev,x) Space()
|
||||||
#define IvyTransportPutInt16ByAddr(x) IvyTransportPutIntByAddr(x) Space()
|
#define IvyTransportPutInt16ByAddr(_dev,x) IvyTransportPutIntByAddr(_dev,x) Space()
|
||||||
#define IvyTransportPutInt32ByAddr(x) IvyTransportPutIntByAddr(x) Space()
|
#define IvyTransportPutInt32ByAddr(_dev,x) IvyTransportPutIntByAddr(_dev,x) Space()
|
||||||
|
|
||||||
#define IvyTransportPutOneFloatByAddr(x) ivy_p += sprintf(ivy_p, "%f", *x);
|
#define IvyTransportPutOneFloatByAddr(_dev,x) ivy_p += sprintf(ivy_p, "%f", *x);
|
||||||
#define IvyTransportPutFloatByAddr(x) IvyTransportPutOneFloatByAddr(x) Space()
|
#define IvyTransportPutFloatByAddr(_dev,x) IvyTransportPutOneFloatByAddr(_dev,x) Space()
|
||||||
#define IvyTransportPutDoubleByAddr(x) IvyTransportPutOneFloatByAddr(x) Space()
|
#define IvyTransportPutDoubleByAddr(_dev,x) IvyTransportPutOneFloatByAddr(_dev,x) Space()
|
||||||
|
|
||||||
#define IvyTransportPutArray(_put, _n, _x) { \
|
#define IvyTransportPutArray(_dev,_put, _n, _x) { \
|
||||||
int __i; \
|
int __i; \
|
||||||
for(__i = 0; __i < _n; __i++) { \
|
for(__i = 0; __i < _n; __i++) { \
|
||||||
_put(&_x[__i]); \
|
_put(_dev,&_x[__i]); \
|
||||||
Comma(); \
|
Comma(); \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define IvyTransportPutUint8Array(_n, _x) IvyTransportPutArray(IvyTransportPutUintByAddr, _n, _x)
|
#define IvyTransportPutUint8Array(_dev,_n, _x) IvyTransportPutArray(_dev,IvyTransportPutUintByAddr, _n, _x)
|
||||||
#define IvyTransportPutInt16Array(_n, _x) IvyTransportPutArray(IvyTransportPutIntByAddr, _n, _x)
|
#define IvyTransportPutInt16Array(_dev,_n, _x) IvyTransportPutArray(_dev,IvyTransportPutIntByAddr, _n, _x)
|
||||||
#define IvyTransportPutUint16Array(_n, _x) IvyTransportPutArray(IvyTransportPutUintByAddr, _n, _x)
|
#define IvyTransportPutUint16Array(_dev,_n, _x) IvyTransportPutArray(_dev,IvyTransportPutUintByAddr, _n, _x)
|
||||||
#define IvyTransportPutUint32Array(_n, _x) IvyTransportPutArray(IvyTransportPutUintByAddr, _n, _x)
|
#define IvyTransportPutUint32Array(_dev,_n, _x) IvyTransportPutArray(_dev,IvyTransportPutUintByAddr, _n, _x)
|
||||||
#define IvyTransportPutFloatArray(_n, _x) IvyTransportPutArray(IvyTransportPutOneFloatByAddr, _n, _x)
|
#define IvyTransportPutFloatArray(_dev,_n, _x) IvyTransportPutArray(_dev,IvyTransportPutOneFloatByAddr, _n, _x)
|
||||||
#define IvyTransportPutDoubleArray(_n, _x) IvyTransportPutFloatArray(_n, _x)
|
#define IvyTransportPutDoubleArray(_dev,_n, _x) IvyTransportPutFloatArray(_dev,_n, _x)
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
#define MOfCm(_x) (((float)(_x))/100.)
|
#define MOfCm(_x) (((float)(_x))/100.)
|
||||||
|
|
||||||
void parse_dl_ping(char* argv[] __attribute__ ((unused))) {
|
void parse_dl_ping(char* argv[] __attribute__ ((unused))) {
|
||||||
DOWNLINK_SEND_PONG(DefaultChannel);
|
DOWNLINK_SEND_PONG(DefaultChannel, DefaultDevice);
|
||||||
}
|
}
|
||||||
|
|
||||||
void parse_dl_acinfo(char* argv[] __attribute__ ((unused))) {
|
void parse_dl_acinfo(char* argv[] __attribute__ ((unused))) {
|
||||||
@@ -30,13 +30,13 @@ void parse_dl_setting(char* argv[]) {
|
|||||||
uint8_t index = atoi(argv[2]);
|
uint8_t index = atoi(argv[2]);
|
||||||
float value = atof(argv[3]);
|
float value = atof(argv[3]);
|
||||||
DlSetting(index, value);
|
DlSetting(index, value);
|
||||||
DOWNLINK_SEND_DL_VALUE(DefaultChannel,&index, &value);
|
DOWNLINK_SEND_DL_VALUE(DefaultChannel, DefaultDevice,&index, &value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void parse_dl_get_setting(char* argv[]) {
|
void parse_dl_get_setting(char* argv[]) {
|
||||||
uint8_t index = atoi(argv[2]);
|
uint8_t index = atoi(argv[2]);
|
||||||
float value = settings_get_value(index);
|
float value = settings_get_value(index);
|
||||||
DOWNLINK_SEND_DL_VALUE(DefaultChannel,&index, &value);
|
DOWNLINK_SEND_DL_VALUE(DefaultChannel, DefaultDevice,&index, &value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void parse_dl_block(char* argv[]) {
|
void parse_dl_block(char* argv[]) {
|
||||||
@@ -61,6 +61,6 @@ void parse_dl_move_wp(char* argv[]) {
|
|||||||
coordinates */
|
coordinates */
|
||||||
utm.east = waypoints[wp_id].x + nav_utm_east0;
|
utm.east = waypoints[wp_id].x + nav_utm_east0;
|
||||||
utm.north = waypoints[wp_id].y + nav_utm_north0;
|
utm.north = waypoints[wp_id].y + nav_utm_north0;
|
||||||
DOWNLINK_SEND_WP_MOVED(DefaultChannel, &wp_id, &utm.east, &utm.north, &a, &nav_utm_zone0);
|
DOWNLINK_SEND_WP_MOVED(DefaultChannel, DefaultDevice, &wp_id, &utm.east, &utm.north, &a, &nav_utm_zone0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ static inline void main_init( void ) {
|
|||||||
static inline void main_periodic_task( void ) {
|
static inline void main_periodic_task( void ) {
|
||||||
|
|
||||||
RunOnceEvery(2, {baro_periodic();});
|
RunOnceEvery(2, {baro_periodic();});
|
||||||
RunOnceEvery(256, {DOWNLINK_SEND_ALIVE(DefaultChannel, 16, MD5SUM);});
|
RunOnceEvery(256, {DOWNLINK_SEND_ALIVE(DefaultChannel, DefaultDevice, 16, MD5SUM);});
|
||||||
LED_PERIODIC();
|
LED_PERIODIC();
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -85,5 +85,5 @@ static inline void main_on_baro_diff(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static inline void main_on_baro_abs(void) {
|
static inline void main_on_baro_abs(void) {
|
||||||
RunOnceEvery(5,{DOWNLINK_SEND_BARO_RAW(DefaultChannel, &baro.absolute, &baro.differential);});
|
RunOnceEvery(5,{DOWNLINK_SEND_BARO_RAW(DefaultChannel, DefaultDevice, &baro.absolute, &baro.differential);});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -75,10 +75,10 @@ static inline void main_periodic_task( void ) {
|
|||||||
|
|
||||||
RunOnceEvery(2, {baro_periodic();});
|
RunOnceEvery(2, {baro_periodic();});
|
||||||
LED_PERIODIC();
|
LED_PERIODIC();
|
||||||
RunOnceEvery(256, {DOWNLINK_SEND_ALIVE(DefaultChannel, 16, MD5SUM);});
|
RunOnceEvery(256, {DOWNLINK_SEND_ALIVE(DefaultChannel, DefaultDevice, 16, MD5SUM);});
|
||||||
RunOnceEvery(256,
|
RunOnceEvery(256,
|
||||||
{
|
{
|
||||||
DOWNLINK_SEND_I2C_ERRORS(DefaultChannel,
|
DOWNLINK_SEND_I2C_ERRORS(DefaultChannel, DefaultDevice,
|
||||||
&i2c2_errors.ack_fail_cnt,
|
&i2c2_errors.ack_fail_cnt,
|
||||||
&i2c2_errors.miss_start_stop_cnt,
|
&i2c2_errors.miss_start_stop_cnt,
|
||||||
&i2c2_errors.arb_lost_cnt,
|
&i2c2_errors.arb_lost_cnt,
|
||||||
@@ -104,5 +104,5 @@ static inline void main_on_baro_diff(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static inline void main_on_baro_abs(void) {
|
static inline void main_on_baro_abs(void) {
|
||||||
RunOnceEvery(5,{DOWNLINK_SEND_BARO_RAW(DefaultChannel, &baro.absolute, &baro.differential);});
|
RunOnceEvery(5,{DOWNLINK_SEND_BARO_RAW(DefaultChannel, DefaultDevice, &baro.absolute, &baro.differential);});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -75,10 +75,10 @@ static inline void main_periodic_task( void ) {
|
|||||||
|
|
||||||
RunOnceEvery(2, {baro_periodic();});
|
RunOnceEvery(2, {baro_periodic();});
|
||||||
LED_PERIODIC();
|
LED_PERIODIC();
|
||||||
RunOnceEvery(256, {DOWNLINK_SEND_ALIVE(DefaultChannel, 16, MD5SUM);});
|
RunOnceEvery(256, {DOWNLINK_SEND_ALIVE(DefaultChannel, DefaultDevice, 16, MD5SUM);});
|
||||||
RunOnceEvery(256,
|
RunOnceEvery(256,
|
||||||
{
|
{
|
||||||
DOWNLINK_SEND_I2C_ERRORS(DefaultChannel,
|
DOWNLINK_SEND_I2C_ERRORS(DefaultChannel, DefaultDevice,
|
||||||
&i2c2_errors.ack_fail_cnt,
|
&i2c2_errors.ack_fail_cnt,
|
||||||
&i2c2_errors.miss_start_stop_cnt,
|
&i2c2_errors.miss_start_stop_cnt,
|
||||||
&i2c2_errors.arb_lost_cnt,
|
&i2c2_errors.arb_lost_cnt,
|
||||||
@@ -104,5 +104,5 @@ static inline void main_on_baro_diff(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static inline void main_on_baro_abs(void) {
|
static inline void main_on_baro_abs(void) {
|
||||||
RunOnceEvery(5,{DOWNLINK_SEND_BARO_RAW(DefaultChannel, &baro.absolute, &baro.differential);});
|
RunOnceEvery(5,{DOWNLINK_SEND_BARO_RAW(DefaultChannel, DefaultDevice, &baro.absolute, &baro.differential);});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -91,9 +91,9 @@ void imu_periodic( void )
|
|||||||
|
|
||||||
void imu_navgo_downlink_raw( void )
|
void imu_navgo_downlink_raw( void )
|
||||||
{
|
{
|
||||||
DOWNLINK_SEND_IMU_GYRO_RAW(DefaultChannel,&imu.gyro_unscaled.p,&imu.gyro_unscaled.q,&imu.gyro_unscaled.r);
|
DOWNLINK_SEND_IMU_GYRO_RAW(DefaultChannel, DefaultDevice,&imu.gyro_unscaled.p,&imu.gyro_unscaled.q,&imu.gyro_unscaled.r);
|
||||||
DOWNLINK_SEND_IMU_ACCEL_RAW(DefaultChannel,&imu.accel_unscaled.x,&imu.accel_unscaled.y,&imu.accel_unscaled.z);
|
DOWNLINK_SEND_IMU_ACCEL_RAW(DefaultChannel, DefaultDevice,&imu.accel_unscaled.x,&imu.accel_unscaled.y,&imu.accel_unscaled.z);
|
||||||
DOWNLINK_SEND_IMU_MAG_RAW(DefaultChannel,&imu.mag_unscaled.x,&imu.mag_unscaled.y,&imu.mag_unscaled.z);
|
DOWNLINK_SEND_IMU_MAG_RAW(DefaultChannel, DefaultDevice,&imu.mag_unscaled.x,&imu.mag_unscaled.y,&imu.mag_unscaled.z);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -80,6 +80,6 @@ void baro_periodic( void ) {
|
|||||||
|
|
||||||
void baro_downlink_raw( void )
|
void baro_downlink_raw( void )
|
||||||
{
|
{
|
||||||
DOWNLINK_SEND_BARO_RAW(DefaultChannel,&baro.absolute,&baro.differential);
|
DOWNLINK_SEND_BARO_RAW(DefaultChannel, DefaultDevice,&baro.absolute,&baro.differential);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -80,8 +80,8 @@ void imu_periodic( void )
|
|||||||
|
|
||||||
void imu_umarim_downlink_raw( void )
|
void imu_umarim_downlink_raw( void )
|
||||||
{
|
{
|
||||||
DOWNLINK_SEND_IMU_GYRO_RAW(DefaultChannel,&imu.gyro_unscaled.p,&imu.gyro_unscaled.q,&imu.gyro_unscaled.r);
|
DOWNLINK_SEND_IMU_GYRO_RAW(DefaultChannel, DefaultDevice,&imu.gyro_unscaled.p,&imu.gyro_unscaled.q,&imu.gyro_unscaled.r);
|
||||||
DOWNLINK_SEND_IMU_ACCEL_RAW(DefaultChannel,&imu.accel_unscaled.x,&imu.accel_unscaled.y,&imu.accel_unscaled.z);
|
DOWNLINK_SEND_IMU_ACCEL_RAW(DefaultChannel, DefaultDevice,&imu.accel_unscaled.x,&imu.accel_unscaled.y,&imu.accel_unscaled.z);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ static inline void main_periodic_task( void ) {
|
|||||||
i2c0_buf[0] = thrust;
|
i2c0_buf[0] = thrust;
|
||||||
i2c0_transmit(motor_addr[motor], 1, &i2c_done);
|
i2c0_transmit(motor_addr[motor], 1, &i2c_done);
|
||||||
|
|
||||||
RunOnceEvery(128, { DOWNLINK_SEND_ALIVE(DefaultChannel, 16, MD5SUM);});
|
RunOnceEvery(128, { DOWNLINK_SEND_ALIVE(DefaultChannel, DefaultDevice, 16, MD5SUM);});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ static inline void main_init( void ) {
|
|||||||
|
|
||||||
static inline void main_periodic_task( void ) {
|
static inline void main_periodic_task( void ) {
|
||||||
|
|
||||||
RunOnceEvery(128, { DOWNLINK_SEND_ALIVE(DefaultChannel, 16, MD5SUM);});
|
RunOnceEvery(128, { DOWNLINK_SEND_ALIVE(DefaultChannel, DefaultDevice, 16, MD5SUM);});
|
||||||
RunOnceEvery(128, { LED_PERIODIC();});
|
RunOnceEvery(128, { LED_PERIODIC();});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -67,7 +67,7 @@ static inline void main_event_task( void ) {
|
|||||||
|
|
||||||
static void on_gps_sol(void) {
|
static void on_gps_sol(void) {
|
||||||
|
|
||||||
DOWNLINK_SEND_GPS_INT( DefaultChannel,
|
DOWNLINK_SEND_GPS_INT( DefaultChannel, DefaultDevice,
|
||||||
&gps.ecef_pos.x,
|
&gps.ecef_pos.x,
|
||||||
&gps.ecef_pos.y,
|
&gps.ecef_pos.y,
|
||||||
&gps.ecef_pos.z,
|
&gps.ecef_pos.z,
|
||||||
|
|||||||
@@ -73,9 +73,9 @@ static inline void main_periodic_task( void ) {
|
|||||||
static inline void main_event_task( void ) {
|
static inline void main_event_task( void ) {
|
||||||
if (max1168_status == STA_MAX1168_DATA_AVAILABLE) {
|
if (max1168_status == STA_MAX1168_DATA_AVAILABLE) {
|
||||||
RunOnceEvery(10, {
|
RunOnceEvery(10, {
|
||||||
DOWNLINK_SEND_IMU_GYRO_RAW(DefaultChannel, &max1168_values[0], &max1168_values[1], &max1168_values[2]);
|
DOWNLINK_SEND_IMU_GYRO_RAW(DefaultChannel, DefaultDevice, &max1168_values[0], &max1168_values[1], &max1168_values[2]);
|
||||||
DOWNLINK_SEND_IMU_ACCEL_RAW(DefaultChannel, &max1168_values[3], &max1168_values[4], &max1168_values[6]);
|
DOWNLINK_SEND_IMU_ACCEL_RAW(DefaultChannel, DefaultDevice, &max1168_values[3], &max1168_values[4], &max1168_values[6]);
|
||||||
DOWNLINK_SEND_BOOT(DefaultChannel, &max1168_values[7]); });
|
DOWNLINK_SEND_BOOT(DefaultChannel, DefaultDevice, &max1168_values[7]); });
|
||||||
max1168_status = STA_MAX1168_IDLE;
|
max1168_status = STA_MAX1168_IDLE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,14 +62,14 @@ static inline void main_periodic_task( void ) {
|
|||||||
RunOnceEvery(51, {
|
RunOnceEvery(51, {
|
||||||
/*LED_TOGGLE(2);*/
|
/*LED_TOGGLE(2);*/
|
||||||
uint32_t blaaa= cpu_time_sec;
|
uint32_t blaaa= cpu_time_sec;
|
||||||
DOWNLINK_SEND_TIME(DefaultChannel, &blaaa);
|
DOWNLINK_SEND_TIME(DefaultChannel, DefaultDevice, &blaaa);
|
||||||
});
|
});
|
||||||
|
|
||||||
RunOnceEvery(10, {radio_control_periodic_task();});
|
RunOnceEvery(10, {radio_control_periodic_task();});
|
||||||
|
|
||||||
int16_t foo = 0;//RC_PPM_SIGNED_TICS_OF_USEC(2050-1500);
|
int16_t foo = 0;//RC_PPM_SIGNED_TICS_OF_USEC(2050-1500);
|
||||||
RunOnceEvery(10,
|
RunOnceEvery(10,
|
||||||
{DOWNLINK_SEND_BOOZ2_RADIO_CONTROL(DefaultChannel, \
|
{DOWNLINK_SEND_BOOZ2_RADIO_CONTROL(DefaultChannel, DefaultDevice, \
|
||||||
&radio_control.values[RADIO_ROLL], \
|
&radio_control.values[RADIO_ROLL], \
|
||||||
&radio_control.values[RADIO_PITCH], \
|
&radio_control.values[RADIO_PITCH], \
|
||||||
&radio_control.values[RADIO_YAW], \
|
&radio_control.values[RADIO_YAW], \
|
||||||
@@ -79,7 +79,7 @@ static inline void main_periodic_task( void ) {
|
|||||||
&radio_control.status);});
|
&radio_control.status);});
|
||||||
#ifdef RADIO_CONTROL_TYPE_PPM
|
#ifdef RADIO_CONTROL_TYPE_PPM
|
||||||
RunOnceEvery(10,
|
RunOnceEvery(10,
|
||||||
{uint8_t blaa = 0; DOWNLINK_SEND_PPM(DefaultChannel,&blaa, 8, booz_radio_control_ppm_pulses);});
|
{uint8_t blaa = 0; DOWNLINK_SEND_PPM(DefaultChannel, DefaultDevice,&blaa, 8, booz_radio_control_ppm_pulses);});
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
LED_PERIODIC();
|
LED_PERIODIC();
|
||||||
|
|||||||
@@ -78,11 +78,11 @@ static inline void led_toggle ( void ) {
|
|||||||
static inline void main_periodic_task( void ) {
|
static inline void main_periodic_task( void ) {
|
||||||
RunOnceEvery(100, {
|
RunOnceEvery(100, {
|
||||||
led_toggle();
|
led_toggle();
|
||||||
DOWNLINK_SEND_ALIVE(DefaultChannel, 16, MD5SUM);
|
DOWNLINK_SEND_ALIVE(DefaultChannel, DefaultDevice, 16, MD5SUM);
|
||||||
});
|
});
|
||||||
#ifdef USE_I2C2
|
#ifdef USE_I2C2
|
||||||
RunOnceEvery(111, {
|
RunOnceEvery(111, {
|
||||||
DOWNLINK_SEND_I2C_ERRORS(DefaultChannel,
|
DOWNLINK_SEND_I2C_ERRORS(DefaultChannel, DefaultDevice,
|
||||||
&i2c2_errors.ack_fail_cnt,
|
&i2c2_errors.ack_fail_cnt,
|
||||||
&i2c2_errors.miss_start_stop_cnt,
|
&i2c2_errors.miss_start_stop_cnt,
|
||||||
&i2c2_errors.arb_lost_cnt,
|
&i2c2_errors.arb_lost_cnt,
|
||||||
@@ -112,13 +112,13 @@ static inline void on_accel_event(void) {
|
|||||||
cnt++;
|
cnt++;
|
||||||
if (cnt > 15) cnt = 0;
|
if (cnt > 15) cnt = 0;
|
||||||
if (cnt == 0) {
|
if (cnt == 0) {
|
||||||
DOWNLINK_SEND_IMU_ACCEL_RAW(DefaultChannel,
|
DOWNLINK_SEND_IMU_ACCEL_RAW(DefaultChannel, DefaultDevice,
|
||||||
&imu.accel_unscaled.x,
|
&imu.accel_unscaled.x,
|
||||||
&imu.accel_unscaled.y,
|
&imu.accel_unscaled.y,
|
||||||
&imu.accel_unscaled.z);
|
&imu.accel_unscaled.z);
|
||||||
}
|
}
|
||||||
else if (cnt == 7) {
|
else if (cnt == 7) {
|
||||||
DOWNLINK_SEND_IMU_ACCEL_SCALED(DefaultChannel,
|
DOWNLINK_SEND_IMU_ACCEL_SCALED(DefaultChannel, DefaultDevice,
|
||||||
&imu.accel.x,
|
&imu.accel.x,
|
||||||
&imu.accel.y,
|
&imu.accel.y,
|
||||||
&imu.accel.z);
|
&imu.accel.z);
|
||||||
@@ -134,13 +134,13 @@ static inline void on_gyro_accel_event(void) {
|
|||||||
if (cnt > 15) cnt = 0;
|
if (cnt > 15) cnt = 0;
|
||||||
|
|
||||||
if (cnt == 0) {
|
if (cnt == 0) {
|
||||||
DOWNLINK_SEND_IMU_GYRO_RAW(DefaultChannel,
|
DOWNLINK_SEND_IMU_GYRO_RAW(DefaultChannel, DefaultDevice,
|
||||||
&imu.gyro_unscaled.p,
|
&imu.gyro_unscaled.p,
|
||||||
&imu.gyro_unscaled.q,
|
&imu.gyro_unscaled.q,
|
||||||
&imu.gyro_unscaled.r);
|
&imu.gyro_unscaled.r);
|
||||||
}
|
}
|
||||||
else if (cnt == 7) {
|
else if (cnt == 7) {
|
||||||
DOWNLINK_SEND_IMU_GYRO_SCALED(DefaultChannel,
|
DOWNLINK_SEND_IMU_GYRO_SCALED(DefaultChannel, DefaultDevice,
|
||||||
&imu.gyro.p,
|
&imu.gyro.p,
|
||||||
&imu.gyro.q,
|
&imu.gyro.q,
|
||||||
&imu.gyro.r);
|
&imu.gyro.r);
|
||||||
@@ -155,13 +155,13 @@ static inline void on_mag_event(void) {
|
|||||||
if (cnt > 10) cnt = 0;
|
if (cnt > 10) cnt = 0;
|
||||||
|
|
||||||
if (cnt == 0) {
|
if (cnt == 0) {
|
||||||
DOWNLINK_SEND_IMU_MAG_SCALED(DefaultChannel,
|
DOWNLINK_SEND_IMU_MAG_SCALED(DefaultChannel, DefaultDevice,
|
||||||
&imu.mag.x,
|
&imu.mag.x,
|
||||||
&imu.mag.y,
|
&imu.mag.y,
|
||||||
&imu.mag.z);
|
&imu.mag.z);
|
||||||
}
|
}
|
||||||
else if (cnt == 5) {
|
else if (cnt == 5) {
|
||||||
DOWNLINK_SEND_IMU_MAG_RAW(DefaultChannel,
|
DOWNLINK_SEND_IMU_MAG_RAW(DefaultChannel, DefaultDevice,
|
||||||
&imu.mag_unscaled.x,
|
&imu.mag_unscaled.x,
|
||||||
&imu.mag_unscaled.y,
|
&imu.mag_unscaled.y,
|
||||||
&imu.mag_unscaled.z);
|
&imu.mag_unscaled.z);
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ static inline void main_init( void ) {
|
|||||||
|
|
||||||
static inline void main_periodic_task( void ) {
|
static inline void main_periodic_task( void ) {
|
||||||
LED_TOGGLE(2);
|
LED_TOGGLE(2);
|
||||||
DOWNLINK_SEND_TIME(DefaultChannel, &cpu_time_sec);
|
DOWNLINK_SEND_TIME(DefaultChannel, DefaultDevice, &cpu_time_sec);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void main_event_task( void ) {
|
static inline void main_event_task( void ) {
|
||||||
|
|||||||
@@ -60,12 +60,12 @@
|
|||||||
extern uint8_t telemetry_mode_Ap_DefaultChannel;
|
extern uint8_t telemetry_mode_Ap_DefaultChannel;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define PERIODIC_SEND_ALIVE(_chan) DOWNLINK_SEND_ALIVE(_chan, 16, MD5SUM);
|
#define PERIODIC_SEND_ALIVE(_trans, _dev) DOWNLINK_SEND_ALIVE(_trans, _dev, 16, MD5SUM);
|
||||||
|
|
||||||
#define PERIODIC_SEND_BAT(_chan) { \
|
#define PERIODIC_SEND_BAT(_trans, _dev) { \
|
||||||
int16_t amps = (int16_t) (current/10); \
|
int16_t amps = (int16_t) (current/10); \
|
||||||
Downlink({ int16_t e = energy; \
|
Downlink({ int16_t e = energy; \
|
||||||
DOWNLINK_SEND_BAT(_chan, \
|
DOWNLINK_SEND_BAT(_trans, _dev, \
|
||||||
&v_ctl_throttle_slewed, \
|
&v_ctl_throttle_slewed, \
|
||||||
&vsupply, \
|
&vsupply, \
|
||||||
&s, \
|
&s, \
|
||||||
@@ -78,180 +78,180 @@ extern uint8_t telemetry_mode_Ap_DefaultChannel;
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef MCU_SPI_LINK
|
#ifdef MCU_SPI_LINK
|
||||||
#define PERIODIC_SEND_DEBUG_MCU_LINK(_chan) DOWNLINK_SEND_DEBUG_MCU_LINK(_chan, &link_mcu_nb_err, &link_mcu_fbw_nb_err, &mcu1_ppm_cpt);
|
#define PERIODIC_SEND_DEBUG_MCU_LINK(_trans, _dev) DOWNLINK_SEND_DEBUG_MCU_LINK(_trans, _dev, &link_mcu_nb_err, &link_mcu_fbw_nb_err, &mcu1_ppm_cpt);
|
||||||
#else
|
#else
|
||||||
#define PERIODIC_SEND_DEBUG_MCU_LINK(_chan) {}
|
#define PERIODIC_SEND_DEBUG_MCU_LINK(_trans, _dev) {}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#define PERIODIC_SEND_DOWNLINK(_chan) { \
|
#define PERIODIC_SEND_DOWNLINK(_trans, _dev) { \
|
||||||
static uint16_t last; \
|
static uint16_t last; \
|
||||||
uint16_t rate = (downlink_nb_bytes - last) / PERIOD_DOWNLINK_Ap_DefaultChannel_0; \
|
uint16_t rate = (downlink_nb_bytes - last) / PERIOD_DOWNLINK_Ap_DefaultChannel_0; \
|
||||||
last = downlink_nb_bytes; \
|
last = downlink_nb_bytes; \
|
||||||
DOWNLINK_SEND_DOWNLINK(_chan, &downlink_nb_ovrn, &rate, &downlink_nb_msgs); \
|
DOWNLINK_SEND_DOWNLINK(_trans, _dev, &downlink_nb_ovrn, &rate, &downlink_nb_msgs); \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#define PERIODIC_SEND_ATTITUDE(_chan) Downlink({ \
|
#define PERIODIC_SEND_ATTITUDE(_trans, _dev) Downlink({ \
|
||||||
DOWNLINK_SEND_ATTITUDE(_chan, &estimator_phi, &estimator_psi, &estimator_theta); \
|
DOWNLINK_SEND_ATTITUDE(_trans, _dev, &estimator_phi, &estimator_psi, &estimator_theta); \
|
||||||
})
|
})
|
||||||
|
|
||||||
#define PERIODIC_SEND_PPRZ_MODE(_chan) DOWNLINK_SEND_PPRZ_MODE(_chan, &pprz_mode, &v_ctl_mode, &lateral_mode, &horizontal_mode, &rc_settings_mode, &mcu1_status);
|
#define PERIODIC_SEND_PPRZ_MODE(_trans, _dev) DOWNLINK_SEND_PPRZ_MODE(_trans, _dev, &pprz_mode, &v_ctl_mode, &lateral_mode, &horizontal_mode, &rc_settings_mode, &mcu1_status);
|
||||||
#define PERIODIC_SEND_DESIRED(_chan) DOWNLINK_SEND_DESIRED(_chan, &h_ctl_roll_setpoint, &h_ctl_pitch_loop_setpoint, &h_ctl_course_setpoint, &desired_x, &desired_y, &v_ctl_altitude_setpoint, &v_ctl_climb_setpoint);
|
#define PERIODIC_SEND_DESIRED(_trans, _dev) DOWNLINK_SEND_DESIRED(_trans, _dev, &h_ctl_roll_setpoint, &h_ctl_pitch_loop_setpoint, &h_ctl_course_setpoint, &desired_x, &desired_y, &v_ctl_altitude_setpoint, &v_ctl_climb_setpoint);
|
||||||
|
|
||||||
#ifdef USE_INFRARED
|
#ifdef USE_INFRARED
|
||||||
#define PERIODIC_SEND_STATE_FILTER_STATUS(_chan) { uint16_t contrast = abs(infrared.roll) + abs(infrared.pitch) + abs(infrared.top); uint8_t mde = 3; if (contrast < 50) mde = 7; DOWNLINK_SEND_STATE_FILTER_STATUS(_chan, &mde, &contrast); }
|
#define PERIODIC_SEND_STATE_FILTER_STATUS(_trans, _dev) { uint16_t contrast = abs(infrared.roll) + abs(infrared.pitch) + abs(infrared.top); uint8_t mde = 3; if (contrast < 50) mde = 7; DOWNLINK_SEND_STATE_FILTER_STATUS(_trans, _dev, &mde, &contrast); }
|
||||||
#elif defined USE_IMU && defined USE_AHRS
|
#elif defined USE_IMU && defined USE_AHRS
|
||||||
#define PERIODIC_SEND_STATE_FILTER_STATUS(_chan) { uint8_t mde = 3; if (ahrs.status == AHRS_UNINIT) mde = 2; if (ahrs_timeout_counter > 10) mde = 5; uint16_t val = 0; DOWNLINK_SEND_STATE_FILTER_STATUS(_chan, &mde, &val); }
|
#define PERIODIC_SEND_STATE_FILTER_STATUS(_trans, _dev) { uint8_t mde = 3; if (ahrs.status == AHRS_UNINIT) mde = 2; if (ahrs_timeout_counter > 10) mde = 5; uint16_t val = 0; DOWNLINK_SEND_STATE_FILTER_STATUS(_trans, _dev, &mde, &val); }
|
||||||
#else
|
#else
|
||||||
#define PERIODIC_SEND_STATE_FILTER_STATUS(_chan) {}
|
#define PERIODIC_SEND_STATE_FILTER_STATUS(_trans, _dev) {}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define PERIODIC_SEND_NAVIGATION_REF(_chan) DOWNLINK_SEND_NAVIGATION_REF(_chan, &nav_utm_east0, &nav_utm_north0, &nav_utm_zone0);
|
#define PERIODIC_SEND_NAVIGATION_REF(_trans, _dev) DOWNLINK_SEND_NAVIGATION_REF(_trans, _dev, &nav_utm_east0, &nav_utm_north0, &nav_utm_zone0);
|
||||||
|
|
||||||
|
|
||||||
#define DownlinkSendWp(_chan, i) { \
|
#define DownlinkSendWp(_trans, _dev, i) { \
|
||||||
float x = nav_utm_east0 + waypoints[i].x; \
|
float x = nav_utm_east0 + waypoints[i].x; \
|
||||||
float y = nav_utm_north0 + waypoints[i].y; \
|
float y = nav_utm_north0 + waypoints[i].y; \
|
||||||
DOWNLINK_SEND_WP_MOVED(_chan, &i, &x, &y, &(waypoints[i].a),&nav_utm_zone0); \
|
DOWNLINK_SEND_WP_MOVED(_trans, _dev, &i, &x, &y, &(waypoints[i].a),&nav_utm_zone0); \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#define PERIODIC_SEND_WP_MOVED(_chan) { \
|
#define PERIODIC_SEND_WP_MOVED(_trans, _dev) { \
|
||||||
static uint8_t i; \
|
static uint8_t i; \
|
||||||
i++; if (i >= nb_waypoint) i = 0; \
|
i++; if (i >= nb_waypoint) i = 0; \
|
||||||
DownlinkSendWp(_chan, i); \
|
DownlinkSendWp(_trans, _dev, i); \
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef RADIO_CONTROL_SETTINGS
|
#ifdef RADIO_CONTROL_SETTINGS
|
||||||
#define PERIODIC_SEND_SETTINGS(_chan) if (!RcSettingsOff()) DOWNLINK_SEND_SETTINGS(_chan, &slider_1_val, &slider_2_val);
|
#define PERIODIC_SEND_SETTINGS(_trans, _dev) if (!RcSettingsOff()) DOWNLINK_SEND_SETTINGS(_trans, _dev, &slider_1_val, &slider_2_val);
|
||||||
#else
|
#else
|
||||||
#define PERIODIC_SEND_SETTINGS(_chan) {}
|
#define PERIODIC_SEND_SETTINGS(_trans, _dev) {}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined USE_INFRARED || USE_INFRARED_TELEMETRY
|
#if defined USE_INFRARED || USE_INFRARED_TELEMETRY
|
||||||
#include "subsystems/sensors/infrared.h"
|
#include "subsystems/sensors/infrared.h"
|
||||||
#define PERIODIC_SEND_IR_SENSORS(_chan) DOWNLINK_SEND_IR_SENSORS(_chan, &infrared.value.ir1, &infrared.value.ir2, &infrared.pitch, &infrared.roll, &infrared.top);
|
#define PERIODIC_SEND_IR_SENSORS(_trans, _dev) DOWNLINK_SEND_IR_SENSORS(_trans, _dev, &infrared.value.ir1, &infrared.value.ir2, &infrared.pitch, &infrared.roll, &infrared.top);
|
||||||
#else
|
#else
|
||||||
#define PERIODIC_SEND_IR_SENSORS(_chan) ;
|
#define PERIODIC_SEND_IR_SENSORS(_trans, _dev) ;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define PERIODIC_SEND_ADC(_chan) {}
|
#define PERIODIC_SEND_ADC(_trans, _dev) {}
|
||||||
|
|
||||||
|
|
||||||
#define PERIODIC_SEND_CALIBRATION(_chan) DOWNLINK_SEND_CALIBRATION(_chan, &v_ctl_auto_throttle_sum_err, &v_ctl_auto_throttle_submode)
|
#define PERIODIC_SEND_CALIBRATION(_trans, _dev) DOWNLINK_SEND_CALIBRATION(_trans, _dev, &v_ctl_auto_throttle_sum_err, &v_ctl_auto_throttle_submode)
|
||||||
|
|
||||||
#define PERIODIC_SEND_CIRCLE(_chan) if (nav_in_circle) { DOWNLINK_SEND_CIRCLE(_chan, &nav_circle_x, &nav_circle_y, &nav_circle_radius); }
|
#define PERIODIC_SEND_CIRCLE(_trans, _dev) if (nav_in_circle) { DOWNLINK_SEND_CIRCLE(_trans, _dev, &nav_circle_x, &nav_circle_y, &nav_circle_radius); }
|
||||||
|
|
||||||
#define PERIODIC_SEND_SEGMENT(_chan) if (nav_in_segment) { DOWNLINK_SEND_SEGMENT(_chan, &nav_segment_x_1, &nav_segment_y_1, &nav_segment_x_2, &nav_segment_y_2); }
|
#define PERIODIC_SEND_SEGMENT(_trans, _dev) if (nav_in_segment) { DOWNLINK_SEND_SEGMENT(_trans, _dev, &nav_segment_x_1, &nav_segment_y_1, &nav_segment_x_2, &nav_segment_y_2); }
|
||||||
|
|
||||||
#ifdef IMU_TYPE_H
|
#ifdef IMU_TYPE_H
|
||||||
# ifdef INS_MODULE_H
|
# ifdef INS_MODULE_H
|
||||||
# include "modules/ins/ins_module.h"
|
# include "modules/ins/ins_module.h"
|
||||||
# define PERIODIC_SEND_IMU_ACCEL_RAW(_chan) {}
|
# define PERIODIC_SEND_IMU_ACCEL_RAW(_trans, _dev) {}
|
||||||
# define PERIODIC_SEND_IMU_GYRO_RAW(_chan) {}
|
# define PERIODIC_SEND_IMU_GYRO_RAW(_trans, _dev) {}
|
||||||
# define PERIODIC_SEND_IMU_MAG_RAW(_chan) {}
|
# define PERIODIC_SEND_IMU_MAG_RAW(_trans, _dev) {}
|
||||||
# define PERIODIC_SEND_IMU_GYRO(_chan) { DOWNLINK_SEND_IMU_GYRO(_chan, &ins_p, &ins_q, &ins_r)}
|
# define PERIODIC_SEND_IMU_GYRO(_trans, _dev) { DOWNLINK_SEND_IMU_GYRO(_trans, _dev, &ins_p, &ins_q, &ins_r)}
|
||||||
# define PERIODIC_SEND_IMU_ACCEL(_chan) { DOWNLINK_SEND_IMU_ACCEL(_chan, &ins_ax, &ins_ay, &ins_az)}
|
# define PERIODIC_SEND_IMU_ACCEL(_trans, _dev) { DOWNLINK_SEND_IMU_ACCEL(_trans, _dev, &ins_ax, &ins_ay, &ins_az)}
|
||||||
# define PERIODIC_SEND_IMU_MAG(_chan) { DOWNLINK_SEND_IMU_MAG(_chan, &ins_mx, &ins_my, &ins_mz)}
|
# define PERIODIC_SEND_IMU_MAG(_trans, _dev) { DOWNLINK_SEND_IMU_MAG(_trans, _dev, &ins_mx, &ins_my, &ins_mz)}
|
||||||
# else
|
# else
|
||||||
# include "subsystems/imu.h"
|
# include "subsystems/imu.h"
|
||||||
# define PERIODIC_SEND_IMU_ACCEL_RAW(_chan) { DOWNLINK_SEND_IMU_ACCEL_RAW(_chan, &imu.accel_unscaled.x, &imu.accel_unscaled.y, &imu.accel_unscaled.z)}
|
# define PERIODIC_SEND_IMU_ACCEL_RAW(_trans, _dev) { DOWNLINK_SEND_IMU_ACCEL_RAW(_trans, _dev, &imu.accel_unscaled.x, &imu.accel_unscaled.y, &imu.accel_unscaled.z)}
|
||||||
# define PERIODIC_SEND_IMU_GYRO_RAW(_chan) { DOWNLINK_SEND_IMU_GYRO_RAW(_chan, &imu.gyro_unscaled.p, &imu.gyro_unscaled.q, &imu.gyro_unscaled.r)}
|
# define PERIODIC_SEND_IMU_GYRO_RAW(_trans, _dev) { DOWNLINK_SEND_IMU_GYRO_RAW(_trans, _dev, &imu.gyro_unscaled.p, &imu.gyro_unscaled.q, &imu.gyro_unscaled.r)}
|
||||||
# define PERIODIC_SEND_IMU_MAG_RAW(_chan) { DOWNLINK_SEND_IMU_MAG_RAW(_chan, &imu.mag_unscaled.x, &imu.mag_unscaled.y, &imu.mag_unscaled.z)}
|
# define PERIODIC_SEND_IMU_MAG_RAW(_trans, _dev) { DOWNLINK_SEND_IMU_MAG_RAW(_trans, _dev, &imu.mag_unscaled.x, &imu.mag_unscaled.y, &imu.mag_unscaled.z)}
|
||||||
# define PERIODIC_SEND_IMU_ACCEL(_chan) { struct FloatVect3 accel_float; ACCELS_FLOAT_OF_BFP(accel_float, imu.accel); DOWNLINK_SEND_IMU_ACCEL(_chan, &accel_float.x, &accel_float.y, &accel_float.z)}
|
# define PERIODIC_SEND_IMU_ACCEL(_trans, _dev) { struct FloatVect3 accel_float; ACCELS_FLOAT_OF_BFP(accel_float, imu.accel); DOWNLINK_SEND_IMU_ACCEL(_trans, _dev, &accel_float.x, &accel_float.y, &accel_float.z)}
|
||||||
# define PERIODIC_SEND_IMU_GYRO(_chan) { struct FloatRates gyro_float; RATES_FLOAT_OF_BFP(gyro_float, imu.gyro); DOWNLINK_SEND_IMU_GYRO(_chan, &gyro_float.p, &gyro_float.q, &gyro_float.r)}
|
# define PERIODIC_SEND_IMU_GYRO(_trans, _dev) { struct FloatRates gyro_float; RATES_FLOAT_OF_BFP(gyro_float, imu.gyro); DOWNLINK_SEND_IMU_GYRO(_trans, _dev, &gyro_float.p, &gyro_float.q, &gyro_float.r)}
|
||||||
# ifdef USE_MAGNETOMETER
|
# ifdef USE_MAGNETOMETER
|
||||||
# define PERIODIC_SEND_IMU_MAG(_chan) { struct FloatVect3 mag_float; MAGS_FLOAT_OF_BFP(mag_float, imu.mag); DOWNLINK_SEND_IMU_MAG(_chan, &mag_float.x, &mag_float.y, &mag_float.z)}
|
# define PERIODIC_SEND_IMU_MAG(_trans, _dev) { struct FloatVect3 mag_float; MAGS_FLOAT_OF_BFP(mag_float, imu.mag); DOWNLINK_SEND_IMU_MAG(_trans, _dev, &mag_float.x, &mag_float.y, &mag_float.z)}
|
||||||
# else
|
# else
|
||||||
# define PERIODIC_SEND_IMU_MAG(_chan) {}
|
# define PERIODIC_SEND_IMU_MAG(_trans, _dev) {}
|
||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
#else
|
#else
|
||||||
# define PERIODIC_SEND_IMU_ACCEL_RAW(_chan) {}
|
# define PERIODIC_SEND_IMU_ACCEL_RAW(_trans, _dev) {}
|
||||||
# define PERIODIC_SEND_IMU_GYRO_RAW(_chan) {}
|
# define PERIODIC_SEND_IMU_GYRO_RAW(_trans, _dev) {}
|
||||||
# define PERIODIC_SEND_IMU_MAG_RAW(_chan) {}
|
# define PERIODIC_SEND_IMU_MAG_RAW(_trans, _dev) {}
|
||||||
# define PERIODIC_SEND_IMU_ACCEL(_chan) {}
|
# define PERIODIC_SEND_IMU_ACCEL(_trans, _dev) {}
|
||||||
# define PERIODIC_SEND_IMU_GYRO(_chan) {}
|
# define PERIODIC_SEND_IMU_GYRO(_trans, _dev) {}
|
||||||
# define PERIODIC_SEND_IMU_MAG(_chan) {}
|
# define PERIODIC_SEND_IMU_MAG(_trans, _dev) {}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef IMU_ANALOG
|
#ifdef IMU_ANALOG
|
||||||
#define PERIODIC_SEND_IMU(_chan) { int16_t dummy = 42; DOWNLINK_SEND_IMU(_chan, &(from_fbw.euler_dot[0]), &(from_fbw.euler_dot[1]), &(from_fbw.euler_dot[2]), &dummy, &dummy, &dummy); }
|
#define PERIODIC_SEND_IMU(_trans, _dev) { int16_t dummy = 42; DOWNLINK_SEND_IMU(_trans, _dev, &(from_fbw.euler_dot[0]), &(from_fbw.euler_dot[1]), &(from_fbw.euler_dot[2]), &dummy, &dummy, &dummy); }
|
||||||
#else
|
#else
|
||||||
#define PERIODIC_SEND_IMU(_chan) {}
|
#define PERIODIC_SEND_IMU(_trans, _dev) {}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define PERIODIC_SEND_ESTIMATOR(_chan) DOWNLINK_SEND_ESTIMATOR(_chan, &estimator_z, &estimator_z_dot)
|
#define PERIODIC_SEND_ESTIMATOR(_trans, _dev) DOWNLINK_SEND_ESTIMATOR(_trans, _dev, &estimator_z, &estimator_z_dot)
|
||||||
|
|
||||||
#define SEND_NAVIGATION(_chan) Downlink({ uint8_t _circle_count = NavCircleCount(); DOWNLINK_SEND_NAVIGATION(_chan, &nav_block, &nav_stage, &estimator_x, &estimator_y, &dist2_to_wp, &dist2_to_home, &_circle_count, &nav_oval_count);})
|
#define SEND_NAVIGATION(_trans, _dev) Downlink({ uint8_t _circle_count = NavCircleCount(); DOWNLINK_SEND_NAVIGATION(_trans, _dev, &nav_block, &nav_stage, &estimator_x, &estimator_y, &dist2_to_wp, &dist2_to_home, &_circle_count, &nav_oval_count);})
|
||||||
|
|
||||||
#define PERIODIC_SEND_NAVIGATION(_chan) SEND_NAVIGATION(_chan)
|
#define PERIODIC_SEND_NAVIGATION(_trans, _dev) SEND_NAVIGATION(_trans, _dev)
|
||||||
|
|
||||||
|
|
||||||
#if defined CAM || defined MOBILE_CAM
|
#if defined CAM || defined MOBILE_CAM
|
||||||
#define SEND_CAM(_chan) Downlink({ int16_t x = cam_target_x; int16_t y = cam_target_y; int16_t phi = DegOfRad(cam_phi_c); int16_t theta = DegOfRad(cam_theta_c); DOWNLINK_SEND_CAM(_chan, &phi, &theta, &x, &y);})
|
#define SEND_CAM(_trans, _dev) Downlink({ int16_t x = cam_target_x; int16_t y = cam_target_y; int16_t phi = DegOfRad(cam_phi_c); int16_t theta = DegOfRad(cam_theta_c); DOWNLINK_SEND_CAM(_trans, _dev, &phi, &theta, &x, &y);})
|
||||||
#define PERIODIC_SEND_CAM_POINT(_chan) DOWNLINK_SEND_CAM_POINT(_chan, &cam_point_distance_from_home, &cam_point_lat, &cam_point_lon)
|
#define PERIODIC_SEND_CAM_POINT(_trans, _dev) DOWNLINK_SEND_CAM_POINT(_trans, _dev, &cam_point_distance_from_home, &cam_point_lat, &cam_point_lon)
|
||||||
#else
|
#else
|
||||||
#define SEND_CAM(_chan) {}
|
#define SEND_CAM(_trans, _dev) {}
|
||||||
#define PERIODIC_SEND_CAM_POINT(_chan) {}
|
#define PERIODIC_SEND_CAM_POINT(_trans, _dev) {}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define PERIODIC_SEND_DL_VALUE(_chan) PeriodicSendDlValue(_chan) /** generated from the xml settings config in conf/settings */
|
#define PERIODIC_SEND_DL_VALUE(_trans, _dev) PeriodicSendDlValue(_trans, _dev) /** generated from the xml settings config in conf/settings */
|
||||||
|
|
||||||
#define PERIODIC_SEND_SURVEY(_chan) { \
|
#define PERIODIC_SEND_SURVEY(_trans, _dev) { \
|
||||||
if (nav_survey_active) \
|
if (nav_survey_active) \
|
||||||
DOWNLINK_SEND_SURVEY(_chan, &nav_survey_east, &nav_survey_north, &nav_survey_west, &nav_survey_south); \
|
DOWNLINK_SEND_SURVEY(_trans, _dev, &nav_survey_east, &nav_survey_north, &nav_survey_west, &nav_survey_south); \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define PERIODIC_SEND_RANGEFINDER(_chan) DOWNLINK_SEND_RANGEFINDER(_chan, &rangemeter, &ctl_grz_z_dot, &ctl_grz_z_dot_sum_err, &ctl_grz_z_dot_setpoint, &ctl_grz_z_sum_err, &ctl_grz_z_setpoint, &flying)
|
#define PERIODIC_SEND_RANGEFINDER(_trans, _dev) DOWNLINK_SEND_RANGEFINDER(_trans, _dev, &rangemeter, &ctl_grz_z_dot, &ctl_grz_z_dot_sum_err, &ctl_grz_z_dot_setpoint, &ctl_grz_z_sum_err, &ctl_grz_z_setpoint, &flying)
|
||||||
|
|
||||||
#define PERIODIC_SEND_TUNE_ROLL(_chan) DOWNLINK_SEND_TUNE_ROLL(_chan, &estimator_p,&estimator_phi, &h_ctl_roll_setpoint);
|
#define PERIODIC_SEND_TUNE_ROLL(_trans, _dev) DOWNLINK_SEND_TUNE_ROLL(_trans, _dev, &estimator_p,&estimator_phi, &h_ctl_roll_setpoint);
|
||||||
|
|
||||||
#if defined USE_GPS || defined SITL || defined USE_GPS_XSENS
|
#if defined USE_GPS || defined SITL || defined USE_GPS_XSENS
|
||||||
#define PERIODIC_SEND_GPS_SOL(_chan) DOWNLINK_SEND_GPS_SOL(_chan, &gps.pacc, &gps.sacc, &gps.pdop, &gps.num_sv)
|
#define PERIODIC_SEND_GPS_SOL(_trans, _dev) DOWNLINK_SEND_GPS_SOL(_trans, _dev, &gps.pacc, &gps.sacc, &gps.pdop, &gps.num_sv)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define PERIODIC_SEND_GPS(_chan) { \
|
#define PERIODIC_SEND_GPS(_trans, _dev) { \
|
||||||
static uint8_t i; \
|
static uint8_t i; \
|
||||||
int16_t climb = -gps.ned_vel.z; \
|
int16_t climb = -gps.ned_vel.z; \
|
||||||
int16_t course = (DegOfRad(gps.course)/((int32_t)1e6)); \
|
int16_t course = (DegOfRad(gps.course)/((int32_t)1e6)); \
|
||||||
DOWNLINK_SEND_GPS(DefaultChannel, &gps.fix, &gps.utm_pos.east, &gps.utm_pos.north, &course, &gps.hmsl, &gps.gspeed, &climb, &gps.week, &gps.tow, &gps.utm_pos.zone, &i); \
|
DOWNLINK_SEND_GPS(_trans, _dev, &gps.fix, &gps.utm_pos.east, &gps.utm_pos.north, &course, &gps.hmsl, &gps.gspeed, &climb, &gps.week, &gps.tow, &gps.utm_pos.zone, &i); \
|
||||||
if ((gps.fix != GPS_FIX_3D) && (i >= gps.nb_channels)) i = 0; \
|
if ((gps.fix != GPS_FIX_3D) && (i >= gps.nb_channels)) i = 0; \
|
||||||
if (i >= gps.nb_channels * 2) i = 0; \
|
if (i >= gps.nb_channels * 2) i = 0; \
|
||||||
if (i < gps.nb_channels && gps.svinfos[i].cno > 0) { \
|
if (i < gps.nb_channels && gps.svinfos[i].cno > 0) { \
|
||||||
DOWNLINK_SEND_SVINFO(DefaultChannel, &i, &gps.svinfos[i].svid, &gps.svinfos[i].flags, &gps.svinfos[i].qi, &gps.svinfos[i].cno, &gps.svinfos[i].elev, &gps.svinfos[i].azim); \
|
DOWNLINK_SEND_SVINFO(_trans, _dev, &i, &gps.svinfos[i].svid, &gps.svinfos[i].flags, &gps.svinfos[i].qi, &gps.svinfos[i].cno, &gps.svinfos[i].elev, &gps.svinfos[i].azim); \
|
||||||
} \
|
} \
|
||||||
i++; \
|
i++; \
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USE_BARO_MS5534A
|
#ifdef USE_BARO_MS5534A
|
||||||
//#include "baro_MS5534A.h"
|
//#include "baro_MS5534A.h"
|
||||||
#define PERIODIC_SEND_BARO_MS5534A(_chan) DOWNLINK_SEND_BARO_MS5534A(_chan, &baro_MS5534A_pressure, &baro_MS5534A_temp, &baro_MS5534A_z)
|
#define PERIODIC_SEND_BARO_MS5534A(_trans, _dev) DOWNLINK_SEND_BARO_MS5534A(_trans, _dev, &baro_MS5534A_pressure, &baro_MS5534A_temp, &baro_MS5534A_z)
|
||||||
#else
|
#else
|
||||||
#define PERIODIC_SEND_BARO_MS5534A(_chan) {}
|
#define PERIODIC_SEND_BARO_MS5534A(_trans, _dev) {}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USE_BARO_SCP
|
#ifdef USE_BARO_SCP
|
||||||
#include "baro_scp.h"
|
#include "baro_scp.h"
|
||||||
#define PERIODIC_SEND_SCP_STATUS(_chan) DOWNLINK_SEND_SCP_STATUS(_chan, &baro_scp_pressure, &baro_scp_temperature)
|
#define PERIODIC_SEND_SCP_STATUS(_trans, _dev) DOWNLINK_SEND_SCP_STATUS(_trans, _dev, &baro_scp_pressure, &baro_scp_temperature)
|
||||||
#else
|
#else
|
||||||
#define PERIODIC_SEND_SCP_STATUS(_chan) {}
|
#define PERIODIC_SEND_SCP_STATUS(_trans, _dev) {}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef MEASURE_AIRSPEED
|
#ifdef MEASURE_AIRSPEED
|
||||||
#define PERIODIC_SEND_AIRSPEED(_chan) DOWNLINK_SEND_AIRSPEED (_chan, &estimator_airspeed, &estimator_airspeed, &estimator_airspeed, &estimator_airspeed)
|
#define PERIODIC_SEND_AIRSPEED(_trans, _dev) DOWNLINK_SEND_AIRSPEED (_trans, _dev, &estimator_airspeed, &estimator_airspeed, &estimator_airspeed, &estimator_airspeed)
|
||||||
#elif defined USE_AIRSPEED
|
#elif defined USE_AIRSPEED
|
||||||
#define PERIODIC_SEND_AIRSPEED(_chan) DOWNLINK_SEND_AIRSPEED (_chan, &estimator_airspeed, &v_ctl_auto_airspeed_setpoint, &v_ctl_auto_airspeed_controlled, &v_ctl_auto_groundspeed_setpoint)
|
#define PERIODIC_SEND_AIRSPEED(_trans, _dev) DOWNLINK_SEND_AIRSPEED (_trans, _dev, &estimator_airspeed, &v_ctl_auto_airspeed_setpoint, &v_ctl_auto_airspeed_controlled, &v_ctl_auto_groundspeed_setpoint)
|
||||||
#else
|
#else
|
||||||
#define PERIODIC_SEND_AIRSPEED(_chan) {}
|
#define PERIODIC_SEND_AIRSPEED(_trans, _dev) {}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define PERIODIC_SEND_ENERGY(_chan) Downlink({ const int16_t e = energy; const float vsup = ((float)vsupply) / 10.0f; const float curs = ((float) current)/1000.0f; const float power = vsup * curs; DOWNLINK_SEND_ENERGY(_chan, &vsup, &curs, &e, &power); })
|
#define PERIODIC_SEND_ENERGY(_trans, _dev) Downlink({ const int16_t e = energy; const float vsup = ((float)vsupply) / 10.0f; const float curs = ((float) current)/1000.0f; const float power = vsup * curs; DOWNLINK_SEND_ENERGY(_trans, _dev, &vsup, &curs, &e, &power); })
|
||||||
|
|
||||||
|
|
||||||
#include "firmwares/fixedwing/stabilization/stabilization_adaptive.h"
|
#include "firmwares/fixedwing/stabilization/stabilization_adaptive.h"
|
||||||
#define PERIODIC_SEND_H_CTL_A(_chan) DOWNLINK_SEND_H_CTL_A(_chan, &h_ctl_roll_sum_err, &h_ctl_ref_roll_angle, &h_ctl_pitch_sum_err, &h_ctl_ref_pitch_angle)
|
#define PERIODIC_SEND_H_CTL_A(_trans, _dev) DOWNLINK_SEND_H_CTL_A(_trans, _dev, &h_ctl_roll_sum_err, &h_ctl_ref_roll_angle, &h_ctl_pitch_sum_err, &h_ctl_ref_pitch_angle)
|
||||||
|
|
||||||
|
|
||||||
#endif /* AP_DOWNLINK_H */
|
#endif /* AP_DOWNLINK_H */
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ void dl_parse_msg(void) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (msg_id == DL_PING) {
|
if (msg_id == DL_PING) {
|
||||||
DOWNLINK_SEND_PONG(DefaultChannel);
|
DOWNLINK_SEND_PONG(DefaultChannel, DefaultDevice)
|
||||||
} else
|
} else
|
||||||
#ifdef TRAFFIC_INFO
|
#ifdef TRAFFIC_INFO
|
||||||
if (msg_id == DL_ACINFO && DL_ACINFO_ac_id(dl_buffer) != AC_ID) {
|
if (msg_id == DL_ACINFO && DL_ACINFO_ac_id(dl_buffer) != AC_ID) {
|
||||||
@@ -126,10 +126,10 @@ void dl_parse_msg(void) {
|
|||||||
coordinates */
|
coordinates */
|
||||||
utm.east = waypoints[wp_id].x + nav_utm_east0;
|
utm.east = waypoints[wp_id].x + nav_utm_east0;
|
||||||
utm.north = waypoints[wp_id].y + nav_utm_north0;
|
utm.north = waypoints[wp_id].y + nav_utm_north0;
|
||||||
DOWNLINK_SEND_WP_MOVED(DefaultChannel, &wp_id, &utm.east, &utm.north, &a, &nav_utm_zone0);
|
DOWNLINK_SEND_WP_MOVED(DefaultChannel, DefaultDevice, &wp_id, &utm.east, &utm.north, &a, &nav_utm_zone0);
|
||||||
} else if (msg_id == DL_BLOCK && DL_BLOCK_ac_id(dl_buffer) == AC_ID) {
|
} else if (msg_id == DL_BLOCK && DL_BLOCK_ac_id(dl_buffer) == AC_ID) {
|
||||||
nav_goto_block(DL_BLOCK_block_id(dl_buffer));
|
nav_goto_block(DL_BLOCK_block_id(dl_buffer));
|
||||||
SEND_NAVIGATION(DefaultChannel);
|
SEND_NAVIGATION(DefaultChannel, DefaultDevice);
|
||||||
} else
|
} else
|
||||||
#endif /** NAV */
|
#endif /** NAV */
|
||||||
#ifdef WIND_INFO
|
#ifdef WIND_INFO
|
||||||
@@ -140,7 +140,7 @@ void dl_parse_msg(void) {
|
|||||||
estimator_airspeed = DL_WIND_INFO_airspeed(dl_buffer);
|
estimator_airspeed = DL_WIND_INFO_airspeed(dl_buffer);
|
||||||
#endif
|
#endif
|
||||||
#ifdef WIND_INFO_RET
|
#ifdef WIND_INFO_RET
|
||||||
DOWNLINK_SEND_WIND_INFO_RET(DefaultChannel, &wind_east, &wind_north, &estimator_airspeed);
|
DOWNLINK_SEND_WIND_INFO_RET(DefaultChannel, DefaultDevice, &wind_east, &wind_north, &estimator_airspeed);
|
||||||
#endif
|
#endif
|
||||||
} else
|
} else
|
||||||
#endif /** WIND_INFO */
|
#endif /** WIND_INFO */
|
||||||
@@ -171,11 +171,11 @@ void dl_parse_msg(void) {
|
|||||||
uint8_t i = DL_SETTING_index(dl_buffer);
|
uint8_t i = DL_SETTING_index(dl_buffer);
|
||||||
float val = DL_SETTING_value(dl_buffer);
|
float val = DL_SETTING_value(dl_buffer);
|
||||||
DlSetting(i, val);
|
DlSetting(i, val);
|
||||||
DOWNLINK_SEND_DL_VALUE(DefaultChannel, &i, &val);
|
DOWNLINK_SEND_DL_VALUE(DefaultChannel, DefaultDevice, &i, &val);
|
||||||
} else if (msg_id == DL_GET_SETTING && DL_GET_SETTING_ac_id(dl_buffer) == AC_ID) {
|
} else if (msg_id == DL_GET_SETTING && DL_GET_SETTING_ac_id(dl_buffer) == AC_ID) {
|
||||||
uint8_t i = DL_GET_SETTING_index(dl_buffer);
|
uint8_t i = DL_GET_SETTING_index(dl_buffer);
|
||||||
float val = settings_get_value(i);
|
float val = settings_get_value(i);
|
||||||
DOWNLINK_SEND_DL_VALUE(DefaultChannel, &i, &val);
|
DOWNLINK_SEND_DL_VALUE(DefaultChannel, DefaultDevice, &i, &val);
|
||||||
} else
|
} else
|
||||||
#endif /** Else there is no dl_settings section in the flight plan */
|
#endif /** Else there is no dl_settings section in the flight plan */
|
||||||
#ifdef USE_JOYSTICK
|
#ifdef USE_JOYSTICK
|
||||||
|
|||||||
@@ -58,41 +58,41 @@
|
|||||||
extern uint8_t telemetry_mode_Fbw_DefaultChannel;
|
extern uint8_t telemetry_mode_Fbw_DefaultChannel;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define PERIODIC_SEND_COMMANDS(_chan) DOWNLINK_SEND_COMMANDS(_chan, COMMANDS_NB, commands)
|
#define PERIODIC_SEND_COMMANDS(_trans, _dev) DOWNLINK_SEND_COMMANDS(_trans, _dev, COMMANDS_NB, commands)
|
||||||
|
|
||||||
#ifdef RADIO_CONTROL
|
#ifdef RADIO_CONTROL
|
||||||
#define PERIODIC_SEND_FBW_STATUS(_chan) DOWNLINK_SEND_FBW_STATUS(_chan, &(radio_control.status), &(radio_control.frame_rate), &fbw_mode, &electrical.vsupply, &electrical.current)
|
#define PERIODIC_SEND_FBW_STATUS(_trans, _dev) DOWNLINK_SEND_FBW_STATUS(_trans, _dev, &(radio_control.status), &(radio_control.frame_rate), &fbw_mode, &electrical.vsupply, &electrical.current)
|
||||||
#ifdef RADIO_CONTROL_TYPE_PPM
|
#ifdef RADIO_CONTROL_TYPE_PPM
|
||||||
#define PERIODIC_SEND_PPM(_chan) DOWNLINK_SEND_PPM(_chan, &(radio_control.frame_rate), PPM_NB_CHANNEL, ppm_pulses)
|
#define PERIODIC_SEND_PPM(_trans, _dev) DOWNLINK_SEND_PPM(_trans, _dev, &(radio_control.frame_rate), PPM_NB_CHANNEL, ppm_pulses)
|
||||||
#else
|
#else
|
||||||
#define PERIODIC_SEND_PPM(_chan) {}
|
#define PERIODIC_SEND_PPM(_trans, _dev) {}
|
||||||
#endif
|
#endif
|
||||||
#define PERIODIC_SEND_RC(_chan) DOWNLINK_SEND_RC(_chan, RADIO_CONTROL_NB_CHANNEL, radio_control.values)
|
#define PERIODIC_SEND_RC(_trans, _dev) DOWNLINK_SEND_RC(_trans, _dev, RADIO_CONTROL_NB_CHANNEL, radio_control.values)
|
||||||
#else // RADIO_CONTROL
|
#else // RADIO_CONTROL
|
||||||
#define PERIODIC_SEND_FBW_STATUS(_chan) { uint8_t dummy = 0; DOWNLINK_SEND_FBW_STATUS(_chan, &dummy, &dummy, &fbw_mode, &electrical.vsupply, &electrical.current); }
|
#define PERIODIC_SEND_FBW_STATUS(_trans, _dev) { uint8_t dummy = 0; DOWNLINK_SEND_FBW_STATUS(_trans, _dev, &dummy, &dummy, &fbw_mode, &electrical.vsupply, &electrical.current); }
|
||||||
#define PERIODIC_SEND_PPM(_chan) {}
|
#define PERIODIC_SEND_PPM(_trans, _dev) {}
|
||||||
#define PERIODIC_SEND_RC(_chan) {}
|
#define PERIODIC_SEND_RC(_trans, _dev) {}
|
||||||
#endif // RADIO_CONTROL
|
#endif // RADIO_CONTROL
|
||||||
|
|
||||||
#ifdef ACTUATORS
|
#ifdef ACTUATORS
|
||||||
#define PERIODIC_SEND_ACTUATORS(_chan) DOWNLINK_SEND_ACTUATORS(_chan, SERVOS_NB, actuators)
|
#define PERIODIC_SEND_ACTUATORS(_trans, _dev) DOWNLINK_SEND_ACTUATORS(_trans, _dev, SERVOS_NB, actuators)
|
||||||
#else
|
#else
|
||||||
#define PERIODIC_SEND_ACTUATORS(_chan) {}
|
#define PERIODIC_SEND_ACTUATORS(_trans, _dev) {}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef BRICOLAGE_ADC
|
#ifdef BRICOLAGE_ADC
|
||||||
extern uint16_t adc0_val[];
|
extern uint16_t adc0_val[];
|
||||||
|
|
||||||
#define PERIODIC_SEND_ADC(_chan) { \
|
#define PERIODIC_SEND_ADC(_trans, _dev) { \
|
||||||
static const uint8_t mcu = 0; \
|
static const uint8_t mcu = 0; \
|
||||||
DOWNLINK_SEND_ADC(_chan, &mcu, 8, adc0_val); \
|
DOWNLINK_SEND_ADC(_trans, _dev, &mcu, 8, adc0_val); \
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
#define PERIODIC_SEND_ADC(_chan) {}
|
#define PERIODIC_SEND_ADC(_trans, _dev) {}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static inline void fbw_downlink_periodic_task(void) {
|
static inline void fbw_downlink_periodic_task(void) {
|
||||||
PeriodicSendFbw(DefaultChannel)
|
PeriodicSendFbw(DefaultChannel,DefaultDevice)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -196,12 +196,12 @@ static inline void reporting_task( void ) {
|
|||||||
|
|
||||||
/** initialisation phase during boot */
|
/** initialisation phase during boot */
|
||||||
if (boot) {
|
if (boot) {
|
||||||
DOWNLINK_SEND_BOOT(DefaultChannel, &version);
|
DOWNLINK_SEND_BOOT(DefaultChannel, DefaultDevice, &version);
|
||||||
boot = FALSE;
|
boot = FALSE;
|
||||||
}
|
}
|
||||||
/** then report periodicly */
|
/** then report periodicly */
|
||||||
else {
|
else {
|
||||||
PeriodicSendAp(DefaultChannel);
|
PeriodicSendAp(DefaultChannel, DefaultDevice);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -236,7 +236,7 @@ static inline void telecommand_task( void ) {
|
|||||||
}
|
}
|
||||||
mode_changed |= mcu1_status_update();
|
mode_changed |= mcu1_status_update();
|
||||||
if ( mode_changed )
|
if ( mode_changed )
|
||||||
PERIODIC_SEND_PPRZ_MODE(DefaultChannel);
|
PERIODIC_SEND_PPRZ_MODE(DefaultChannel, DefaultDevice);
|
||||||
|
|
||||||
#if defined RADIO_CONTROL || defined RADIO_CONTROL_AUTO1
|
#if defined RADIO_CONTROL || defined RADIO_CONTROL_AUTO1
|
||||||
/** In AUTO1 mode, compute roll setpoint and pitch setpoint from
|
/** In AUTO1 mode, compute roll setpoint and pitch setpoint from
|
||||||
@@ -293,7 +293,7 @@ static void navigation_task( void ) {
|
|||||||
if (pprz_mode == PPRZ_MODE_AUTO2 || pprz_mode == PPRZ_MODE_HOME) {
|
if (pprz_mode == PPRZ_MODE_AUTO2 || pprz_mode == PPRZ_MODE_HOME) {
|
||||||
last_pprz_mode = pprz_mode;
|
last_pprz_mode = pprz_mode;
|
||||||
pprz_mode = PPRZ_MODE_GPS_OUT_OF_ORDER;
|
pprz_mode = PPRZ_MODE_GPS_OUT_OF_ORDER;
|
||||||
PERIODIC_SEND_PPRZ_MODE(DefaultChannel);
|
PERIODIC_SEND_PPRZ_MODE(DefaultChannel, DefaultDevice);
|
||||||
gps_lost = TRUE;
|
gps_lost = TRUE;
|
||||||
}
|
}
|
||||||
} else if (gps_lost) { /* GPS is ok */
|
} else if (gps_lost) { /* GPS is ok */
|
||||||
@@ -301,7 +301,7 @@ static void navigation_task( void ) {
|
|||||||
pprz_mode = last_pprz_mode;
|
pprz_mode = last_pprz_mode;
|
||||||
gps_lost = FALSE;
|
gps_lost = FALSE;
|
||||||
|
|
||||||
PERIODIC_SEND_PPRZ_MODE(DefaultChannel);
|
PERIODIC_SEND_PPRZ_MODE(DefaultChannel, DefaultDevice);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* GPS && FAILSAFE_DELAY_WITHOUT_GPS */
|
#endif /* GPS && FAILSAFE_DELAY_WITHOUT_GPS */
|
||||||
@@ -319,10 +319,10 @@ static void navigation_task( void ) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef PERIOD_NAVIGATION_DefaultChannel_0 // If not sent periodically (in default 0 mode)
|
#ifndef PERIOD_NAVIGATION_DefaultChannel_0 // If not sent periodically (in default 0 mode)
|
||||||
SEND_NAVIGATION(DefaultChannel);
|
SEND_NAVIGATION(DefaultChannel, DefaultDevice);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
SEND_CAM(DefaultChannel);
|
SEND_CAM(DefaultChannel, DefaultDevice);
|
||||||
|
|
||||||
/* The nav task computes only nav_altitude. However, we are interested
|
/* The nav task computes only nav_altitude. However, we are interested
|
||||||
by desired_altitude (= nav_alt+alt_shift) in any case.
|
by desired_altitude (= nav_alt+alt_shift) in any case.
|
||||||
@@ -478,9 +478,6 @@ void periodic_task_ap( void ) {
|
|||||||
switch(_4Hz) {
|
switch(_4Hz) {
|
||||||
case 0:
|
case 0:
|
||||||
estimator_propagate_state();
|
estimator_propagate_state();
|
||||||
#ifdef EXTRA_DOWNLINK_DEVICE
|
|
||||||
DOWNLINK_SEND_ATTITUDE(ExtraPprzTransport,&estimator_phi,&estimator_psi,&estimator_theta);
|
|
||||||
#endif
|
|
||||||
navigation_task();
|
navigation_task();
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
@@ -488,7 +485,7 @@ void periodic_task_ap( void ) {
|
|||||||
estimator_hspeed_mod > MIN_SPEED_FOR_TAKEOFF) {
|
estimator_hspeed_mod > MIN_SPEED_FOR_TAKEOFF) {
|
||||||
estimator_flight_time = 1;
|
estimator_flight_time = 1;
|
||||||
launch = TRUE; /* Not set in non auto launch */
|
launch = TRUE; /* Not set in non auto launch */
|
||||||
DOWNLINK_SEND_TAKEOFF(DefaultChannel, &cpu_time_sec);
|
DOWNLINK_SEND_TAKEOFF(DefaultChannel, DefaultDevice, &cpu_time_sec);
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -80,10 +80,10 @@ static inline void main_periodic_task( void ) {
|
|||||||
|
|
||||||
|
|
||||||
RunOnceEvery(125, {
|
RunOnceEvery(125, {
|
||||||
DOWNLINK_SEND_ALIVE(DefaultChannel, 16, MD5SUM);
|
DOWNLINK_SEND_ALIVE(DefaultChannel, DefaultDevice, 16, MD5SUM);
|
||||||
PeriodicSendDlValue(DefaultChannel);
|
PeriodicSendDlValue(DefaultChannel);
|
||||||
});
|
});
|
||||||
DOWNLINK_SEND_MOTOR_BENCH_STATUS(DefaultChannel, &cpu_time_ticks, &throttle, &rpm, &s , &thrust, &torque, &cpu_time_sec, &mb_modes_mode);
|
DOWNLINK_SEND_MOTOR_BENCH_STATUS(DefaultChannel, DefaultDevice, &cpu_time_ticks, &throttle, &rpm, &s , &thrust, &torque, &cpu_time_sec, &mb_modes_mode);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -120,6 +120,6 @@ static inline void main_dl_parse_msg(void) {
|
|||||||
uint8_t i = DL_SETTING_index(dl_buffer);
|
uint8_t i = DL_SETTING_index(dl_buffer);
|
||||||
float var = DL_SETTING_value(dl_buffer);
|
float var = DL_SETTING_value(dl_buffer);
|
||||||
DlSetting(i, var);
|
DlSetting(i, var);
|
||||||
DOWNLINK_SEND_DL_VALUE(DefaultChannel, &i, &var);
|
DOWNLINK_SEND_DL_VALUE(DefaultChannel, DefaultDevice, &i, &var);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,11 +46,11 @@ static inline void main_periodic( void ) {
|
|||||||
RunOnceEvery(50, {
|
RunOnceEvery(50, {
|
||||||
const float tach_to_rpm = 15000000.*2*M_PI/(float)NB_STEP;
|
const float tach_to_rpm = 15000000.*2*M_PI/(float)NB_STEP;
|
||||||
omega_rad = tach_to_rpm / lp_pulse;
|
omega_rad = tach_to_rpm / lp_pulse;
|
||||||
DOWNLINK_SEND_IMU_TURNTABLE(DefaultChannel, &omega_rad);}
|
DOWNLINK_SEND_IMU_TURNTABLE(DefaultChannel, DefaultDevice, &omega_rad);}
|
||||||
// float foo = nb_pulse;
|
// float foo = nb_pulse;
|
||||||
// DOWNLINK_SEND_IMU_TURNTABLE(DefaultChannel, &foo);}
|
// DOWNLINK_SEND_IMU_TURNTABLE(DefaultChannel, DefaultDevice, &foo);}
|
||||||
);
|
);
|
||||||
RunOnceEvery(100, {DOWNLINK_SEND_ALIVE(DefaultChannel, 16, MD5SUM);});
|
RunOnceEvery(100, {DOWNLINK_SEND_ALIVE(DefaultChannel, DefaultDevice, 16, MD5SUM);});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ void dl_parse_msg(void) {
|
|||||||
|
|
||||||
case DL_PING:
|
case DL_PING:
|
||||||
{
|
{
|
||||||
DOWNLINK_SEND_PONG(DefaultChannel);
|
DOWNLINK_SEND_PONG(DefaultChannel, DefaultDevice);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -64,7 +64,7 @@ void dl_parse_msg(void) {
|
|||||||
uint8_t i = DL_SETTING_index(dl_buffer);
|
uint8_t i = DL_SETTING_index(dl_buffer);
|
||||||
float var = DL_SETTING_value(dl_buffer);
|
float var = DL_SETTING_value(dl_buffer);
|
||||||
DlSetting(i, var);
|
DlSetting(i, var);
|
||||||
DOWNLINK_SEND_DL_VALUE(DefaultChannel, &i, &var);
|
DOWNLINK_SEND_DL_VALUE(DefaultChannel, DefaultDevice, &i, &var);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -73,7 +73,7 @@ void dl_parse_msg(void) {
|
|||||||
if (DL_GET_SETTING_ac_id(dl_buffer) != AC_ID) break;
|
if (DL_GET_SETTING_ac_id(dl_buffer) != AC_ID) break;
|
||||||
uint8_t i = DL_GET_SETTING_index(dl_buffer);
|
uint8_t i = DL_GET_SETTING_index(dl_buffer);
|
||||||
float val = settings_get_value(i);
|
float val = settings_get_value(i);
|
||||||
DOWNLINK_SEND_DL_VALUE(DefaultChannel, &i, &val);
|
DOWNLINK_SEND_DL_VALUE(DefaultChannel, DefaultDevice, &i, &val);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -101,7 +101,7 @@ void dl_parse_msg(void) {
|
|||||||
enu.y = POS_BFP_OF_REAL(enu.y)/100;
|
enu.y = POS_BFP_OF_REAL(enu.y)/100;
|
||||||
enu.z = POS_BFP_OF_REAL(enu.z)/100;
|
enu.z = POS_BFP_OF_REAL(enu.z)/100;
|
||||||
VECT3_ASSIGN(waypoints[wp_id], enu.x, enu.y, enu.z);
|
VECT3_ASSIGN(waypoints[wp_id], enu.x, enu.y, enu.z);
|
||||||
DOWNLINK_SEND_WP_MOVED_ENU(DefaultChannel, &wp_id, &enu.x, &enu.y, &enu.z);
|
DOWNLINK_SEND_WP_MOVED_ENU(DefaultChannel, DefaultDevice, &wp_id, &enu.x, &enu.y, &enu.z);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#endif /* USE_NAVIGATION */
|
#endif /* USE_NAVIGATION */
|
||||||
|
|||||||
@@ -289,7 +289,7 @@ void nav_periodic_task() {
|
|||||||
void nav_move_waypoint(uint8_t wp_id, struct EnuCoor_i * new_pos) {
|
void nav_move_waypoint(uint8_t wp_id, struct EnuCoor_i * new_pos) {
|
||||||
if (wp_id < nb_waypoint) {
|
if (wp_id < nb_waypoint) {
|
||||||
INT32_VECT3_COPY(waypoints[wp_id],(*new_pos));
|
INT32_VECT3_COPY(waypoints[wp_id],(*new_pos));
|
||||||
DOWNLINK_SEND_WP_MOVED_ENU(DefaultChannel, &wp_id, &(new_pos->x), &(new_pos->y), &(new_pos->z));
|
DOWNLINK_SEND_WP_MOVED_ENU(DefaultChannel, DefaultDevice, &wp_id, &(new_pos->x), &(new_pos->y), &(new_pos->z));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -310,7 +310,7 @@ void navigation_update_wp_from_speed(uint8_t wp, struct Int16Vect3 speed_sp, int
|
|||||||
nav_heading += delta_heading;
|
nav_heading += delta_heading;
|
||||||
|
|
||||||
INT32_COURSE_NORMALIZE(nav_heading);
|
INT32_COURSE_NORMALIZE(nav_heading);
|
||||||
RunOnceEvery(10,DOWNLINK_SEND_WP_MOVED_ENU(DefaultChannel, &wp, &(waypoints[wp].x), &(waypoints[wp].y), &(waypoints[wp].z)));
|
RunOnceEvery(10,DOWNLINK_SEND_WP_MOVED_ENU(DefaultChannel, DefaultDevice, &wp, &(waypoints[wp].x), &(waypoints[wp].y), &(waypoints[wp].z)));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool_t nav_detect_ground(void) {
|
bool_t nav_detect_ground(void) {
|
||||||
|
|||||||
@@ -682,7 +682,7 @@ extern uint8_t telemetry_mode_Main_DefaultChannel;
|
|||||||
static uint8_t last_cnos[GPS_NB_CHANNELS]; \
|
static uint8_t last_cnos[GPS_NB_CHANNELS]; \
|
||||||
if (i == gps.nb_channels) i = 0; \
|
if (i == gps.nb_channels) i = 0; \
|
||||||
if (i < gps.nb_channels && gps.svinfos[i].cno > 0 && gps.svinfos[i].cno != last_cnos[i]) { \
|
if (i < gps.nb_channels && gps.svinfos[i].cno > 0 && gps.svinfos[i].cno != last_cnos[i]) { \
|
||||||
DOWNLINK_SEND_SVINFO(DefaultChannel, &i, &gps.svinfos[i].svid, &gps.svinfos[i].flags, &gps.svinfos[i].qi, &gps.svinfos[i].cno, &gps.svinfos[i].elev, &gps.svinfos[i].azim); \
|
DOWNLINK_SEND_SVINFO(DefaultChannel, DefaultDevice, &i, &gps.svinfos[i].svid, &gps.svinfos[i].flags, &gps.svinfos[i].qi, &gps.svinfos[i].cno, &gps.svinfos[i].elev, &gps.svinfos[i].azim); \
|
||||||
last_cnos[i] = gps.svinfos[i].cno; \
|
last_cnos[i] = gps.svinfos[i].cno; \
|
||||||
} \
|
} \
|
||||||
i++; \
|
i++; \
|
||||||
|
|||||||
@@ -35,11 +35,11 @@ void dl_parse_msg( void ) {
|
|||||||
for (int j=0 ; j<8 ; j++) {
|
for (int j=0 ; j<8 ; j++) {
|
||||||
SetServo(j,actuators[j]);
|
SetServo(j,actuators[j]);
|
||||||
}
|
}
|
||||||
DOWNLINK_SEND_DL_VALUE(DefaultChannel, &i, &val);
|
DOWNLINK_SEND_DL_VALUE(DefaultChannel, DefaultDevice, &i, &val);
|
||||||
} else if (msg_id == DL_GET_SETTING && DL_GET_SETTING_ac_id(dl_buffer) == AC_ID) {
|
} else if (msg_id == DL_GET_SETTING && DL_GET_SETTING_ac_id(dl_buffer) == AC_ID) {
|
||||||
uint8_t i = DL_GET_SETTING_index(dl_buffer);
|
uint8_t i = DL_GET_SETTING_index(dl_buffer);
|
||||||
float val = settings_get_value(i);
|
float val = settings_get_value(i);
|
||||||
DOWNLINK_SEND_DL_VALUE(DefaultChannel, &i, &val);
|
DOWNLINK_SEND_DL_VALUE(DefaultChannel, DefaultDevice, &i, &val);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -71,8 +71,8 @@ void periodic_task_fbw(void) {
|
|||||||
/* uint16_t servo_value = 1500+ 500*sin(t); */
|
/* uint16_t servo_value = 1500+ 500*sin(t); */
|
||||||
/* SetServo(SERVO_THROTTLE, servo_value); */
|
/* SetServo(SERVO_THROTTLE, servo_value); */
|
||||||
|
|
||||||
RunOnceEvery(300, DOWNLINK_SEND_ALIVE(DefaultChannel, 16, MD5SUM));
|
RunOnceEvery(300, DOWNLINK_SEND_ALIVE(DefaultChannel, DefaultDevice, 16, MD5SUM));
|
||||||
RunOnceEvery(300, DOWNLINK_SEND_ACTUATORS(DefaultChannel, SERVOS_NB, actuators ));
|
RunOnceEvery(300, DOWNLINK_SEND_ACTUATORS(DefaultChannel, DefaultDevice, SERVOS_NB, actuators ));
|
||||||
}
|
}
|
||||||
|
|
||||||
void event_task_fbw(void) {
|
void event_task_fbw(void) {
|
||||||
|
|||||||
@@ -165,10 +165,10 @@ static inline void main_periodic(void) {
|
|||||||
|
|
||||||
RunOnceEvery(10, {
|
RunOnceEvery(10, {
|
||||||
LED_PERIODIC();
|
LED_PERIODIC();
|
||||||
DOWNLINK_SEND_ALIVE(DefaultChannel, 16, MD5SUM);
|
DOWNLINK_SEND_ALIVE(DefaultChannel, DefaultDevice, 16, MD5SUM);
|
||||||
radio_control_periodic();
|
radio_control_periodic();
|
||||||
check_radio_lost();
|
check_radio_lost();
|
||||||
DOWNLINK_SEND_BARO_RAW(DefaultChannel, &baro.absolute, &baro.differential);
|
DOWNLINK_SEND_BARO_RAW(DefaultChannel, DefaultDevice, &baro.absolute, &baro.differential);
|
||||||
});
|
});
|
||||||
|
|
||||||
RunOnceEvery(2, {baro_periodic();});
|
RunOnceEvery(2, {baro_periodic();});
|
||||||
@@ -179,7 +179,7 @@ static inline void main_periodic(void) {
|
|||||||
v1 = adc0_buf.sum / adc0_buf.av_nb_sample;
|
v1 = adc0_buf.sum / adc0_buf.av_nb_sample;
|
||||||
v2 = adc1_buf.values[0];
|
v2 = adc1_buf.values[0];
|
||||||
|
|
||||||
RunOnceEvery(10, { DOWNLINK_SEND_ADC_GENERIC(DefaultChannel, &v1, &v2) });
|
RunOnceEvery(10, { DOWNLINK_SEND_ADC_GENERIC(DefaultChannel, DefaultDevice, &v1, &v2) });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -318,7 +318,7 @@ static inline void on_mag_event(void) {
|
|||||||
static inline void on_vane_msg(void *data) {
|
static inline void on_vane_msg(void *data) {
|
||||||
new_vane = TRUE;
|
new_vane = TRUE;
|
||||||
int zero = 0;
|
int zero = 0;
|
||||||
DOWNLINK_SEND_VANE_SENSOR(DefaultChannel,
|
DOWNLINK_SEND_VANE_SENSOR(DefaultChannel, DefaultDevice,
|
||||||
&(csc_vane_msg.vane_angle1),
|
&(csc_vane_msg.vane_angle1),
|
||||||
&zero,
|
&zero,
|
||||||
&zero,
|
&zero,
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ static inline void main_init( void ) {
|
|||||||
static inline void main_periodic_task( void ) {
|
static inline void main_periodic_task( void ) {
|
||||||
RunOnceEvery(100, {
|
RunOnceEvery(100, {
|
||||||
LED_TOGGLE(3);
|
LED_TOGGLE(3);
|
||||||
DOWNLINK_SEND_ALIVE(DefaultChannel, 16, MD5SUM);
|
DOWNLINK_SEND_ALIVE(DefaultChannel, DefaultDevice, 16, MD5SUM);
|
||||||
});
|
});
|
||||||
imu_periodic();
|
imu_periodic();
|
||||||
RunOnceEvery(10, { LED_PERIODIC();});
|
RunOnceEvery(10, { LED_PERIODIC();});
|
||||||
@@ -101,11 +101,11 @@ static inline void on_gyro_accel_event(void) {
|
|||||||
if (cnt > NB_SAMPLES) cnt = 0;
|
if (cnt > NB_SAMPLES) cnt = 0;
|
||||||
samples[cnt] = imu.MEASURED_SENSOR;
|
samples[cnt] = imu.MEASURED_SENSOR;
|
||||||
if (cnt == NB_SAMPLES-1) {
|
if (cnt == NB_SAMPLES-1) {
|
||||||
DOWNLINK_SEND_IMU_HS_GYRO(DefaultChannel, &axis, NB_SAMPLES, samples);
|
DOWNLINK_SEND_IMU_HS_GYRO(DefaultChannel, DefaultDevice, &axis, NB_SAMPLES, samples);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cnt == 10) {
|
if (cnt == 10) {
|
||||||
DOWNLINK_SEND_IMU_GYRO_RAW(DefaultChannel,
|
DOWNLINK_SEND_IMU_GYRO_RAW(DefaultChannel, DefaultDevice,
|
||||||
&imu.gyro_unscaled.p,
|
&imu.gyro_unscaled.p,
|
||||||
&imu.gyro_unscaled.q,
|
&imu.gyro_unscaled.q,
|
||||||
&imu.gyro_unscaled.r);
|
&imu.gyro_unscaled.r);
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ static inline void main_periodic_task( void ) {
|
|||||||
|
|
||||||
RunOnceEvery(100, {
|
RunOnceEvery(100, {
|
||||||
LED_TOGGLE(3);
|
LED_TOGGLE(3);
|
||||||
DOWNLINK_SEND_ALIVE(DefaultChannel, 16, MD5SUM);
|
DOWNLINK_SEND_ALIVE(DefaultChannel, DefaultDevice, 16, MD5SUM);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -148,7 +148,7 @@ static inline void main_periodic_task( void ) {
|
|||||||
|
|
||||||
RunOnceEvery(10,
|
RunOnceEvery(10,
|
||||||
{
|
{
|
||||||
DOWNLINK_SEND_ALIVE(DefaultChannel, 16, MD5SUM);
|
DOWNLINK_SEND_ALIVE(DefaultChannel, DefaultDevice, 16, MD5SUM);
|
||||||
LED_PERIODIC();
|
LED_PERIODIC();
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -197,7 +197,7 @@ static inline void main_event_task( void ) {
|
|||||||
int32_t iax = *((int16_t*)&values[0]);
|
int32_t iax = *((int16_t*)&values[0]);
|
||||||
int32_t iay = *((int16_t*)&values[2]);
|
int32_t iay = *((int16_t*)&values[2]);
|
||||||
int32_t iaz = *((int16_t*)&values[4]);
|
int32_t iaz = *((int16_t*)&values[4]);
|
||||||
RunOnceEvery(10, {DOWNLINK_SEND_IMU_ACCEL_RAW(DefaultChannel, &iax, &iay, &iaz);});
|
RunOnceEvery(10, {DOWNLINK_SEND_IMU_ACCEL_RAW(DefaultChannel, DefaultDevice, &iax, &iay, &iaz);});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ static inline void main_periodic_task( void ) {
|
|||||||
|
|
||||||
RunOnceEvery(10,
|
RunOnceEvery(10,
|
||||||
{
|
{
|
||||||
DOWNLINK_SEND_ALIVE(DefaultChannel, 16, MD5SUM);
|
DOWNLINK_SEND_ALIVE(DefaultChannel, DefaultDevice, 16, MD5SUM);
|
||||||
LED_PERIODIC();
|
LED_PERIODIC();
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -197,7 +197,7 @@ static inline void main_event_task( void ) {
|
|||||||
int32_t iax = ax;
|
int32_t iax = ax;
|
||||||
int32_t iay = ay;
|
int32_t iay = ay;
|
||||||
int32_t iaz = az;
|
int32_t iaz = az;
|
||||||
RunOnceEvery(10, {DOWNLINK_SEND_IMU_ACCEL_RAW(DefaultChannel, &iax, &iay, &iaz);});
|
RunOnceEvery(10, {DOWNLINK_SEND_IMU_ACCEL_RAW(DefaultChannel, DefaultDevice, &iax, &iay, &iaz);});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ static inline void main_periodic_task( void ) {
|
|||||||
// LED_TOGGLE(6);
|
// LED_TOGGLE(6);
|
||||||
RunOnceEvery(10,
|
RunOnceEvery(10,
|
||||||
{
|
{
|
||||||
DOWNLINK_SEND_ALIVE(DefaultChannel, 16, MD5SUM);
|
DOWNLINK_SEND_ALIVE(DefaultChannel, DefaultDevice, 16, MD5SUM);
|
||||||
LED_PERIODIC();
|
LED_PERIODIC();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -84,12 +84,12 @@ static inline void main_periodic_task( void ) {
|
|||||||
// LED_TOGGLE(6);
|
// LED_TOGGLE(6);
|
||||||
RunOnceEvery(10,
|
RunOnceEvery(10,
|
||||||
{
|
{
|
||||||
DOWNLINK_SEND_ALIVE(DefaultChannel, 16, MD5SUM);
|
DOWNLINK_SEND_ALIVE(DefaultChannel, DefaultDevice, 16, MD5SUM);
|
||||||
LED_PERIODIC();
|
LED_PERIODIC();
|
||||||
});
|
});
|
||||||
RunOnceEvery(256,
|
RunOnceEvery(256,
|
||||||
{
|
{
|
||||||
DOWNLINK_SEND_I2C_ERRORS(DefaultChannel,
|
DOWNLINK_SEND_I2C_ERRORS(DefaultChannel, DefaultDevice,
|
||||||
&i2c2_errors.ack_fail_cnt,
|
&i2c2_errors.ack_fail_cnt,
|
||||||
&i2c2_errors.miss_start_stop_cnt,
|
&i2c2_errors.miss_start_stop_cnt,
|
||||||
&i2c2_errors.arb_lost_cnt,
|
&i2c2_errors.arb_lost_cnt,
|
||||||
@@ -165,10 +165,10 @@ static inline void main_event_task( void ) {
|
|||||||
int16_t mz = i2c_trans.buf[4]<<8 | i2c_trans.buf[5];
|
int16_t mz = i2c_trans.buf[4]<<8 | i2c_trans.buf[5];
|
||||||
struct Int32Vect3 m;
|
struct Int32Vect3 m;
|
||||||
VECT3_ASSIGN(m, mx, my, mz);
|
VECT3_ASSIGN(m, mx, my, mz);
|
||||||
DOWNLINK_SEND_IMU_MAG_RAW(DefaultChannel, &m.x, &m.y, &m.z);
|
DOWNLINK_SEND_IMU_MAG_RAW(DefaultChannel, DefaultDevice, &m.x, &m.y, &m.z);
|
||||||
// uint8_t tmp[8];
|
// uint8_t tmp[8];
|
||||||
// memcpy(tmp, i2c2.buf, 8);
|
// memcpy(tmp, i2c2.buf, 8);
|
||||||
// DOWNLINK_SEND_DEBUG(DefaultChannel, 8, tmp);
|
// DOWNLINK_SEND_DEBUG(DefaultChannel, DefaultDevice, 8, tmp);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
reading_mag = FALSE;
|
reading_mag = FALSE;
|
||||||
|
|||||||
@@ -82,11 +82,11 @@ static inline void main_periodic_task( void ) {
|
|||||||
// LED_TOGGLE(6);
|
// LED_TOGGLE(6);
|
||||||
RunOnceEvery(10,
|
RunOnceEvery(10,
|
||||||
{
|
{
|
||||||
DOWNLINK_SEND_ALIVE(DefaultChannel, 16, MD5SUM);
|
DOWNLINK_SEND_ALIVE(DefaultChannel, DefaultDevice, 16, MD5SUM);
|
||||||
LED_PERIODIC();
|
LED_PERIODIC();
|
||||||
});
|
});
|
||||||
RunOnceEvery(256, {
|
RunOnceEvery(256, {
|
||||||
DOWNLINK_SEND_I2C_ERRORS(DefaultChannel,
|
DOWNLINK_SEND_I2C_ERRORS(DefaultChannel, DefaultDevice,
|
||||||
&i2c2_errors.ack_fail_cnt,
|
&i2c2_errors.ack_fail_cnt,
|
||||||
&i2c2_errors.miss_start_stop_cnt,
|
&i2c2_errors.miss_start_stop_cnt,
|
||||||
&i2c2_errors.arb_lost_cnt,
|
&i2c2_errors.arb_lost_cnt,
|
||||||
@@ -205,11 +205,11 @@ static inline void main_event_task( void ) {
|
|||||||
RATES_ASSIGN(g, tgp, tgq, tgr);
|
RATES_ASSIGN(g, tgp, tgq, tgr);
|
||||||
RunOnceEvery(10,
|
RunOnceEvery(10,
|
||||||
{
|
{
|
||||||
DOWNLINK_SEND_IMU_GYRO_RAW(DefaultChannel, &g.p, &g.q, &g.r);
|
DOWNLINK_SEND_IMU_GYRO_RAW(DefaultChannel, DefaultDevice, &g.p, &g.q, &g.r);
|
||||||
|
|
||||||
uint8_t tmp[8];
|
uint8_t tmp[8];
|
||||||
memcpy(tmp, i2c_trans.buf, 8);
|
memcpy(tmp, i2c_trans.buf, 8);
|
||||||
DOWNLINK_SEND_DEBUG(DefaultChannel, 8, tmp);
|
DOWNLINK_SEND_DEBUG(DefaultChannel, DefaultDevice, 8, tmp);
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ static inline void main_periodic_task( void ) {
|
|||||||
max1168_read();
|
max1168_read();
|
||||||
RunOnceEvery(10,
|
RunOnceEvery(10,
|
||||||
{
|
{
|
||||||
DOWNLINK_SEND_BOOT(DefaultChannel, &cpu_time_sec);
|
DOWNLINK_SEND_BOOT(DefaultChannel, DefaultDevice, &cpu_time_sec);
|
||||||
LED_PERIODIC();
|
LED_PERIODIC();
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -74,9 +74,9 @@ static inline void main_periodic_task( void ) {
|
|||||||
static inline void main_event_task( void ) {
|
static inline void main_event_task( void ) {
|
||||||
if (max1168_status == STA_MAX1168_DATA_AVAILABLE) {
|
if (max1168_status == STA_MAX1168_DATA_AVAILABLE) {
|
||||||
RunOnceEvery(10, {
|
RunOnceEvery(10, {
|
||||||
DOWNLINK_SEND_IMU_GYRO_RAW(DefaultChannel, &max1168_values[0], &max1168_values[1], &max1168_values[2]);
|
DOWNLINK_SEND_IMU_GYRO_RAW(DefaultChannel, DefaultDevice, &max1168_values[0], &max1168_values[1], &max1168_values[2]);
|
||||||
DOWNLINK_SEND_IMU_ACCEL_RAW(DefaultChannel, &max1168_values[3], &max1168_values[4], &max1168_values[6]);
|
DOWNLINK_SEND_IMU_ACCEL_RAW(DefaultChannel, DefaultDevice, &max1168_values[3], &max1168_values[4], &max1168_values[6]);
|
||||||
// DOWNLINK_SEND_BOOT(DefaultChannel, &max1168_values[7]); });
|
// DOWNLINK_SEND_BOOT(DefaultChannel, DefaultDevice, &max1168_values[7]); });
|
||||||
});
|
});
|
||||||
max1168_status = STA_MAX1168_IDLE;
|
max1168_status = STA_MAX1168_IDLE;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ static inline void main_init( void ) {
|
|||||||
static inline void main_periodic_task( void ) {
|
static inline void main_periodic_task( void ) {
|
||||||
RunOnceEvery(10,
|
RunOnceEvery(10,
|
||||||
{
|
{
|
||||||
DOWNLINK_SEND_BOOT(DefaultChannel, &cpu_time_sec);
|
DOWNLINK_SEND_BOOT(DefaultChannel, DefaultDevice, &cpu_time_sec);
|
||||||
LED_PERIODIC();
|
LED_PERIODIC();
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -82,7 +82,7 @@ static inline void main_periodic_task( void ) {
|
|||||||
static inline void main_event_task( void ) {
|
static inline void main_event_task( void ) {
|
||||||
if (ms2100_status == MS2100_DATA_AVAILABLE) {
|
if (ms2100_status == MS2100_DATA_AVAILABLE) {
|
||||||
RunOnceEvery(10, {
|
RunOnceEvery(10, {
|
||||||
DOWNLINK_SEND_IMU_MAG_RAW(DefaultChannel,
|
DOWNLINK_SEND_IMU_MAG_RAW(DefaultChannel, DefaultDevice,
|
||||||
&ms2100_values[0],
|
&ms2100_values[0],
|
||||||
&ms2100_values[1],
|
&ms2100_values[1],
|
||||||
&ms2100_values[2]);
|
&ms2100_values[2]);
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ static inline void main_periodic_task( void ) {
|
|||||||
// LED_TOGGLE(6);
|
// LED_TOGGLE(6);
|
||||||
RunOnceEvery(10,
|
RunOnceEvery(10,
|
||||||
{
|
{
|
||||||
DOWNLINK_SEND_ALIVE(DefaultChannel, 16, MD5SUM);
|
DOWNLINK_SEND_ALIVE(DefaultChannel, DefaultDevice, 16, MD5SUM);
|
||||||
LED_PERIODIC();
|
LED_PERIODIC();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ static inline void main_init( void ) {
|
|||||||
static inline void main_periodic_task( void ) {
|
static inline void main_periodic_task( void ) {
|
||||||
|
|
||||||
LED_PERIODIC();
|
LED_PERIODIC();
|
||||||
RunOnceEvery(256, {DOWNLINK_SEND_ALIVE(DefaultChannel, 16, MD5SUM);});
|
RunOnceEvery(256, {DOWNLINK_SEND_ALIVE(DefaultChannel, DefaultDevice, 16, MD5SUM);});
|
||||||
|
|
||||||
tests[cur_test]._periodic();
|
tests[cur_test]._periodic();
|
||||||
|
|
||||||
@@ -156,7 +156,7 @@ static void test_baro_start(void) {all_led_green();}
|
|||||||
static void test_baro_periodic(void) {
|
static void test_baro_periodic(void) {
|
||||||
RunOnceEvery(2, {baro_periodic();});
|
RunOnceEvery(2, {baro_periodic();});
|
||||||
RunOnceEvery(100,{
|
RunOnceEvery(100,{
|
||||||
DOWNLINK_SEND_I2C_ERRORS(DefaultChannel,
|
DOWNLINK_SEND_I2C_ERRORS(DefaultChannel, DefaultDevice,
|
||||||
&i2c2_errors.ack_fail_cnt,
|
&i2c2_errors.ack_fail_cnt,
|
||||||
&i2c2_errors.miss_start_stop_cnt,
|
&i2c2_errors.miss_start_stop_cnt,
|
||||||
&i2c2_errors.arb_lost_cnt,
|
&i2c2_errors.arb_lost_cnt,
|
||||||
@@ -170,10 +170,10 @@ static void test_baro_periodic(void) {
|
|||||||
}
|
}
|
||||||
static void test_baro_event(void) {BaroEvent(test_baro_on_baro_abs, test_baro_on_baro_diff);}
|
static void test_baro_event(void) {BaroEvent(test_baro_on_baro_abs, test_baro_on_baro_diff);}
|
||||||
static inline void test_baro_on_baro_abs(void) {
|
static inline void test_baro_on_baro_abs(void) {
|
||||||
RunOnceEvery(5,{DOWNLINK_SEND_BOOZ_BARO2_RAW(DefaultChannel, &baro.abs_raw, &baro.diff_raw);});
|
RunOnceEvery(5,{DOWNLINK_SEND_BOOZ_BARO2_RAW(DefaultChannel, DefaultDevice, &baro.abs_raw, &baro.diff_raw);});
|
||||||
}
|
}
|
||||||
static inline void test_baro_on_baro_diff(void) {
|
static inline void test_baro_on_baro_diff(void) {
|
||||||
RunOnceEvery(5,{DOWNLINK_SEND_BOOZ_BARO2_RAW(DefaultChannel, &baro.abs_raw, &baro.diff_raw);});
|
RunOnceEvery(5,{DOWNLINK_SEND_BOOZ_BARO2_RAW(DefaultChannel, DefaultDevice, &baro.abs_raw, &baro.diff_raw);});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -190,7 +190,7 @@ static void test_bldc_periodic(void) {
|
|||||||
i2c1_transmit(0x58, 1, NULL);
|
i2c1_transmit(0x58, 1, NULL);
|
||||||
|
|
||||||
RunOnceEvery(100,{
|
RunOnceEvery(100,{
|
||||||
DOWNLINK_SEND_I2C_ERRORS(DefaultChannel,
|
DOWNLINK_SEND_I2C_ERRORS(DefaultChannel, DefaultDevice,
|
||||||
&i2c1_errors.ack_fail_cnt,
|
&i2c1_errors.ack_fail_cnt,
|
||||||
&i2c1_errors.miss_start_stop_cnt,
|
&i2c1_errors.miss_start_stop_cnt,
|
||||||
&i2c1_errors.arb_lost_cnt,
|
&i2c1_errors.arb_lost_cnt,
|
||||||
@@ -260,7 +260,7 @@ static void test_uart_event(void) {
|
|||||||
if (Uart3ChAvailable()) {
|
if (Uart3ChAvailable()) {
|
||||||
buf_dest[idx_rx] = Uart3Getch();
|
buf_dest[idx_rx] = Uart3Getch();
|
||||||
if (idx_rx<sizeof(buf_src)) {
|
if (idx_rx<sizeof(buf_src)) {
|
||||||
DOWNLINK_SEND_DEBUG(DefaultChannel, sizeof(buf_src), buf_dest);
|
DOWNLINK_SEND_DEBUG(DefaultChannel, DefaultDevice, sizeof(buf_src), buf_dest);
|
||||||
idx_rx++;
|
idx_rx++;
|
||||||
if (idx_rx == sizeof(buf_src)) {
|
if (idx_rx == sizeof(buf_src)) {
|
||||||
if ( memcmp(buf_dest, buf_src, sizeof(buf_src)) ) {
|
if ( memcmp(buf_dest, buf_src, sizeof(buf_src)) ) {
|
||||||
@@ -278,7 +278,7 @@ static void test_uart_event(void) {
|
|||||||
if (Uart1ChAvailable()) {
|
if (Uart1ChAvailable()) {
|
||||||
buf_dest[idx_rx] = Uart1Getch();
|
buf_dest[idx_rx] = Uart1Getch();
|
||||||
if (idx_rx<sizeof(buf_src)) {
|
if (idx_rx<sizeof(buf_src)) {
|
||||||
DOWNLINK_SEND_DEBUG(DefaultChannel, sizeof(buf_src), buf_dest);
|
DOWNLINK_SEND_DEBUG(DefaultChannel, DefaultDevice, sizeof(buf_src), buf_dest);
|
||||||
idx_rx++;
|
idx_rx++;
|
||||||
if (idx_rx == sizeof(buf_src)) {
|
if (idx_rx == sizeof(buf_src)) {
|
||||||
if ( memcmp(buf_dest, buf_src, sizeof(buf_src)) ) {
|
if ( memcmp(buf_dest, buf_src, sizeof(buf_src)) ) {
|
||||||
@@ -330,7 +330,7 @@ void dl_parse_msg(void) {
|
|||||||
|
|
||||||
case DL_PING:
|
case DL_PING:
|
||||||
{
|
{
|
||||||
DOWNLINK_SEND_PONG(DefaultChannel);
|
DOWNLINK_SEND_PONG(DefaultChannel, DefaultDevice);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -340,7 +340,7 @@ void dl_parse_msg(void) {
|
|||||||
uint8_t i = DL_SETTING_index(dl_buffer);
|
uint8_t i = DL_SETTING_index(dl_buffer);
|
||||||
float var = DL_SETTING_value(dl_buffer);
|
float var = DL_SETTING_value(dl_buffer);
|
||||||
DlSetting(i, var);
|
DlSetting(i, var);
|
||||||
DOWNLINK_SEND_DL_VALUE(DefaultChannel, &i, &var);
|
DOWNLINK_SEND_DL_VALUE(DefaultChannel, DefaultDevice, &i, &var);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
@@ -60,10 +60,10 @@ static inline void main_init( void ) {
|
|||||||
static inline void main_periodic_task( void ) {
|
static inline void main_periodic_task( void ) {
|
||||||
|
|
||||||
|
|
||||||
RunOnceEvery(256, {DOWNLINK_SEND_ALIVE(DefaultChannel, 16, MD5SUM);});
|
RunOnceEvery(256, {DOWNLINK_SEND_ALIVE(DefaultChannel, DefaultDevice, 16, MD5SUM);});
|
||||||
RunOnceEvery(256,
|
RunOnceEvery(256,
|
||||||
{
|
{
|
||||||
DOWNLINK_SEND_I2C_ERRORS(DefaultChannel,
|
DOWNLINK_SEND_I2C_ERRORS(DefaultChannel, DefaultDevice,
|
||||||
&i2c1_errors.ack_fail_cnt,
|
&i2c1_errors.ack_fail_cnt,
|
||||||
&i2c1_errors.miss_start_stop_cnt,
|
&i2c1_errors.miss_start_stop_cnt,
|
||||||
&i2c1_errors.arb_lost_cnt,
|
&i2c1_errors.arb_lost_cnt,
|
||||||
|
|||||||
@@ -68,8 +68,8 @@ int main( void ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static inline void main_periodic_task( void ) {
|
static inline void main_periodic_task( void ) {
|
||||||
RunOnceEvery(100, {DOWNLINK_SEND_ALIVE(DefaultChannel, 16, MD5SUM);});
|
RunOnceEvery(100, {DOWNLINK_SEND_ALIVE(DefaultChannel, DefaultDevice, 16, MD5SUM);});
|
||||||
RunOnceEvery(100, {/*LED_TOGGLE(7);*/ DOWNLINK_SEND_TIME(DefaultChannel, &cpu_time_sec);});
|
RunOnceEvery(100, {/*LED_TOGGLE(7);*/ DOWNLINK_SEND_TIME(DefaultChannel, DefaultDevice, &cpu_time_sec);});
|
||||||
LED_PERIODIC();
|
LED_PERIODIC();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -82,7 +82,7 @@ static inline void main_event_task( void ) {
|
|||||||
// v1 = (((adc0_buf.values[0])));
|
// v1 = (((adc0_buf.values[0])));
|
||||||
v1 = adc0_buf.sum/adc0_buf.av_nb_sample;
|
v1 = adc0_buf.sum/adc0_buf.av_nb_sample;
|
||||||
v2 = (((adc3_buf.values[0])));
|
v2 = (((adc3_buf.values[0])));
|
||||||
RunOnceEvery(100, {DOWNLINK_SEND_ADC_GENERIC(DefaultChannel, &v1, &v2)});
|
RunOnceEvery(100, {DOWNLINK_SEND_ADC_GENERIC(DefaultChannel, DefaultDevice, &v1, &v2)});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ static inline void main_periodic_task( void ) {
|
|||||||
cscp_transmit(0, 0, (uint8_t *)servos, 8);
|
cscp_transmit(0, 0, (uint8_t *)servos, 8);
|
||||||
|
|
||||||
LED_PERIODIC();
|
LED_PERIODIC();
|
||||||
DOWNLINK_SEND_ALIVE(DefaultChannel, 16, MD5SUM);
|
DOWNLINK_SEND_ALIVE(DefaultChannel, DefaultDevice, 16, MD5SUM);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -105,17 +105,17 @@ static inline void main_event_task( void ) {
|
|||||||
LED_OFF(2);
|
LED_OFF(2);
|
||||||
LED_OFF(3);
|
LED_OFF(3);
|
||||||
|
|
||||||
// DOWNLINK_SEND_ALIVE(DefaultChannel, 16, MD5SUM);
|
// DOWNLINK_SEND_ALIVE(DefaultChannel, DefaultDevice, 16, MD5SUM);
|
||||||
}
|
}
|
||||||
|
|
||||||
void main_on_vane_msg(void *data)
|
void main_on_vane_msg(void *data)
|
||||||
{
|
{
|
||||||
int zero = 0;
|
int zero = 0;
|
||||||
|
|
||||||
// DOWNLINK_SEND_PONG(DefaultChannel);
|
// DOWNLINK_SEND_PONG(DefaultChannel, DefaultDevice);
|
||||||
|
|
||||||
// RunOnceEvery(10, {
|
// RunOnceEvery(10, {
|
||||||
DOWNLINK_SEND_VANE_SENSOR(DefaultChannel,
|
DOWNLINK_SEND_VANE_SENSOR(DefaultChannel, DefaultDevice,
|
||||||
&(csc_vane_msg.vane_angle1),
|
&(csc_vane_msg.vane_angle1),
|
||||||
&zero,
|
&zero,
|
||||||
&zero,
|
&zero,
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ static inline void main_init( void ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static inline void main_periodic( void ) {
|
static inline void main_periodic( void ) {
|
||||||
RunOnceEvery(100, {DOWNLINK_SEND_ALIVE(DefaultChannel, 16, MD5SUM);});
|
RunOnceEvery(100, {DOWNLINK_SEND_ALIVE(DefaultChannel, DefaultDevice, 16, MD5SUM);});
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void main_event( void ) {
|
static inline void main_event( void ) {
|
||||||
@@ -67,7 +67,7 @@ void dl_parse_msg(void) {
|
|||||||
|
|
||||||
case DL_PING:
|
case DL_PING:
|
||||||
{
|
{
|
||||||
DOWNLINK_SEND_PONG(DefaultChannel);
|
DOWNLINK_SEND_PONG(DefaultChannel, DefaultDevice);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,11 +58,11 @@ static inline void main_periodic( void ) {
|
|||||||
float i = sqrt(f); // ok
|
float i = sqrt(f); // ok
|
||||||
//float i = powf(f1, f1); // nok
|
//float i = powf(f1, f1); // nok
|
||||||
//float i = atan2(f, f); // ok
|
//float i = atan2(f, f); // ok
|
||||||
RunOnceEvery(10, {DOWNLINK_SEND_TEST_FORMAT(DefaultChannel, &d1, &i);});
|
RunOnceEvery(10, {DOWNLINK_SEND_TEST_FORMAT(DefaultChannel, DefaultDevice, &d1, &i);});
|
||||||
|
|
||||||
uint16_t blaaa = f+d;
|
uint16_t blaaa = f+d;
|
||||||
|
|
||||||
RunOnceEvery(10, {DOWNLINK_SEND_BOOT(DefaultChannel, &blaaa);});
|
RunOnceEvery(10, {DOWNLINK_SEND_BOOT(DefaultChannel, DefaultDevice, &blaaa);});
|
||||||
LED_PERIODIC();
|
LED_PERIODIC();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ static inline void main_periodic_task( void ) {
|
|||||||
GPIOC->BSRR = GPIO_Pin_4;
|
GPIOC->BSRR = GPIO_Pin_4;
|
||||||
foo = !foo;
|
foo = !foo;
|
||||||
#endif
|
#endif
|
||||||
RunOnceEvery(10, {DOWNLINK_SEND_BOOT(DefaultChannel, &cpu_time_sec);});
|
RunOnceEvery(10, {DOWNLINK_SEND_BOOT(DefaultChannel, DefaultDevice, &cpu_time_sec);});
|
||||||
LED_PERIODIC();
|
LED_PERIODIC();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -129,7 +129,7 @@ void spi1_irq_handler(void) {
|
|||||||
SPI_I2S_SendData(SPI1, cnt);
|
SPI_I2S_SendData(SPI1, cnt);
|
||||||
cnt++;
|
cnt++;
|
||||||
LED_TOGGLE(3);
|
LED_TOGGLE(3);
|
||||||
DOWNLINK_SEND_DEBUG_MCU_LINK(DefaultChannel, &foo, &foo, &cnt);
|
DOWNLINK_SEND_DEBUG_MCU_LINK(DefaultChannel, DefaultDevice, &foo, &foo, &cnt);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ static inline void main_init( void ) {
|
|||||||
static inline void main_periodic_task( void ) {
|
static inline void main_periodic_task( void ) {
|
||||||
RunOnceEvery(10,
|
RunOnceEvery(10,
|
||||||
{
|
{
|
||||||
DOWNLINK_SEND_BOOT(DefaultChannel, &cpu_time_sec);
|
DOWNLINK_SEND_BOOT(DefaultChannel, DefaultDevice, &cpu_time_sec);
|
||||||
LED_PERIODIC();
|
LED_PERIODIC();
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -78,7 +78,7 @@ static inline void main_event_task( void ) {
|
|||||||
#ifdef USE_DMA
|
#ifdef USE_DMA
|
||||||
if (DMA_GetFlagStatus(DMA1_FLAG_TC2)) {
|
if (DMA_GetFlagStatus(DMA1_FLAG_TC2)) {
|
||||||
LED_TOGGLE(3);
|
LED_TOGGLE(3);
|
||||||
RunOnceEvery(10, {DOWNLINK_SEND_DEBUG_MCU_LINK(DefaultChannel, &SPI_SLAVE_Buffer_Rx[0],
|
RunOnceEvery(10, {DOWNLINK_SEND_DEBUG_MCU_LINK(DefaultChannel, DefaultDevice, &SPI_SLAVE_Buffer_Rx[0],
|
||||||
&SPI_SLAVE_Buffer_Rx[1], &SPI_SLAVE_Buffer_Rx[2]);});
|
&SPI_SLAVE_Buffer_Rx[1], &SPI_SLAVE_Buffer_Rx[2]);});
|
||||||
memcpy(SPI_SLAVE_Buffer_Tx, SPI_SLAVE_Buffer_Rx, BufferSize);
|
memcpy(SPI_SLAVE_Buffer_Tx, SPI_SLAVE_Buffer_Rx, BufferSize);
|
||||||
main_setup_dma();
|
main_setup_dma();
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ static void MPPT_ask( void ) {
|
|||||||
fbw_current_milliamp = MPPT_data[MPPT_IBAT_INDEX];
|
fbw_current_milliamp = MPPT_data[MPPT_IBAT_INDEX];
|
||||||
|
|
||||||
MPPT_data[MPPT_ITOTAL_INDEX] = MPPT_data[MPPT_IBAT_INDEX] + MPPT_data[MPPT_ICONV_INDEX];
|
MPPT_data[MPPT_ITOTAL_INDEX] = MPPT_data[MPPT_IBAT_INDEX] + MPPT_data[MPPT_ICONV_INDEX];
|
||||||
DOWNLINK_SEND_MPPT(DefaultChannel, NB_DATA, MPPT_data);
|
DOWNLINK_SEND_MPPT(DefaultChannel, DefaultDevice, NB_DATA, MPPT_data);
|
||||||
data_index = 0;
|
data_index = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -46,5 +46,5 @@ void MPPT_init( void ) {
|
|||||||
void MPPT_periodic( void ) {
|
void MPPT_periodic( void ) {
|
||||||
MPPT_data[MPPT_ITOTAL_INDEX] = MPPT_data[MPPT_IBAT_INDEX] + MPPT_data[MPPT_ICONV_INDEX];
|
MPPT_data[MPPT_ITOTAL_INDEX] = MPPT_data[MPPT_IBAT_INDEX] + MPPT_data[MPPT_ICONV_INDEX];
|
||||||
|
|
||||||
RunOnceEvery(8, DOWNLINK_SEND_MPPT(DefaultChannel, NB_DATA, MPPT_data));
|
RunOnceEvery(8, DOWNLINK_SEND_MPPT(DefaultChannel, DefaultDevice, NB_DATA, MPPT_data));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,6 +47,6 @@ void adc_generic_periodic( void ) {
|
|||||||
adc_generic_val2 = buf_generic2.sum / buf_generic2.av_nb_sample;
|
adc_generic_val2 = buf_generic2.sum / buf_generic2.av_nb_sample;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
DOWNLINK_SEND_ADC_GENERIC(DefaultChannel, &adc_generic_val1, &adc_generic_val2);
|
DOWNLINK_SEND_ADC_GENERIC(DefaultChannel, DefaultDevice, &adc_generic_val1, &adc_generic_val2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ void max11040_periodic(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
DOWNLINK_SEND_TURB_PRESSURE_VOLTAGE(
|
DOWNLINK_SEND_TURB_PRESSURE_VOLTAGE(
|
||||||
DefaultChannel,
|
DefaultChannel, DefaultDevice,
|
||||||
&max11040_values_f[0],
|
&max11040_values_f[0],
|
||||||
&max11040_values_f[1],
|
&max11040_values_f[1],
|
||||||
&max11040_values_f[2],
|
&max11040_values_f[2],
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ void flight_benchmark_periodic( void ) {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
DOWNLINK_SEND_FLIGHT_BENCHMARK(DefaultChannel, &SquareSumErr_airspeed, &SquareSumErr_altitude, &SquareSumErr_position, &Err_airspeed, &Err_altitude, &Err_position)
|
DOWNLINK_SEND_FLIGHT_BENCHMARK(DefaultChannel, DefaultDevice, &SquareSumErr_airspeed, &SquareSumErr_altitude, &SquareSumErr_position, &Err_airspeed, &Err_altitude, &Err_position)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ void track_periodic_task(void) {
|
|||||||
for (i = 0; i < c; i++) {
|
for (i = 0; i < c; i++) {
|
||||||
CamUartSend1(cmd_msg[i]);
|
CamUartSend1(cmd_msg[i]);
|
||||||
}
|
}
|
||||||
//DOWNLINK_SEND_DEBUG(DefaultChannel,c,cmd_msg);
|
//DOWNLINK_SEND_DEBUG(DefaultChannel, DefaultDevice,c,cmd_msg);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -188,13 +188,13 @@ void parse_cam_msg( void ) {
|
|||||||
ptr++;
|
ptr++;
|
||||||
*ptr = cam_data_buf[11];
|
*ptr = cam_data_buf[11];
|
||||||
|
|
||||||
//DOWNLINK_SEND_DEBUG(DefaultChannel,12,cam_data_buf);
|
//DOWNLINK_SEND_DEBUG(DefaultChannel, DefaultDevice,12,cam_data_buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
void parse_cam_buffer( uint8_t c ) {
|
void parse_cam_buffer( uint8_t c ) {
|
||||||
char bla[1];
|
char bla[1];
|
||||||
bla[1] = c;
|
bla[1] = c;
|
||||||
//DOWNLINK_SEND_DEBUG(DefaultChannel,1,bla);
|
//DOWNLINK_SEND_DEBUG(DefaultChannel, DefaultDevice,1,bla);
|
||||||
switch (cam_status) {
|
switch (cam_status) {
|
||||||
case UNINIT:
|
case UNINIT:
|
||||||
if (c != CAM_START_1)
|
if (c != CAM_START_1)
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user