diff --git a/conf/airframes/ESDEN/esden_quady_ls10pwm.xml b/conf/airframes/ESDEN/esden_quady_ls10pwm.xml index b723105a2c..bd81401e22 100644 --- a/conf/airframes/ESDEN/esden_quady_ls10pwm.xml +++ b/conf/airframes/ESDEN/esden_quady_ls10pwm.xml @@ -149,7 +149,7 @@ - + diff --git a/conf/airframes/tudelft/bebop2_indi.xml b/conf/airframes/tudelft/bebop2_indi.xml index 192cf920fb..729381b3a0 100644 --- a/conf/airframes/tudelft/bebop2_indi.xml +++ b/conf/airframes/tudelft/bebop2_indi.xml @@ -7,10 +7,10 @@ - + diff --git a/conf/airframes/tudelft/bebop_indi_actuators.xml b/conf/airframes/tudelft/bebop_indi_actuators.xml index 4cf3fd66f1..ddd7fe0add 100644 --- a/conf/airframes/tudelft/bebop_indi_actuators.xml +++ b/conf/airframes/tudelft/bebop_indi_actuators.xml @@ -7,10 +7,10 @@ - + diff --git a/conf/airframes/tudelft/fan_demo.xml b/conf/airframes/tudelft/fan_demo.xml index 61805cf5f8..647dfeb817 100644 --- a/conf/airframes/tudelft/fan_demo.xml +++ b/conf/airframes/tudelft/fan_demo.xml @@ -5,10 +5,10 @@ - + diff --git a/conf/userconf/tudelft/conf.xml b/conf/userconf/tudelft/conf.xml index f1e0ad2c66..ef22eeaf54 100644 --- a/conf/userconf/tudelft/conf.xml +++ b/conf/userconf/tudelft/conf.xml @@ -201,50 +201,6 @@ gui_color="white" release="65aa9a711dc4a66ed2d7cf73c0f5872bbeeb821d" /> - - - - (INT32_ANGLE_PI << (INT32_ANGLE_HIGH_RES_FRAC - INT32_ANGLE_FRAC))) (_a) -= (INT32_ANGLE_2_PI << (INT32_ANGLE_HIGH_RES_FRAC - INT32_ANGLE_FRAC)); \ - while ((_a) < (-INT32_ANGLE_PI << (INT32_ANGLE_HIGH_RES_FRAC - INT32_ANGLE_FRAC))) (_a) += (INT32_ANGLE_2_PI << (INT32_ANGLE_HIGH_RES_FRAC - INT32_ANGLE_FRAC)); \ + while ((_a) < -(INT32_ANGLE_PI << (INT32_ANGLE_HIGH_RES_FRAC - INT32_ANGLE_FRAC))) (_a) += (INT32_ANGLE_2_PI << (INT32_ANGLE_HIGH_RES_FRAC - INT32_ANGLE_FRAC)); \ } void guidance_hybrid_run(void) diff --git a/sw/airborne/modules/computer_vision/cv_blob_locator.c b/sw/airborne/modules/computer_vision/cv_blob_locator.c index 1953d53567..f85acc2201 100644 --- a/sw/airborne/modules/computer_vision/cv_blob_locator.c +++ b/sw/airborne/modules/computer_vision/cv_blob_locator.c @@ -23,17 +23,17 @@ * Find a colored item and track its geo-location and update a waypoint to it */ -#ifndef BLOB_LOCATOR_FPS -#define BLOB_LOCATOR_FPS 0 ///< Default FPS (zero means run at camera fps) -#endif -PRINT_CONFIG_VAR(BLOB_LOCATOR_FPS) - #include "modules/computer_vision/cv_blob_locator.h" #include "modules/computer_vision/cv.h" #include "modules/computer_vision/blob/blob_finder.h" #include "modules/computer_vision/blob/imavmarker.h" #include "modules/computer_vision/detect_window.h" +#ifndef BLOB_LOCATOR_FPS +#define BLOB_LOCATOR_FPS 0 ///< Default FPS (zero means run at camera fps) +#endif +PRINT_CONFIG_VAR(BLOB_LOCATOR_FPS) + uint8_t color_lum_min; uint8_t color_lum_max; diff --git a/sw/airborne/modules/computer_vision/detect_window.c b/sw/airborne/modules/computer_vision/detect_window.c index 3576084bcc..15ab5dd3ed 100644 --- a/sw/airborne/modules/computer_vision/detect_window.c +++ b/sw/airborne/modules/computer_vision/detect_window.c @@ -27,18 +27,22 @@ #define RES 100 #define N_WINDOW_SIZES 1 +#include "cv.h" +#include "detect_window.h" +#include + #ifndef DETECT_WINDOW_FPS #define DETECT_WINDOW_FPS 0 ///< Default FPS (zero means run at camera fps) #endif PRINT_CONFIG_VAR(DETECT_WINDOW_FPS) -#include "cv.h" -#include "detect_window.h" -#include - void detect_window_init(void) { +#ifdef DETECT_WINDOW_CAMERA cv_add_to_device(&DETECT_WINDOW_CAMERA, detect_window, DETECT_WINDOW_FPS); +#else +#warning "DETECT_WINDOW_CAMERA not defined, CV callback not added to device" +#endif } struct image_t *detect_window(struct image_t *img) diff --git a/sw/airborne/modules/computer_vision/lib/vision/act_fast.c b/sw/airborne/modules/computer_vision/lib/vision/act_fast.c index 8b52ff1027..897dbbee6b 100644 --- a/sw/airborne/modules/computer_vision/lib/vision/act_fast.c +++ b/sw/airborne/modules/computer_vision/lib/vision/act_fast.c @@ -112,7 +112,7 @@ void act_fast(struct image_t *img, uint8_t fast_threshold, uint16_t *num_corners break; } else { // make a step: - struct point_t loc = {agents[a].x, agents[a].y}; + struct point_t loc = { .x = agents[a].x, .y = agents[a].y}; image_gradient_pixel(img, &loc, gradient_method, &dx, &dy); int gradient = (abs(dx) + abs(dy)) / 2; if (abs(gradient) >= min_gradient) { diff --git a/sw/airborne/modules/computer_vision/lib/vision/image.c b/sw/airborne/modules/computer_vision/lib/vision/image.c index 0eee492838..4e3d157cca 100644 --- a/sw/airborne/modules/computer_vision/lib/vision/image.c +++ b/sw/airborne/modules/computer_vision/lib/vision/image.c @@ -708,12 +708,12 @@ void image_show_flow_color(struct image_t *img, struct flow_t *vectors, uint16_t for (uint16_t i = 0; i < points_cnt; i++) { // Draw a line from the original position with the flow vector struct point_t from = { - vectors[i].pos.x / subpixel_factor, - vectors[i].pos.y / subpixel_factor + .x = vectors[i].pos.x / subpixel_factor, + .y = vectors[i].pos.y / subpixel_factor }; struct point_t to = { - (vectors[i].pos.x + vectors[i].flow_x) / subpixel_factor, - (vectors[i].pos.y + vectors[i].flow_y) / subpixel_factor + .x = (vectors[i].pos.x + vectors[i].flow_x) / subpixel_factor, + .y = (vectors[i].pos.y + vectors[i].flow_y) / subpixel_factor }; if (vectors[i].error >= LARGE_FLOW_ERROR) { @@ -847,7 +847,7 @@ void image_draw_rectangle(struct image_t *img, int x_min, int x_max, int y_min, * Example colors: white = {127, 255, 127, 255}, green = {0, 127, 0, 127}; * @param[in] size_crosshair Actually the half size of the cross hair */ -void image_draw_crosshair(struct image_t *img, struct point_t *loc, const uint8_t *color, int size_crosshair) +void image_draw_crosshair(struct image_t *img, struct point_t *loc, const uint8_t *color, uint32_t size_crosshair) { struct point_t from, to; diff --git a/sw/airborne/modules/computer_vision/lib/vision/image.h b/sw/airborne/modules/computer_vision/lib/vision/image.h index c4a2f4a66e..91ab345ce2 100644 --- a/sw/airborne/modules/computer_vision/lib/vision/image.h +++ b/sw/airborne/modules/computer_vision/lib/vision/image.h @@ -107,7 +107,7 @@ void image_show_points_color(struct image_t *img, struct point_t *points, uint16 void image_show_flow_color(struct image_t *img, struct flow_t *vectors, uint16_t points_cnt, uint8_t subpixel_factor, const uint8_t *color, const uint8_t *bad_color); void image_show_flow(struct image_t *img, struct flow_t *vectors, uint16_t points_cnt, uint8_t subpixel_factor); -void image_draw_crosshair(struct image_t *img, struct point_t *loc, const uint8_t *color, int size_crosshair); +void image_draw_crosshair(struct image_t *img, struct point_t *loc, const uint8_t *color, uint32_t size_crosshair); void image_draw_rectangle(struct image_t *img, int x_min, int x_max, int y_min, int y_max, uint8_t *color); void image_draw_line(struct image_t *img, struct point_t *from, struct point_t *to); void image_draw_line_color(struct image_t *img, struct point_t *from, struct point_t *to, const uint8_t *color); diff --git a/sw/airborne/modules/computer_vision/opticflow/opticflow_calculator.c b/sw/airborne/modules/computer_vision/opticflow/opticflow_calculator.c index 51e1afc9eb..7ccf79032b 100644 --- a/sw/airborne/modules/computer_vision/opticflow/opticflow_calculator.c +++ b/sw/airborne/modules/computer_vision/opticflow/opticflow_calculator.c @@ -1050,7 +1050,7 @@ static int cmp_flow(const void *a, const void *b) */ static int cmp_array(const void *a, const void *b) { - uint16_t *pa = *(uint16_t **)a; - uint16_t *pb = *(uint16_t **)b; + const uint16_t *pa = (const uint16_t *)a; + const uint16_t *pb = (const uint16_t *)b; return pa[0] - pb[0]; } diff --git a/sw/airborne/modules/ctrl/ctrl_module_outerloop_demo.c b/sw/airborne/modules/ctrl/ctrl_module_outerloop_demo.c index 7f0748b01b..08b2b5df12 100644 --- a/sw/airborne/modules/ctrl/ctrl_module_outerloop_demo.c +++ b/sw/airborne/modules/ctrl/ctrl_module_outerloop_demo.c @@ -29,7 +29,8 @@ #include "subsystems/radio_control.h" #include "firmwares/rotorcraft/stabilization.h" #include "firmwares/rotorcraft/stabilization/stabilization_attitude.h" - +#include "firmwares/rotorcraft/stabilization/stabilization_attitude_rc_setpoint.h" +#include "autopilot.h" // Own Variables @@ -60,12 +61,12 @@ void guidance_h_module_enter(void) ctrl.cmd.psi = stateGetNedToBodyEulers_i()->psi; // Convert RC to setpoint - stabilization_attitude_read_rc_setpoint_eulers(&rc_sp, in_flight, false, false); + stabilization_attitude_read_rc_setpoint_eulers(&ctrl.rc_sp, autopilot.in_flight, false, false); } void guidance_h_module_read_rc(void) { - stabilization_attitude_read_rc_setpoint_eulers(&rc_sp, in_flight, false, false); + stabilization_attitude_read_rc_setpoint_eulers(&ctrl.rc_sp, autopilot.in_flight, false, false); } diff --git a/sw/airborne/modules/ins/xsens700.c b/sw/airborne/modules/ins/xsens700.c index 6114cba73b..398096db9f 100644 --- a/sw/airborne/modules/ins/xsens700.c +++ b/sw/airborne/modules/ins/xsens700.c @@ -27,7 +27,9 @@ #include "xsens700.h" +#include "led.h" #include "generated/airframe.h" +#include "mcu_periph/uart.h" #if USE_GPS_XSENS #include "math/pprz_geodetic_wgs84.h" @@ -50,7 +52,7 @@ volatile int xsens_configured = 0; void xsens700_init(void) { - xsens.parser.status = UNINIT; + xsens700.parser.status = UNINIT; xsens_configured = 30; xsens_msg_statusword = 0; @@ -139,17 +141,17 @@ void xsens700_periodic(void) void parse_xsens700_msg(void) { uint8_t offset = 0; - if (xsens.parser.id == XSENS_ReqLeverArmGpsAck_ID) { - xsens_gps_arm_x = XSENS_ReqLeverArmGpsAck_x(xsens.parser.msg_buf); - xsens_gps_arm_y = XSENS_ReqLeverArmGpsAck_y(xsens.parser.msg_buf); - xsens_gps_arm_z = XSENS_ReqLeverArmGpsAck_z(xsens.parser.msg_buf); - } else if (xsens.parser.id == XSENS_Error_ID) { - xsens_errorcode = XSENS_Error_errorcode(xsens.parser.msg_buf); - } else if (xsens.parser.id == XSENS_MTData2_ID) { - for (offset = 0; offset < xsens.parser.len;) { - uint8_t code1 = xsens.parser.msg_buf[offset]; - uint8_t code2 = xsens.parser.msg_buf[offset + 1]; - int subpacklen = (int)xsens.parser.msg_buf[offset + 2]; + if (xsens700.parser.id == XSENS_ReqLeverArmGpsAck_ID) { + xsens_gps_arm_x = XSENS_ReqLeverArmGpsAck_x(xsens700.parser.msg_buf); + xsens_gps_arm_y = XSENS_ReqLeverArmGpsAck_y(xsens700.parser.msg_buf); + xsens_gps_arm_z = XSENS_ReqLeverArmGpsAck_z(xsens700.parser.msg_buf); + } else if (xsens700.parser.id == XSENS_Error_ID) { + xsens_errorcode = XSENS_Error_errorcode(xsens700.parser.msg_buf); + } else if (xsens700.parser.id == XSENS_MTData2_ID) { + for (offset = 0; offset < xsens700.parser.len;) { + uint8_t code1 = xsens700.parser.msg_buf[offset]; + uint8_t code2 = xsens700.parser.msg_buf[offset + 1]; + int subpacklen = (int)xsens700.parser.msg_buf[offset + 2]; offset += 3; if (code1 == 0x10) { @@ -164,25 +166,25 @@ void parse_xsens700_msg(void) } else if (code1 == 0x20) { if (code2 == 0x30) { // Attitude Euler - xsens700.euler.phi = XSENS_DATA_Euler_roll(xsens.parser.msg_buf, offset) * M_PI / 180; - xsens700.euler.theta = XSENS_DATA_Euler_pitch(xsens.parser.msg_buf, offset) * M_PI / 180; - xsens700.euler.psi = XSENS_DATA_Euler_yaw(xsens.parser.msg_buf, offset) * M_PI / 180; + xsens700.euler.phi = XSENS_DATA_Euler_roll(xsens700.parser.msg_buf, offset) * M_PI / 180; + xsens700.euler.theta = XSENS_DATA_Euler_pitch(xsens700.parser.msg_buf, offset) * M_PI / 180; + xsens700.euler.psi = XSENS_DATA_Euler_yaw(xsens700.parser.msg_buf, offset) * M_PI / 180; xsens700.new_attitude = TRUE; } } else if (code1 == 0x40) { if (code2 == 0x10) { // Delta-V - xsens700.accel.x = XSENS_DATA_Acceleration_x(xsens.parser.msg_buf, offset) * 100.0f; - xsens700.accel.y = XSENS_DATA_Acceleration_y(xsens.parser.msg_buf, offset) * 100.0f; - xsens700.accel.z = XSENS_DATA_Acceleration_z(xsens.parser.msg_buf, offset) * 100.0f; + xsens700.accel.x = XSENS_DATA_Acceleration_x(xsens700.parser.msg_buf, offset) * 100.0f; + xsens700.accel.y = XSENS_DATA_Acceleration_y(xsens700.parser.msg_buf, offset) * 100.0f; + xsens700.accel.z = XSENS_DATA_Acceleration_z(xsens700.parser.msg_buf, offset) * 100.0f; } } else if (code1 == 0x80) { if (code2 == 0x20) { // Rate Of Turn - xsens700.gyro.p = XSENS_DATA_RateOfTurn_x(xsens.parser.msg_buf, offset) * M_PI / 180; - xsens700.gyro.q = XSENS_DATA_RateOfTurn_y(xsens.parser.msg_buf, offset) * M_PI / 180; - xsens700.gyro.r = XSENS_DATA_RateOfTurn_z(xsens.parser.msg_buf, offset) * M_PI / 180; + xsens700.gyro.p = XSENS_DATA_RateOfTurn_x(xsens700.parser.msg_buf, offset) * M_PI / 180; + xsens700.gyro.q = XSENS_DATA_RateOfTurn_y(xsens700.parser.msg_buf, offset) * M_PI / 180; + xsens700.gyro.r = XSENS_DATA_RateOfTurn_z(xsens700.parser.msg_buf, offset) * M_PI / 180; } } else if (code1 == 0x30) { if (code2 == 0x10) { @@ -191,7 +193,7 @@ void parse_xsens700_msg(void) } else if (code1 == 0xE0) { if (code2 == 0x20) { // Status Word - xsens_msg_statusword = XSENS_DATA_StatusWord_status(xsens.parser.msg_buf, offset); + xsens_msg_statusword = XSENS_DATA_StatusWord_status(xsens700.parser.msg_buf, offset); //xsens700.gps.tow = xsens_msg_statusword; #if USE_GPS_XSENS if (bit_is_set(xsens_msg_statusword, 2) && bit_is_set(xsens_msg_statusword, 1)) { @@ -205,17 +207,17 @@ void parse_xsens700_msg(void) } } else if (code1 == 0x88) { if (code2 == 0x40) { - xsens700.gps.week = XSENS_DATA_GpsSol_week(xsens.parser.msg_buf, offset); - xsens700.gps.num_sv = XSENS_DATA_GpsSol_numSv(xsens.parser.msg_buf, offset); - xsens700.gps.pacc = XSENS_DATA_GpsSol_pAcc(xsens.parser.msg_buf, offset); - xsens700.gps.sacc = XSENS_DATA_GpsSol_sAcc(xsens.parser.msg_buf, offset); - xsens700.gps.pdop = XSENS_DATA_GpsSol_pDop(xsens.parser.msg_buf, offset); + xsens700.gps.week = XSENS_DATA_GpsSol_week(xsens700.parser.msg_buf, offset); + xsens700.gps.num_sv = XSENS_DATA_GpsSol_numSv(xsens700.parser.msg_buf, offset); + xsens700.gps.pacc = XSENS_DATA_GpsSol_pAcc(xsens700.parser.msg_buf, offset); + xsens700.gps.sacc = XSENS_DATA_GpsSol_sAcc(xsens700.parser.msg_buf, offset); + xsens700.gps.pdop = XSENS_DATA_GpsSol_pDop(xsens700.parser.msg_buf, offset); } else if (code2 == 0xA0) { // SVINFO - xsens700.gps.tow = XSENS_XDI_GpsSvInfo_iTOW(xsens.parser.msg_buf + offset); + xsens700.gps.tow = XSENS_XDI_GpsSvInfo_iTOW(xsens700.parser.msg_buf + offset); #if USE_GPS_XSENS - xsens700.gps.nb_channels = XSENS_XDI_GpsSvInfo_nch(xsens.parser.msg_buf + offset); + xsens700.gps.nb_channels = XSENS_XDI_GpsSvInfo_nch(xsens700.parser.msg_buf + offset); xsens700.gps.last_3dfix_ticks = sys_time.nb_sec_rem; xsens700.gps.last_3dfix_time = sys_time.nb_sec; @@ -223,21 +225,21 @@ void parse_xsens700_msg(void) uint8_t i; // Do not write outside buffer for (i = 0; i < Min(xsens700.gps.nb_channels, GPS_NB_CHANNELS); i++) { - uint8_t ch = XSENS_XDI_GpsSvInfo_chn(xsens.parser.msg_buf + offset, i); + uint8_t ch = XSENS_XDI_GpsSvInfo_chn(xsens700.parser.msg_buf + offset, i); if (ch > xsens700.gps.nb_channels) { continue; } - xsens700.gps.svinfos[ch].svid = XSENS_XDI_GpsSvInfo_svid(xsens.parser.msg_buf + offset, i); - xsens700.gps.svinfos[ch].flags = XSENS_XDI_GpsSvInfo_bitmask(xsens.parser.msg_buf + offset, i); - xsens700.gps.svinfos[ch].qi = XSENS_XDI_GpsSvInfo_qi(xsens.parser.msg_buf + offset, i); - xsens700.gps.svinfos[ch].cno = XSENS_XDI_GpsSvInfo_cnr(xsens.parser.msg_buf + offset, i); + xsens700.gps.svinfos[ch].svid = XSENS_XDI_GpsSvInfo_svid(xsens700.parser.msg_buf + offset, i); + xsens700.gps.svinfos[ch].flags = XSENS_XDI_GpsSvInfo_bitmask(xsens700.parser.msg_buf + offset, i); + xsens700.gps.svinfos[ch].qi = XSENS_XDI_GpsSvInfo_qi(xsens700.parser.msg_buf + offset, i); + xsens700.gps.svinfos[ch].cno = XSENS_XDI_GpsSvInfo_cnr(xsens700.parser.msg_buf + offset, i); } #endif } } else if (code1 == 0x50) { if (code2 == 0x10) { - //xsens700.gps.hmsl = XSENS_DATA_Altitude_h(xsens.parser.msg_buf,offset)* 1000.0f; + //xsens700.gps.hmsl = XSENS_DATA_Altitude_h(xsens700.parser.msg_buf,offset)* 1000.0f; } else if (code2 == 0x20) { // Altitude Elipsoid - xsens700.gps.lla_pos.alt = XSENS_DATA_Altitude_h(xsens.parser.msg_buf, offset) * 1000.0f; + xsens700.gps.lla_pos.alt = XSENS_DATA_Altitude_h(xsens700.parser.msg_buf, offset) * 1000.0f; // Compute geoid (MSL) height float geoid_h = wgs84_ellipsoid_to_geoid_f(xsens700.lla_f.lat, xsens700.lla_f.lon); @@ -254,15 +256,15 @@ void parse_xsens700_msg(void) xsens700.gps.last_3dfix_time = sys_time.nb_sec; xsens700.gps.week = 0; // FIXME - xsens700.lla_f.lat = RadOfDeg(XSENS_DATA_LatLon_lat(xsens.parser.msg_buf, offset)); - xsens700.lla_f.lon = RadOfDeg(XSENS_DATA_LatLon_lon(xsens.parser.msg_buf, offset)); + xsens700.lla_f.lat = RadOfDeg(XSENS_DATA_LatLon_lat(xsens700.parser.msg_buf, offset)); + xsens700.lla_f.lon = RadOfDeg(XSENS_DATA_LatLon_lon(xsens700.parser.msg_buf, offset)); } } else if (code1 == 0xD0) { if (code2 == 0x10) { // Velocity - xsens700.vel.x = XSENS_DATA_VelocityXYZ_x(xsens.parser.msg_buf, offset); - xsens700.vel.y = XSENS_DATA_VelocityXYZ_y(xsens.parser.msg_buf, offset); - xsens700.vel.z = XSENS_DATA_VelocityXYZ_z(xsens.parser.msg_buf, offset); + xsens700.vel.x = XSENS_DATA_VelocityXYZ_x(xsens700.parser.msg_buf, offset); + xsens700.vel.y = XSENS_DATA_VelocityXYZ_y(xsens700.parser.msg_buf, offset); + xsens700.vel.z = XSENS_DATA_VelocityXYZ_z(xsens700.parser.msg_buf, offset); xsens700.gps.ned_vel.x = xsens700.vel.x; xsens700.gps.ned_vel.y = xsens700.vel.y; xsens700.gps.ned_vel.z = xsens700.vel.x; diff --git a/sw/airborne/modules/ins/xsens700.h b/sw/airborne/modules/ins/xsens700.h index af3d50609a..2cceb33ddd 100644 --- a/sw/airborne/modules/ins/xsens700.h +++ b/sw/airborne/modules/ins/xsens700.h @@ -34,7 +34,6 @@ #include "xsens_parser.h" - #if USE_GPS_XSENS #include "subsystems/gps.h" #endif diff --git a/sw/airborne/modules/sonar/sonar_bebop.c b/sw/airborne/modules/sonar/sonar_bebop.c index 46bd39c282..310035663f 100644 --- a/sw/airborne/modules/sonar/sonar_bebop.c +++ b/sw/airborne/modules/sonar/sonar_bebop.c @@ -38,6 +38,7 @@ #include "mcu_periph/spi.h" #include "subsystems/abi.h" #include +#include #include "subsystems/datalink/downlink.h"//FIXME, include only when link need #include "filters/median_filter.h" @@ -200,7 +201,9 @@ void *sonar_bebop_read(void *data __attribute__((unused))) // Send Telemetry report DOWNLINK_SEND_SONAR(DefaultChannel, DefaultDevice, &sonar_bebop.meas, &sonar_bebop.distance); #endif +#ifndef SITL } +#endif usleep(10000); //100Hz } return NULL; diff --git a/sw/airborne/modules/spektrum_soft_bind/spektrum_soft_bind_ap.c b/sw/airborne/modules/spektrum_soft_bind/spektrum_soft_bind_ap.c index 9ed9ae51bb..1ec91e56f7 100644 --- a/sw/airborne/modules/spektrum_soft_bind/spektrum_soft_bind_ap.c +++ b/sw/airborne/modules/spektrum_soft_bind/spektrum_soft_bind_ap.c @@ -31,14 +31,20 @@ #include "subsystems/radio_control.h" #include "mcu_periph/sys_time_arch.h" +#include "mcu_periph/uart.h" #include "mcu_periph/gpio.h" -void spektrum_soft_bind_init(void) { +void spektrum_soft_bind_init(void) +{ } +#define _UART_INIT(i) i ## _init() +#define UART_INIT(i) _UART_INIT(i) + bool bind_soft_value; -void spektrum_soft_bind_click(bool val ) { +void spektrum_soft_bind_click(bool val) +{ #ifndef INTER_MCU_AP send_spektrum_bind(); #else @@ -49,7 +55,8 @@ void spektrum_soft_bind_click(bool val ) { } #ifndef INTER_MCU_AP -void send_spektrum_bind(void) { +void send_spektrum_bind(void) +{ //power cycle the spektrum #if defined(RADIO_CONTROL_LED) LED_OFF(RADIO_CONTROL_LED); @@ -65,7 +72,11 @@ void send_spektrum_bind(void) { //put to bind mode RADIO_CONTROL_BIND_IMPL_FUNC(); //basically = radio_control_spektrum_try_bind() - SpektrumUartInit(); + // init uart peripherals + UART_INIT(SPEKTRUM_PRIMARY_UART); +#ifdef SPEKTRUM_SECONDARY_UART + UART_INIT(SPEKTRUM_SECONDARY_UART); +#endif } #endif diff --git a/sw/airborne/peripherals/mpu9250_spi.c b/sw/airborne/peripherals/mpu9250_spi.c index e39caa2838..9527a8b277 100644 --- a/sw/airborne/peripherals/mpu9250_spi.c +++ b/sw/airborne/peripherals/mpu9250_spi.c @@ -141,6 +141,7 @@ void mpu9250_spi_event(struct Mpu9250_Spi *mpu) switch (mpu->spi_trans.status) { case SPITransFailed: mpu->config.init_status--; // Retry config (TODO max retry) + /* Falls through. */ case SPITransSuccess: case SPITransDone: mpu9250_send_config(mpu9250_spi_write_to_reg, (void *)mpu, &(mpu->config)); diff --git a/sw/airborne/subsystems/ins/ins_int.c b/sw/airborne/subsystems/ins/ins_int.c index 3ebac6fac8..1bb207436c 100644 --- a/sw/airborne/subsystems/ins/ins_int.c +++ b/sw/airborne/subsystems/ins/ins_int.c @@ -476,7 +476,7 @@ void ins_int_update_gps(struct GpsState *gps_s __attribute__((unused))) {} * This is only used with the extended version of the vertical float filter */ #if USE_VFF_EXTENDED -static void agl_cb(uint8_t sender_id, float distance) { +static void agl_cb(uint8_t __attribute__((unused)) sender_id, float distance) { if (distance <= 0 || !(ins_int.baro_initialized)) { return; } diff --git a/sw/simulator/nps/nps_autopilot_rotorcraft.c b/sw/simulator/nps/nps_autopilot_rotorcraft.c index d79d2496e2..a423c975cc 100644 --- a/sw/simulator/nps/nps_autopilot_rotorcraft.c +++ b/sw/simulator/nps/nps_autopilot_rotorcraft.c @@ -133,8 +133,8 @@ void nps_autopilot_run_step(double time) float dist = (float) sensors.sonar.value; AbiSendMsgAGL(AGL_SONAR_NPS_ID, dist); - uint16_t foo = 0; #ifdef SENSOR_SYNC_SEND_SONAR + uint16_t foo = 0; DOWNLINK_SEND_SONAR(DefaultChannel, DefaultDevice, &foo, &dist); #endif