Skip to content

Commit af47e00

Browse files
committed
LP-584 Fix servo driver to not touch unused pins in _disable() function. Fix adc channel for servo6 on revolution & sparky2 targets.
1 parent 4c9c3c2 commit af47e00

3 files changed

Lines changed: 7 additions & 3 deletions

File tree

flight/pios/common/pios_servo.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ static uint32_t pios_dshot_t0h_raw;
7272
static uint32_t pios_dshot_t1h_raw;
7373
static uint32_t pios_dshot_t_raw;
7474

75-
static bool pios_servo_enabled = true;
75+
static bool pios_servo_enabled = false;
7676
static uint32_t pios_servo_active = 0; // No active outputs by default
7777

7878
#define PIOS_SERVO_TIMER_CLOCK 1000000
@@ -111,6 +111,10 @@ extern void PIOS_Servo_Disable()
111111
* if using inverted setup */
112112

113113
for (uint8_t i = 0; (i < servo_cfg->num_channels); i++) {
114+
if (!(pios_servo_active & (1L << i))) { // This output is not active
115+
continue;
116+
}
117+
114118
const struct pios_tim_channel *chan = &servo_cfg->channels[i];
115119

116120
GPIO_InitTypeDef init = chan->pin.init;

flight/targets/boards/revolution/pios_board.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ extern uint32_t pios_packet_handler;
303303
{ GPIOA, GPIO_Pin_3, ADC_Channel_3, false }, /* Servo pin 3 */ \
304304
{ GPIOA, GPIO_Pin_2, ADC_Channel_2, false }, /* Servo pin 4 */ \
305305
{ GPIOA, GPIO_Pin_1, ADC_Channel_1, false }, /* Servo pin 5 */ \
306-
{ GPIOA, GPIO_Pin_0, ADC_Channel_9, false }, /* Servo pin 6 */ \
306+
{ GPIOA, GPIO_Pin_0, ADC_Channel_0, false }, /* Servo pin 6 */ \
307307
{ NULL, 0, ADC_Channel_Vrefint, false }, /* Voltage reference */ \
308308
{ NULL, 0, ADC_Channel_TempSensor, false }, /* Temperature sensor */ \
309309
}

flight/targets/boards/sparky2/pios_board.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ extern uint32_t pios_packet_handler;
306306
{ GPIOA, GPIO_Pin_3, ADC_Channel_3, false }, /* Servo pin 3 */ \
307307
{ GPIOA, GPIO_Pin_2, ADC_Channel_2, false }, /* Servo pin 4 */ \
308308
{ GPIOA, GPIO_Pin_1, ADC_Channel_1, false }, /* Servo pin 5 */ \
309-
{ GPIOA, GPIO_Pin_0, ADC_Channel_9, false }, /* Servo pin 6 */ \
309+
{ GPIOA, GPIO_Pin_0, ADC_Channel_0, false }, /* Servo pin 6 */ \
310310
{ NULL, 0, ADC_Channel_Vrefint, false }, /* Voltage reference */ \
311311
{ NULL, 0, ADC_Channel_TempSensor, false }, /* Temperature sensor */ \
312312
}

0 commit comments

Comments
 (0)