diff --git a/conf/Makefile.stm32 b/conf/Makefile.stm32
index a3b732c8c5..a2c605d29e 100644
--- a/conf/Makefile.stm32
+++ b/conf/Makefile.stm32
@@ -100,10 +100,16 @@ else
OOCD_BOARD = $($(TARGET).OOCD_BOARD)
endif
-ifndef NO_LUFTBOOT
+# default: assume the luftboot bootloader is used
+# if luftboot is not used define NO_LUFTBOOT to a value != 0
OOCD_START_SECTOR = 4
-else
+ASSUMING_LUFTBOOT = "yes"
+ifdef NO_LUFTBOOT
+$(shell echo luftboot: $(NO_LUFTBOOT))
+ifneq ($(NO_LUFTBOOT),0)
OOCD_START_SECTOR = 0
+ASSUMING_LUFTBOOT = "no"
+endif
endif
# input files
diff --git a/conf/airframes/ENAC/quadrotor/blender.xml b/conf/airframes/ENAC/quadrotor/blender.xml
index 5b0d0b2ed0..5acec3639b 100644
--- a/conf/airframes/ENAC/quadrotor/blender.xml
+++ b/conf/airframes/ENAC/quadrotor/blender.xml
@@ -3,17 +3,16 @@
+
-
-
+
@@ -27,29 +26,20 @@
-
+
-
+
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
@@ -67,8 +57,8 @@
-
-
+
+
@@ -80,49 +70,54 @@
-
-
-
+
+
+
-
-
-
+
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
+
-
-
-
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
-
+
+
+
+
+
+
@@ -160,30 +155,25 @@
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
@@ -195,8 +185,8 @@
-
-
+
+
@@ -215,13 +205,13 @@
@@ -238,16 +228,14 @@
-
+
diff --git a/conf/boards/lisa_m_1.0.makefile b/conf/boards/lisa_m_1.0.makefile
index d775e99e0c..cc4d6f0c2b 100644
--- a/conf/boards/lisa_m_1.0.makefile
+++ b/conf/boards/lisa_m_1.0.makefile
@@ -8,7 +8,9 @@
BOARD=lisa_m
BOARD_VERSION=1.0
BOARD_CFG=\"boards/$(BOARD)_$(BOARD_VERSION).h\"
+ifndef NO_LUFTBOOT
NO_LUFTBOOT=1
+endif
ARCH=stm32
$(TARGET).ARCHDIR = $(ARCH)
diff --git a/conf/conf.xml.example b/conf/conf.xml.example
index fb7a9966fc..b7c9fc3197 100644
--- a/conf/conf.xml.example
+++ b/conf/conf.xml.example
@@ -1,6 +1,5 @@
-
diff --git a/conf/firmwares/rotorcraft.makefile b/conf/firmwares/rotorcraft.makefile
index ac7a3bc4e3..7661f7f13f 100644
--- a/conf/firmwares/rotorcraft.makefile
+++ b/conf/firmwares/rotorcraft.makefile
@@ -142,10 +142,11 @@ ap.CFLAGS += -DUSE_I2C2
else ifeq ($(BOARD), lisa_m)
ap.CFLAGS += -DUSE_I2C2
else ifeq ($(BOARD), navgo)
-include $(CFG_ROTORCRAFT)/spi.makefile
+ap.CFLAGS += -DUSE_SPI
ap.CFLAGS += -DUSE_SPI_SLAVE0
ap.CFLAGS += -DSPI_NO_UNSELECT_SLAVE
ap.CFLAGS += -DSPI_MASTER
+ap.srcs += mcu_periph/spi.c $(SRC_ARCH)/mcu_periph/spi_arch.c
ap.srcs += peripherals/mcp355x.c
endif
ifneq ($(BARO_LED),none)
diff --git a/conf/radios/cockpitSX.xml b/conf/radios/cockpitSX.xml
index 0496a207f0..4afa676423 100644
--- a/conf/radios/cockpitSX.xml
+++ b/conf/radios/cockpitSX.xml
@@ -45,9 +45,9 @@
-
+
-
+
diff --git a/conf/settings/fixedwing_tuning.xml b/conf/settings/control/ctl_basic.xml
similarity index 72%
rename from conf/settings/fixedwing_tuning.xml
rename to conf/settings/control/ctl_basic.xml
index f827cd4010..01ed2d336d 100644
--- a/conf/settings/fixedwing_tuning.xml
+++ b/conf/settings/control/ctl_basic.xml
@@ -1,32 +1,9 @@
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -52,15 +29,13 @@
-
-
-
+
+
+
-
-
diff --git a/conf/settings/control/ctl_dash_loiter_trim.xml b/conf/settings/control/ctl_dash_loiter_trim.xml
new file mode 100644
index 0000000000..ac5dd7d1ed
--- /dev/null
+++ b/conf/settings/control/ctl_dash_loiter_trim.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sw/airborne/firmwares/rotorcraft/actuators/actuators_asctec.c b/sw/airborne/firmwares/rotorcraft/actuators/actuators_asctec.c
index b0b871a2e4..fa7f8b9004 100644
--- a/sw/airborne/firmwares/rotorcraft/actuators/actuators_asctec.c
+++ b/sw/airborne/firmwares/rotorcraft/actuators/actuators_asctec.c
@@ -34,6 +34,11 @@
#include "mcu_periph/i2c.h"
#include "mcu_periph/sys_time.h"
+#define ASCTEC_MIN_CMD -100
+#define ASCTEC_MAX_CMD 100
+
+#define ASCTEC_MIN_THROTTLE 0
+#define ASCTEC_MAX_THROTTLE 200
struct ActuatorsAsctec actuators_asctec;
@@ -86,15 +91,15 @@ void actuators_set(bool_t motors_on) {
actuators_asctec.cmds[YAW] = 0;
actuators_asctec.cmds[THRUST] = 0;
#else /* ! KILL_MOTORS */
- actuators_asctec.cmds[PITCH] = commands[COMMAND_PITCH] + SUPERVISION_TRIM_E;
- actuators_asctec.cmds[ROLL] = commands[COMMAND_ROLL] + SUPERVISION_TRIM_A;
- actuators_asctec.cmds[YAW] = commands[COMMAND_YAW] + SUPERVISION_TRIM_R;
- actuators_asctec.cmds[THRUST] = commands[COMMAND_THRUST];
- Bound(actuators_asctec.cmds[PITCH],-100, 100);
- Bound(actuators_asctec.cmds[ROLL], -100, 100);
- Bound(actuators_asctec.cmds[YAW], -100, 100);
+ actuators_asctec.cmds[PITCH] = ((commands[COMMAND_PITCH] + SUPERVISION_TRIM_E) * ASCTEC_MAX_CMD) / MAX_PPRZ;
+ actuators_asctec.cmds[ROLL] = ((commands[COMMAND_ROLL] + SUPERVISION_TRIM_A) * ASCTEC_MAX_CMD) / MAX_PPRZ;
+ actuators_asctec.cmds[YAW] = ((commands[COMMAND_YAW] + SUPERVISION_TRIM_R) * ASCTEC_MAX_CMD) / MAX_PPRZ;
+ actuators_asctec.cmds[THRUST] = (commands[COMMAND_THRUST] * ASCTEC_MAX_THROTTLE) / MAX_PPRZ;
+ Bound(actuators_asctec.cmds[PITCH],ASCTEC_MIN_CMD, ASCTEC_MAX_CMD);
+ Bound(actuators_asctec.cmds[ROLL], ASCTEC_MIN_CMD, ASCTEC_MAX_CMD);
+ Bound(actuators_asctec.cmds[YAW], ASCTEC_MIN_CMD, ASCTEC_MAX_CMD);
if (motors_on) {
- Bound(actuators_asctec.cmds[THRUST], 1, 200);
+ Bound(actuators_asctec.cmds[THRUST], ASCTEC_MIN_THROTTLE + 1, ASCTEC_MAX_THROTTLE);
}
else
actuators_asctec.cmds[THRUST] = 0;
@@ -121,7 +126,7 @@ void actuators_set(bool_t motors_on) {
actuators_asctec.cur_addr = actuators_asctec.new_addr;
break;
case NONE:
- actuators_asctec.i2c_trans.buf[0] = 100 - actuators_asctec.cmds[PITCH];
+ actuators_asctec.i2c_trans.buf[0] = 100 - actuators_asctec.cmds[PITCH];
actuators_asctec.i2c_trans.buf[1] = 100 + actuators_asctec.cmds[ROLL];
actuators_asctec.i2c_trans.buf[2] = 100 - actuators_asctec.cmds[YAW];
actuators_asctec.i2c_trans.buf[3] = actuators_asctec.cmds[THRUST];
diff --git a/sw/airborne/firmwares/rotorcraft/telemetry.h b/sw/airborne/firmwares/rotorcraft/telemetry.h
index 56923fa33f..abd2b233e5 100644
--- a/sw/airborne/firmwares/rotorcraft/telemetry.h
+++ b/sw/airborne/firmwares/rotorcraft/telemetry.h
@@ -739,44 +739,89 @@
&ahrs.ltp_to_body_euler.psi); \
}
+#ifdef USE_I2C0
+#define PERIODIC_SEND_I2C0_ERRORS(_trans, _dev) { \
+ uint16_t i2c0_ack_fail_cnt = i2c0.errors->ack_fail_cnt; \
+ uint16_t i2c0_miss_start_stop_cnt = i2c0.errors->miss_start_stop_cnt; \
+ uint16_t i2c0_arb_lost_cnt = i2c0.errors->arb_lost_cnt; \
+ uint16_t i2c0_over_under_cnt = i2c0.errors->over_under_cnt; \
+ uint16_t i2c0_pec_recep_cnt = i2c0.errors->pec_recep_cnt; \
+ uint16_t i2c0_timeout_tlow_cnt = i2c0.errors->timeout_tlow_cnt; \
+ uint16_t i2c0_smbus_alert_cnt = i2c0.errors->smbus_alert_cnt; \
+ uint16_t i2c0_unexpected_event_cnt = i2c0.errors->unexpected_event_cnt; \
+ uint32_t i2c0_last_unexpected_event = i2c0.errors->last_unexpected_event; \
+ DOWNLINK_SEND_I2C_ERRORS(_trans, _dev, \
+ &i2c0_ack_fail_cnt, \
+ &i2c0_miss_start_stop_cnt, \
+ &i2c0_arb_lost_cnt, \
+ &i2c0_over_under_cnt, \
+ &i2c0_pec_recep_cnt, \
+ &i2c0_timeout_tlow_cnt, \
+ &i2c0_smbus_alert_cnt, \
+ &i2c0_unexpected_event_cnt, \
+ &i2c0_last_unexpected_event); \
+ }
+#else
+#define PERIODIC_SEND_I2C0_ERRORS(_trans, _dev) {}
+#endif
+
#ifdef USE_I2C1
-#define PERIODIC_SEND_I2C1_ERRORS(_trans, _dev) { \
- DOWNLINK_SEND_I2C_ERRORS(_trans, _dev, \
- &i2c1.errors->ack_fail_cnt, \
- &i2c1.errors->miss_start_stop_cnt, \
- &i2c1.errors->arb_lost_cnt, \
- &i2c1.errors->over_under_cnt, \
- &i2c1.errors->pec_recep_cnt, \
- &i2c1.errors->timeout_tlow_cnt, \
- &i2c1.errors->smbus_alert_cnt, \
- &i2c1.errors->unexpected_event_cnt, \
- &i2c1.errors->last_unexpected_event); \
+#define PERIODIC_SEND_I2C1_ERRORS(_trans, _dev) { \
+ uint16_t i2c1_ack_fail_cnt = i2c1.errors->ack_fail_cnt; \
+ uint16_t i2c1_miss_start_stop_cnt = i2c1.errors->miss_start_stop_cnt; \
+ uint16_t i2c1_arb_lost_cnt = i2c1.errors->arb_lost_cnt; \
+ uint16_t i2c1_over_under_cnt = i2c1.errors->over_under_cnt; \
+ uint16_t i2c1_pec_recep_cnt = i2c1.errors->pec_recep_cnt; \
+ uint16_t i2c1_timeout_tlow_cnt = i2c1.errors->timeout_tlow_cnt; \
+ uint16_t i2c1_smbus_alert_cnt = i2c1.errors->smbus_alert_cnt; \
+ uint16_t i2c1_unexpected_event_cnt = i2c1.errors->unexpected_event_cnt; \
+ uint32_t i2c1_last_unexpected_event = i2c1.errors->last_unexpected_event; \
+ DOWNLINK_SEND_I2C_ERRORS(_trans, _dev, \
+ &i2c1_ack_fail_cnt, \
+ &i2c1_miss_start_stop_cnt, \
+ &i2c1_arb_lost_cnt, \
+ &i2c1_over_under_cnt, \
+ &i2c1_pec_recep_cnt, \
+ &i2c1_timeout_tlow_cnt, \
+ &i2c1_smbus_alert_cnt, \
+ &i2c1_unexpected_event_cnt, \
+ &i2c1_last_unexpected_event); \
}
#else
#define PERIODIC_SEND_I2C1_ERRORS(_trans, _dev) {}
#endif
#ifdef USE_I2C2
-#define PERIODIC_SEND_I2C2_ERRORS(_trans, _dev) { \
- DOWNLINK_SEND_I2C_ERRORS(_trans, _dev, \
- &i2c2.errors->ack_fail_cnt, \
- &i2c2.errors->miss_start_stop_cnt, \
- &i2c2.errors->arb_lost_cnt, \
- &i2c2.errors->over_under_cnt, \
- &i2c2.errors->pec_recep_cnt, \
- &i2c2.errors->timeout_tlow_cnt, \
- &i2c2.errors->smbus_alert_cnt, \
- &i2c2.errors->unexpected_event_cnt, \
- &i2c2.errors->last_unexpected_event); \
+#define PERIODIC_SEND_I2C2_ERRORS(_trans, _dev) { \
+ uint16_t i2c2_ack_fail_cnt = i2c2.errors->ack_fail_cnt; \
+ uint16_t i2c2_miss_start_stop_cnt = i2c2.errors->miss_start_stop_cnt; \
+ uint16_t i2c2_arb_lost_cnt = i2c2.errors->arb_lost_cnt; \
+ uint16_t i2c2_over_under_cnt = i2c2.errors->over_under_cnt; \
+ uint16_t i2c2_pec_recep_cnt = i2c2.errors->pec_recep_cnt; \
+ uint16_t i2c2_timeout_tlow_cnt = i2c2.errors->timeout_tlow_cnt; \
+ uint16_t i2c2_smbus_alert_cnt = i2c2.errors->smbus_alert_cnt; \
+ uint16_t i2c2_unexpected_event_cnt = i2c2.errors->unexpected_event_cnt; \
+ uint32_t i2c2_last_unexpected_event = i2c2.errors->last_unexpected_event; \
+ DOWNLINK_SEND_I2C_ERRORS(_trans, _dev, \
+ &i2c2_ack_fail_cnt, \
+ &i2c2_miss_start_stop_cnt, \
+ &i2c2_arb_lost_cnt, \
+ &i2c2_over_under_cnt, \
+ &i2c2_pec_recep_cnt, \
+ &i2c2_timeout_tlow_cnt, \
+ &i2c2_smbus_alert_cnt, \
+ &i2c2_unexpected_event_cnt, \
+ &i2c2_last_unexpected_event); \
}
#else
#define PERIODIC_SEND_I2C2_ERRORS(_trans, _dev) {}
#endif
-#define PERIODIC_SEND_I2C_ERRORS(_trans, _dev) { \
- PERIODIC_SEND_I2C1_ERRORS(_trans, _dev); \
- PERIODIC_SEND_I2C2_ERRORS(_trans, _dev); \
- }
+#define PERIODIC_SEND_I2C_ERRORS(_trans, _dev) { \
+ PERIODIC_SEND_I2C0_ERRORS(_trans, _dev); \
+ PERIODIC_SEND_I2C1_ERRORS(_trans, _dev); \
+ PERIODIC_SEND_I2C2_ERRORS(_trans, _dev); \
+}
// FIXME: still used?? or replace by EXTRA_ADC
#define PERIODIC_SEND_BOOZ2_SONAR(_trans, _dev) {}