diff --git a/sw/airborne/firmwares/rotorcraft/actuators/supervision.c b/sw/airborne/firmwares/rotorcraft/actuators/supervision.c index 41fb17c3cf..6d96d6c0e6 100644 --- a/sw/airborne/firmwares/rotorcraft/actuators/supervision.c +++ b/sw/airborne/firmwares/rotorcraft/actuators/supervision.c @@ -61,9 +61,10 @@ /** total supervision command scale. * scales a command input [-MAX_PPRZ,MAX_PPRZ] * to the final supervision motor command with range of - * [0,SUPERVISION_MAX_MOTOR-SUPERVISION_MIN_MOTOR] + * [SUPERVISION_MIN_MOTOR,SUPERVISION_MAX_MOTOR] + * or sets it to SUPERVISION_STOP_MOTOR */ -#define SUPERVISION_CMD_SCALE (((SUPERVISION_MAX_MOTOR - SUPERVISION_MIN_MOTOR) / MAX_PPRZ) /SUPERVISION_SCALE) +#define SUPERVISION_CMD_SCALE (SUPERVISION_MAX_MOTOR - SUPERVISION_MIN_MOTOR) / (MAX_PPRZ * SUPERVISION_SCALE) static const int32_t roll_coef[SUPERVISION_NB_MOTOR] = SUPERVISION_ROLL_COEF; static const int32_t pitch_coef[SUPERVISION_NB_MOTOR] = SUPERVISION_PITCH_COEF; @@ -152,12 +153,12 @@ void supervision_run(bool_t motors_on, bool_t override_on, int32_t in_cmd[] ) { int32_t min_cmd = INT32_MAX; int32_t max_cmd = INT32_MIN; for (i=0; i max_cmd)