Cleanup useless code
This commit is contained in:
@@ -522,13 +522,11 @@ extern uint8_t flightModeTransitionLast;
|
|||||||
#define availableMemory() ((unsigned int)((unsigned char *)&_heap_end - heap))
|
#define availableMemory() ((unsigned int)((unsigned char *)&_heap_end - heap))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern uint32_t nextMixerTime[NUM_MODULES];
|
|
||||||
|
|
||||||
void evalFlightModeMixes(uint8_t mode, uint8_t tick10ms);
|
void evalFlightModeMixes(uint8_t mode, uint8_t tick10ms);
|
||||||
void evalMixes(uint8_t tick10ms);
|
void evalMixes(uint8_t tick10ms);
|
||||||
void doMixerCalculations();
|
void doMixerCalculations();
|
||||||
void doMixerPeriodicUpdates();
|
void doMixerPeriodicUpdates();
|
||||||
void scheduleNextMixerCalculation(uint8_t module, uint32_t period_ms);
|
|
||||||
|
|
||||||
void checkTrims();
|
void checkTrims();
|
||||||
extern uint8_t currentBacklightBright;
|
extern uint8_t currentBacklightBright;
|
||||||
|
|||||||
@@ -329,18 +329,12 @@ bool setupPulsesExternalModule(uint8_t protocol)
|
|||||||
#if defined(PXX1)
|
#if defined(PXX1)
|
||||||
case PROTOCOL_CHANNELS_PXX1_PULSES:
|
case PROTOCOL_CHANNELS_PXX1_PULSES:
|
||||||
extmodulePulsesData.pxx.setupFrame(EXTERNAL_MODULE);
|
extmodulePulsesData.pxx.setupFrame(EXTERNAL_MODULE);
|
||||||
#if defined(PCBSKY9X)
|
|
||||||
scheduleNextMixerCalculation(EXTERNAL_MODULE, PXX_PULSES_PERIOD);
|
|
||||||
#endif
|
|
||||||
return true;
|
return true;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PXX1) && defined(HARDWARE_EXTERNAL_MODULE_SIZE_SML)
|
#if defined(PXX1) && defined(HARDWARE_EXTERNAL_MODULE_SIZE_SML)
|
||||||
case PROTOCOL_CHANNELS_PXX1_SERIAL:
|
case PROTOCOL_CHANNELS_PXX1_SERIAL:
|
||||||
extmodulePulsesData.pxx_uart.setupFrame(EXTERNAL_MODULE);
|
extmodulePulsesData.pxx_uart.setupFrame(EXTERNAL_MODULE);
|
||||||
#if defined(PCBSKY9X)
|
|
||||||
scheduleNextMixerCalculation(EXTERNAL_MODULE, EXTMODULE_PXX1_SERIAL_PERIOD);
|
|
||||||
#endif
|
|
||||||
return true;
|
return true;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -348,32 +342,22 @@ bool setupPulsesExternalModule(uint8_t protocol)
|
|||||||
case PROTOCOL_CHANNELS_PXX2_HIGHSPEED:
|
case PROTOCOL_CHANNELS_PXX2_HIGHSPEED:
|
||||||
case PROTOCOL_CHANNELS_PXX2_LOWSPEED:
|
case PROTOCOL_CHANNELS_PXX2_LOWSPEED:
|
||||||
extmodulePulsesData.pxx2.setupFrame(EXTERNAL_MODULE);
|
extmodulePulsesData.pxx2.setupFrame(EXTERNAL_MODULE);
|
||||||
#if defined(PCBSKY9X)
|
|
||||||
scheduleNextMixerCalculation(EXTERNAL_MODULE, PXX2_NO_HEARTBEAT_PERIOD);
|
|
||||||
#endif
|
|
||||||
return true;
|
return true;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(SBUS)
|
#if defined(SBUS)
|
||||||
case PROTOCOL_CHANNELS_SBUS:
|
case PROTOCOL_CHANNELS_SBUS:
|
||||||
setupPulsesSbus();
|
setupPulsesSbus();
|
||||||
#if defined(PCBSKY9X)
|
|
||||||
scheduleNextMixerCalculation(EXTERNAL_MODULE, SBUS_PERIOD);
|
|
||||||
#else
|
|
||||||
// SBUS_PERIOD is not a constant! It can be set from UI
|
// SBUS_PERIOD is not a constant! It can be set from UI
|
||||||
mixerSchedulerSetPeriod(EXTERNAL_MODULE, SBUS_PERIOD);
|
mixerSchedulerSetPeriod(EXTERNAL_MODULE, SBUS_PERIOD);
|
||||||
return true;
|
return true;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(DSM2)
|
#if defined(DSM2)
|
||||||
case PROTOCOL_CHANNELS_DSM2_LP45:
|
case PROTOCOL_CHANNELS_DSM2_LP45:
|
||||||
case PROTOCOL_CHANNELS_DSM2_DSM2:
|
case PROTOCOL_CHANNELS_DSM2_DSM2:
|
||||||
case PROTOCOL_CHANNELS_DSM2_DSMX:
|
case PROTOCOL_CHANNELS_DSM2_DSMX:
|
||||||
setupPulsesDSM2();
|
setupPulsesDSM2();
|
||||||
#if defined(PCBSKY9X)
|
|
||||||
scheduleNextMixerCalculation(EXTERNAL_MODULE, DSM2_PERIOD);
|
|
||||||
#endif
|
|
||||||
return true;
|
return true;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -386,9 +370,6 @@ bool setupPulsesExternalModule(uint8_t protocol)
|
|||||||
else
|
else
|
||||||
mixerSchedulerSetPeriod(EXTERNAL_MODULE, CROSSFIRE_PERIOD);
|
mixerSchedulerSetPeriod(EXTERNAL_MODULE, CROSSFIRE_PERIOD);
|
||||||
setupPulsesCrossfire();
|
setupPulsesCrossfire();
|
||||||
#if defined(PCBSKY9X)
|
|
||||||
scheduleNextMixerCalculation(EXTERNAL_MODULE, CROSSFIRE_PERIOD);
|
|
||||||
#endif
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -402,9 +383,6 @@ bool setupPulsesExternalModule(uint8_t protocol)
|
|||||||
else
|
else
|
||||||
mixerSchedulerSetPeriod(EXTERNAL_MODULE, GHOST_PERIOD);
|
mixerSchedulerSetPeriod(EXTERNAL_MODULE, GHOST_PERIOD);
|
||||||
setupPulsesGhost();
|
setupPulsesGhost();
|
||||||
#if defined(PCBSKPCBSKY9X)
|
|
||||||
scheduleNextMixerCalculation(EXTERNAL_MODULE, GHOST_PERIOD);
|
|
||||||
#endif
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -418,9 +396,6 @@ bool setupPulsesExternalModule(uint8_t protocol)
|
|||||||
else
|
else
|
||||||
mixerSchedulerSetPeriod(EXTERNAL_MODULE, MULTIMODULE_PERIOD);
|
mixerSchedulerSetPeriod(EXTERNAL_MODULE, MULTIMODULE_PERIOD);
|
||||||
setupPulsesMultiExternalModule();
|
setupPulsesMultiExternalModule();
|
||||||
#if defined(PCBSKY9X)
|
|
||||||
scheduleNextMixerCalculation(EXTERNAL_MODULE, MULTIMODULE_PERIOD);
|
|
||||||
#endif
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -428,18 +403,12 @@ bool setupPulsesExternalModule(uint8_t protocol)
|
|||||||
#if defined(PPM)
|
#if defined(PPM)
|
||||||
case PROTOCOL_CHANNELS_PPM:
|
case PROTOCOL_CHANNELS_PPM:
|
||||||
setupPulsesPPMExternalModule();
|
setupPulsesPPMExternalModule();
|
||||||
#if defined(PCBSKY9X)
|
|
||||||
scheduleNextMixerCalculation(EXTERNAL_MODULE, PPM_PERIOD(EXTERNAL_MODULE));
|
|
||||||
#endif
|
|
||||||
return true;
|
return true;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(AFHDS3)
|
#if defined(AFHDS3)
|
||||||
case PROTOCOL_CHANNELS_AFHDS3:
|
case PROTOCOL_CHANNELS_AFHDS3:
|
||||||
extmodulePulsesData.afhds3.setupFrame();
|
extmodulePulsesData.afhds3.setupFrame();
|
||||||
#if defined(PCBSKY9X)
|
|
||||||
scheduleNextMixerCalculation(EXTERNAL_MODULE, AFHDS3_COMMAND_TIMEOUT);
|
|
||||||
#endif
|
|
||||||
return true;
|
return true;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
#include "pxx.h"
|
#include "pxx.h"
|
||||||
#include "crc.h"
|
#include "crc.h"
|
||||||
|
|
||||||
|
#if defined(INTMODULE_HEARTBEAT_GPIO)
|
||||||
struct HeartbeatCapture {
|
struct HeartbeatCapture {
|
||||||
#if !defined(INTMODULE_USART)
|
#if !defined(INTMODULE_USART)
|
||||||
uint32_t timestamp;
|
uint32_t timestamp;
|
||||||
@@ -35,6 +36,7 @@ struct HeartbeatCapture {
|
|||||||
};
|
};
|
||||||
|
|
||||||
extern volatile HeartbeatCapture heartbeatCapture;
|
extern volatile HeartbeatCapture heartbeatCapture;
|
||||||
|
#endif
|
||||||
|
|
||||||
class Pxx1CrcMixin {
|
class Pxx1CrcMixin {
|
||||||
protected:
|
protected:
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ volatile HeartbeatCapture heartbeatCapture;
|
|||||||
|
|
||||||
void init_intmodule_heartbeat()
|
void init_intmodule_heartbeat()
|
||||||
{
|
{
|
||||||
|
TRACE("init_intmodule_heartbeat");
|
||||||
GPIO_InitTypeDef GPIO_InitStructure;
|
GPIO_InitTypeDef GPIO_InitStructure;
|
||||||
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;
|
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;
|
||||||
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
|
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
|
||||||
@@ -34,7 +35,8 @@ void init_intmodule_heartbeat()
|
|||||||
GPIO_InitStructure.GPIO_Pin = INTMODULE_HEARTBEAT_GPIO_PIN;
|
GPIO_InitStructure.GPIO_Pin = INTMODULE_HEARTBEAT_GPIO_PIN;
|
||||||
GPIO_Init(INTMODULE_HEARTBEAT_GPIO, &GPIO_InitStructure);
|
GPIO_Init(INTMODULE_HEARTBEAT_GPIO, &GPIO_InitStructure);
|
||||||
|
|
||||||
SYSCFG_EXTILineConfig(INTMODULE_HEARTBEAT_EXTI_PortSource, INTMODULE_HEARTBEAT_EXTI_PinSource);
|
SYSCFG_EXTILineConfig(INTMODULE_HEARTBEAT_EXTI_PortSource,
|
||||||
|
INTMODULE_HEARTBEAT_EXTI_PinSource);
|
||||||
|
|
||||||
EXTI_InitTypeDef EXTI_InitStructure;
|
EXTI_InitTypeDef EXTI_InitStructure;
|
||||||
EXTI_StructInit(&EXTI_InitStructure);
|
EXTI_StructInit(&EXTI_InitStructure);
|
||||||
@@ -51,6 +53,7 @@ void init_intmodule_heartbeat()
|
|||||||
|
|
||||||
void stop_intmodule_heartbeat()
|
void stop_intmodule_heartbeat()
|
||||||
{
|
{
|
||||||
|
TRACE("stop_intmodule_heartbeat");
|
||||||
heartbeatCapture.valid = false;
|
heartbeatCapture.valid = false;
|
||||||
|
|
||||||
#if !defined(INTMODULE_HEARTBEAT_REUSE_INTERRUPT_ROTARY_ENCODER)
|
#if !defined(INTMODULE_HEARTBEAT_REUSE_INTERRUPT_ROTARY_ENCODER)
|
||||||
@@ -69,9 +72,7 @@ void stop_intmodule_heartbeat()
|
|||||||
void check_intmodule_heartbeat()
|
void check_intmodule_heartbeat()
|
||||||
{
|
{
|
||||||
if (EXTI_GetITStatus(INTMODULE_HEARTBEAT_EXTI_LINE) != RESET) {
|
if (EXTI_GetITStatus(INTMODULE_HEARTBEAT_EXTI_LINE) != RESET) {
|
||||||
#if defined(INTMODULE_USART)
|
#if !defined(INTMODULE_USART)
|
||||||
nextMixerTime[INTERNAL_MODULE] = RTOS_GET_MS();
|
|
||||||
#else
|
|
||||||
heartbeatCapture.timestamp = getTmr2MHz();
|
heartbeatCapture.timestamp = getTmr2MHz();
|
||||||
#endif
|
#endif
|
||||||
#if defined(DEBUG_LATENCY)
|
#if defined(DEBUG_LATENCY)
|
||||||
|
|||||||
@@ -909,6 +909,7 @@
|
|||||||
#define INTMODULE_HEARTBEAT_EXTI_PinSource GPIO_PinSource12
|
#define INTMODULE_HEARTBEAT_EXTI_PinSource GPIO_PinSource12
|
||||||
#define INTMODULE_HEARTBEAT_EXTI_LINE EXTI_Line12
|
#define INTMODULE_HEARTBEAT_EXTI_LINE EXTI_Line12
|
||||||
#define INTMODULE_HEARTBEAT_EXTI_IRQn EXTI15_10_IRQn
|
#define INTMODULE_HEARTBEAT_EXTI_IRQn EXTI15_10_IRQn
|
||||||
|
#define INTMODULE_HEARTBEAT_EXTI_IRQHandler EXTI15_10_IRQHandler
|
||||||
#define INTMODULE_HEARTBEAT_REUSE_INTERRUPT_ROTARY_ENCODER
|
#define INTMODULE_HEARTBEAT_REUSE_INTERRUPT_ROTARY_ENCODER
|
||||||
#if defined(INTERNAL_MODULE_PXX2)
|
#if defined(INTERNAL_MODULE_PXX2)
|
||||||
#define INTMODULE_HEARTBEAT_TRIGGER EXTI_Trigger_Falling
|
#define INTMODULE_HEARTBEAT_TRIGGER EXTI_Trigger_Falling
|
||||||
|
|||||||
@@ -133,7 +133,6 @@ void execMixerFrequentActions()
|
|||||||
DEBUG_TIMER_STOP(debugTimerTelemetryWakeup);
|
DEBUG_TIMER_STOP(debugTimerTelemetryWakeup);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t nextMixerTime[NUM_MODULES];
|
|
||||||
|
|
||||||
TASK_FUNCTION(mixerTask)
|
TASK_FUNCTION(mixerTask)
|
||||||
{
|
{
|
||||||
@@ -232,24 +231,6 @@ TASK_FUNCTION(mixerTask)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void scheduleNextMixerCalculation(uint8_t module, uint32_t period_ms)
|
|
||||||
{
|
|
||||||
// Schedule next mixer calculation time,
|
|
||||||
|
|
||||||
if (isModuleSynchronous(module)) {
|
|
||||||
nextMixerTime[module] += period_ms / RTOS_MS_PER_TICK;
|
|
||||||
if (nextMixerTime[module] < RTOS_GET_TIME()) {
|
|
||||||
// we are late ... let's add some small delay
|
|
||||||
nextMixerTime[module] = (uint32_t) RTOS_GET_TIME() + (period_ms / RTOS_MS_PER_TICK);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// for now assume mixer calculation takes 2 ms.
|
|
||||||
nextMixerTime[module] = (uint32_t) RTOS_GET_TIME() + (period_ms / RTOS_MS_PER_TICK);
|
|
||||||
}
|
|
||||||
|
|
||||||
DEBUG_TIMER_STOP(debugTimerMixerCalcToUsage);
|
|
||||||
}
|
|
||||||
|
|
||||||
#define MENU_TASK_PERIOD_TICKS (50 / RTOS_MS_PER_TICK) // 50ms
|
#define MENU_TASK_PERIOD_TICKS (50 / RTOS_MS_PER_TICK) // 50ms
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user