Cleanup useless code

This commit is contained in:
Raphael Coeffic
2021-07-21 16:06:16 +02:00
parent 67e68bf56b
commit 6bf0fe2889
6 changed files with 8 additions and 56 deletions
-2
View File
@@ -522,13 +522,11 @@ extern uint8_t flightModeTransitionLast;
#define availableMemory() ((unsigned int)((unsigned char *)&_heap_end - heap))
#endif
extern uint32_t nextMixerTime[NUM_MODULES];
void evalFlightModeMixes(uint8_t mode, uint8_t tick10ms);
void evalMixes(uint8_t tick10ms);
void doMixerCalculations();
void doMixerPeriodicUpdates();
void scheduleNextMixerCalculation(uint8_t module, uint32_t period_ms);
void checkTrims();
extern uint8_t currentBacklightBright;
-31
View File
@@ -329,18 +329,12 @@ bool setupPulsesExternalModule(uint8_t protocol)
#if defined(PXX1)
case PROTOCOL_CHANNELS_PXX1_PULSES:
extmodulePulsesData.pxx.setupFrame(EXTERNAL_MODULE);
#if defined(PCBSKY9X)
scheduleNextMixerCalculation(EXTERNAL_MODULE, PXX_PULSES_PERIOD);
#endif
return true;
#endif
#if defined(PXX1) && defined(HARDWARE_EXTERNAL_MODULE_SIZE_SML)
case PROTOCOL_CHANNELS_PXX1_SERIAL:
extmodulePulsesData.pxx_uart.setupFrame(EXTERNAL_MODULE);
#if defined(PCBSKY9X)
scheduleNextMixerCalculation(EXTERNAL_MODULE, EXTMODULE_PXX1_SERIAL_PERIOD);
#endif
return true;
#endif
@@ -348,32 +342,22 @@ bool setupPulsesExternalModule(uint8_t protocol)
case PROTOCOL_CHANNELS_PXX2_HIGHSPEED:
case PROTOCOL_CHANNELS_PXX2_LOWSPEED:
extmodulePulsesData.pxx2.setupFrame(EXTERNAL_MODULE);
#if defined(PCBSKY9X)
scheduleNextMixerCalculation(EXTERNAL_MODULE, PXX2_NO_HEARTBEAT_PERIOD);
#endif
return true;
#endif
#if defined(SBUS)
case PROTOCOL_CHANNELS_SBUS:
setupPulsesSbus();
#if defined(PCBSKY9X)
scheduleNextMixerCalculation(EXTERNAL_MODULE, SBUS_PERIOD);
#else
// SBUS_PERIOD is not a constant! It can be set from UI
mixerSchedulerSetPeriod(EXTERNAL_MODULE, SBUS_PERIOD);
return true;
#endif
#endif
#if defined(DSM2)
case PROTOCOL_CHANNELS_DSM2_LP45:
case PROTOCOL_CHANNELS_DSM2_DSM2:
case PROTOCOL_CHANNELS_DSM2_DSMX:
setupPulsesDSM2();
#if defined(PCBSKY9X)
scheduleNextMixerCalculation(EXTERNAL_MODULE, DSM2_PERIOD);
#endif
return true;
#endif
@@ -386,9 +370,6 @@ bool setupPulsesExternalModule(uint8_t protocol)
else
mixerSchedulerSetPeriod(EXTERNAL_MODULE, CROSSFIRE_PERIOD);
setupPulsesCrossfire();
#if defined(PCBSKY9X)
scheduleNextMixerCalculation(EXTERNAL_MODULE, CROSSFIRE_PERIOD);
#endif
return true;
}
#endif
@@ -402,9 +383,6 @@ bool setupPulsesExternalModule(uint8_t protocol)
else
mixerSchedulerSetPeriod(EXTERNAL_MODULE, GHOST_PERIOD);
setupPulsesGhost();
#if defined(PCBSKPCBSKY9X)
scheduleNextMixerCalculation(EXTERNAL_MODULE, GHOST_PERIOD);
#endif
return true;
}
#endif
@@ -418,9 +396,6 @@ bool setupPulsesExternalModule(uint8_t protocol)
else
mixerSchedulerSetPeriod(EXTERNAL_MODULE, MULTIMODULE_PERIOD);
setupPulsesMultiExternalModule();
#if defined(PCBSKY9X)
scheduleNextMixerCalculation(EXTERNAL_MODULE, MULTIMODULE_PERIOD);
#endif
return true;
}
#endif
@@ -428,18 +403,12 @@ bool setupPulsesExternalModule(uint8_t protocol)
#if defined(PPM)
case PROTOCOL_CHANNELS_PPM:
setupPulsesPPMExternalModule();
#if defined(PCBSKY9X)
scheduleNextMixerCalculation(EXTERNAL_MODULE, PPM_PERIOD(EXTERNAL_MODULE));
#endif
return true;
#endif
#if defined(AFHDS3)
case PROTOCOL_CHANNELS_AFHDS3:
extmodulePulsesData.afhds3.setupFrame();
#if defined(PCBSKY9X)
scheduleNextMixerCalculation(EXTERNAL_MODULE, AFHDS3_COMMAND_TIMEOUT);
#endif
return true;
#endif
+2
View File
@@ -24,6 +24,7 @@
#include "pxx.h"
#include "crc.h"
#if defined(INTMODULE_HEARTBEAT_GPIO)
struct HeartbeatCapture {
#if !defined(INTMODULE_USART)
uint32_t timestamp;
@@ -35,6 +36,7 @@ struct HeartbeatCapture {
};
extern volatile HeartbeatCapture heartbeatCapture;
#endif
class Pxx1CrcMixin {
protected:
@@ -26,6 +26,7 @@ volatile HeartbeatCapture heartbeatCapture;
void init_intmodule_heartbeat()
{
TRACE("init_intmodule_heartbeat");
GPIO_InitTypeDef GPIO_InitStructure;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
@@ -34,7 +35,8 @@ void init_intmodule_heartbeat()
GPIO_InitStructure.GPIO_Pin = INTMODULE_HEARTBEAT_GPIO_PIN;
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_StructInit(&EXTI_InitStructure);
@@ -51,6 +53,7 @@ void init_intmodule_heartbeat()
void stop_intmodule_heartbeat()
{
TRACE("stop_intmodule_heartbeat");
heartbeatCapture.valid = false;
#if !defined(INTMODULE_HEARTBEAT_REUSE_INTERRUPT_ROTARY_ENCODER)
@@ -69,9 +72,7 @@ void stop_intmodule_heartbeat()
void check_intmodule_heartbeat()
{
if (EXTI_GetITStatus(INTMODULE_HEARTBEAT_EXTI_LINE) != RESET) {
#if defined(INTMODULE_USART)
nextMixerTime[INTERNAL_MODULE] = RTOS_GET_MS();
#else
#if !defined(INTMODULE_USART)
heartbeatCapture.timestamp = getTmr2MHz();
#endif
#if defined(DEBUG_LATENCY)
+1
View File
@@ -909,6 +909,7 @@
#define INTMODULE_HEARTBEAT_EXTI_PinSource GPIO_PinSource12
#define INTMODULE_HEARTBEAT_EXTI_LINE EXTI_Line12
#define INTMODULE_HEARTBEAT_EXTI_IRQn EXTI15_10_IRQn
#define INTMODULE_HEARTBEAT_EXTI_IRQHandler EXTI15_10_IRQHandler
#define INTMODULE_HEARTBEAT_REUSE_INTERRUPT_ROTARY_ENCODER
#if defined(INTERNAL_MODULE_PXX2)
#define INTMODULE_HEARTBEAT_TRIGGER EXTI_Trigger_Falling
-19
View File
@@ -133,7 +133,6 @@ void execMixerFrequentActions()
DEBUG_TIMER_STOP(debugTimerTelemetryWakeup);
}
uint32_t nextMixerTime[NUM_MODULES];
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