Fix unwanted inversion of escprog // Fix motor output numbering
This commit is contained in:
parent
5a9ae10fd7
commit
28f9dc6849
|
@ -111,15 +111,14 @@ static void escSerialICConfig(TIM_TypeDef *tim, uint8_t channel, uint16_t polari
|
|||
|
||||
void setTxSignalEsc(escSerial_t *escSerial, uint8_t state)
|
||||
{
|
||||
#ifdef USE_ESCSERIAL_INVERSION
|
||||
state ^= ENABLE;
|
||||
#endif
|
||||
|
||||
if(escSerial->mode == PROTOCOL_KISSALL)
|
||||
{
|
||||
for (volatile uint8_t i = 0; i < escSerial->outputCount; i++) {
|
||||
uint8_t state_temp = state;
|
||||
if(escOutputs[i].inverted) {
|
||||
state_temp ^= ENABLE;
|
||||
}
|
||||
|
||||
if (state_temp) {
|
||||
if (state) {
|
||||
IOHi(escOutputs[i].io);
|
||||
} else {
|
||||
IOLo(escOutputs[i].io);
|
||||
|
@ -128,10 +127,6 @@ void setTxSignalEsc(escSerial_t *escSerial, uint8_t state)
|
|||
}
|
||||
else
|
||||
{
|
||||
if(escSerial->rxTimerHardware->output & TIMER_OUTPUT_INVERTED) {
|
||||
state ^= ENABLE;
|
||||
}
|
||||
|
||||
if (state) {
|
||||
IOHi(escSerial->txIO);
|
||||
} else {
|
||||
|
|
|
@ -2823,6 +2823,7 @@ static void cliEscPassthrough(char *cmdline)
|
|||
int i = 0;
|
||||
char *pch = NULL;
|
||||
char *saveptr;
|
||||
uint8_t indexForProg = 0;
|
||||
|
||||
if (isEmpty(cmdline)) {
|
||||
cliShowParseError();
|
||||
|
@ -2857,13 +2858,15 @@ static void cliEscPassthrough(char *cmdline)
|
|||
break;
|
||||
case 1:
|
||||
index = atoi(pch);
|
||||
indexForProg = index;
|
||||
if(mode == 2 && index == 255)
|
||||
{
|
||||
printf("passthrough on all outputs enabled\r\n");
|
||||
}
|
||||
else{
|
||||
if ((index >= 0) && (index < USABLE_TIMER_CHANNEL_COUNT)) {
|
||||
printf("passthrough on output %d enabled\r\n", index);
|
||||
indexForProg = index + 1; // Wonky timer mapping requires this to match the actual motor numberings
|
||||
if ((index >= 1) && (index < USABLE_TIMER_CHANNEL_COUNT)) {
|
||||
printf("passthrough on esc %d enabled\r\n", index);
|
||||
}
|
||||
else {
|
||||
printf("invalid output, range: 1 to %d\r\n", USABLE_TIMER_CHANNEL_COUNT);
|
||||
|
@ -2875,7 +2878,7 @@ static void cliEscPassthrough(char *cmdline)
|
|||
i++;
|
||||
pch = strtok_r(NULL, " ", &saveptr);
|
||||
}
|
||||
escEnablePassthrough(cliPort,index,mode);
|
||||
escEnablePassthrough(cliPort,indexForProg,mode);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include "drivers/dma.h"
|
||||
|
||||
const timerHardware_t timerHardware[USABLE_TIMER_CHANNEL_COUNT] = {
|
||||
DEF_TIM(TIM2, CH2, PB3, TIM_USE_PWM | TIM_USE_PPM, TIMER_INPUT_ENABLED),
|
||||
#ifdef KISSCC
|
||||
DEF_TIM(TIM1, CH2N,PB14, TIM_USE_MOTOR, TIMER_OUTPUT_ENABLED | TIMER_OUTPUT_INVERTED),
|
||||
DEF_TIM(TIM8, CH2N,PB0, TIM_USE_MOTOR, TIMER_OUTPUT_ENABLED | TIMER_OUTPUT_INVERTED),
|
||||
|
@ -42,7 +43,6 @@ const timerHardware_t timerHardware[USABLE_TIMER_CHANNEL_COUNT] = {
|
|||
DEF_TIM(TIM17,CH1, PA7, TIM_USE_MOTOR, TIMER_OUTPUT_ENABLED | TIMER_OUTPUT_INVERTED),
|
||||
DEF_TIM(TIM4, CH3, PA13, TIM_USE_PWM, TIMER_INPUT_ENABLED), // On KISSFC TIM16 did not work, using TIM4 works
|
||||
#endif
|
||||
DEF_TIM(TIM2, CH2, PB3, TIM_USE_PWM | TIM_USE_PPM, TIMER_INPUT_ENABLED),
|
||||
DEF_TIM(TIM2, CH1, PA15, TIM_USE_PWM, TIMER_INPUT_ENABLED),
|
||||
DEF_TIM(TIM2, CH3, PA2, TIM_USE_PWM, TIMER_INPUT_ENABLED),
|
||||
DEF_TIM(TIM2, CH4, PB11, TIM_USE_PWM, TIMER_INPUT_ENABLED),
|
||||
|
|
|
@ -26,7 +26,10 @@
|
|||
#define USE_ESC_SENSOR
|
||||
|
||||
#define USE_ESCSERIAL
|
||||
#define ESCSERIAL_TIMER_TX_HARDWARE 6
|
||||
#ifdef KISSFC
|
||||
#define USE_ESCSERIAL_INVERSION
|
||||
#endif
|
||||
#define ESCSERIAL_TIMER_TX_HARDWARE 0
|
||||
#define REMAP_TIM17_DMA
|
||||
|
||||
#define LED0 PB1
|
||||
|
|
Loading…
Reference in New Issue