From 8e95d7293a437025149bfa44d74d6521c47add0c Mon Sep 17 00:00:00 2001 From: Felix Ruess Date: Tue, 26 Jun 2012 20:32:20 +0200 Subject: [PATCH] [fix][actuators] Lisa-L with Asctech v2 motors only start after reflashing when a bus error was sensed on stm32-i2c. multiple re-init solves the problem. closes #224 --- .../rotorcraft/actuators/actuators_asctec.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/sw/airborne/firmwares/rotorcraft/actuators/actuators_asctec.c b/sw/airborne/firmwares/rotorcraft/actuators/actuators_asctec.c index fa7f8b90044..f290a14463d 100644 --- a/sw/airborne/firmwares/rotorcraft/actuators/actuators_asctec.c +++ b/sw/airborne/firmwares/rotorcraft/actuators/actuators_asctec.c @@ -82,8 +82,10 @@ void actuators_set(bool_t motors_on) { } #endif - if (!actuators_asctec.i2c_trans.status == I2CTransSuccess) + if (actuators_asctec.i2c_trans.status != I2CTransSuccess) { actuators_asctec.nb_err++; + return; + } #ifdef KILL_MOTORS actuators_asctec.cmds[PITCH] = 0; @@ -143,11 +145,21 @@ void actuators_set(bool_t motors_on) { void actuators_set(bool_t motors_on) { #if defined ACTUATORS_START_DELAY && ! defined SITL if (!actuators_delay_done) { - if (SysTimeTimer(actuators_delay_time) < USEC_OF_SEC(ACTUATORS_START_DELAY)) return; + if (SysTimeTimer(actuators_delay_time) < USEC_OF_SEC(ACTUATORS_START_DELAY)) { + //Lisa-L with Asctech v2 motors only start after reflashing when a bus error was sensed on stm32-i2c. + //multiple re-init solves the problem. + i2c1_init(); + return; + } else actuators_delay_done = TRUE; } #endif + if (actuators_asctec.i2c_trans.status != I2CTransSuccess) { + actuators_asctec.nb_err++; + return; + } + supervision_run(motors_on, FALSE, commands); #ifdef KILL_MOTORS actuators_asctec.i2c_trans.buf[0] = 0;