1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-20 23:05:19 +03:00

more renaming to accomodate review feedback

This commit is contained in:
Thorsten Laux 2019-01-13 17:12:44 +01:00 committed by mikeller
parent 6e46f05e7d
commit d441955391
5 changed files with 7 additions and 19 deletions

View file

@ -90,7 +90,7 @@ PG_RESET_TEMPLATE(systemConfig_t, systemConfig,
.boardIdentifier = TARGET_BOARD_IDENTIFIER, .boardIdentifier = TARGET_BOARD_IDENTIFIER,
.hseMhz = SYSTEM_HSE_VALUE, // Not used for non-F4 targets .hseMhz = SYSTEM_HSE_VALUE, // Not used for non-F4 targets
.configured = false, .configured = false,
.schedulerPolicy = SCHEDULER_POLICY_PRIORITIZE_PERIOD, .schedulerOptimizeRate = false,
); );
uint8_t getCurrentPidProfileIndex(void) uint8_t getCurrentPidProfileIndex(void)
@ -124,7 +124,7 @@ void resetConfigs(void)
static void activateConfig(void) static void activateConfig(void)
{ {
schedulerSetPolicy(systemConfig()->schedulerPolicy); schedulerOptimizeRate(systemConfig()->schedulerOptimizeRate);
loadPidProfile(); loadPidProfile();
loadControlRateProfile(); loadControlRateProfile();

View file

@ -33,11 +33,6 @@ typedef struct pilotConfig_s {
PG_DECLARE(pilotConfig_t, pilotConfig); PG_DECLARE(pilotConfig_t, pilotConfig);
typedef enum {
SCHEDULER_POLICY_PRIORITIZE_PERIOD,
SCHEDULER_POLICY_PRIORITIZE_AVERAGE_RATE,
} schedulerPolicy_e;
typedef struct systemConfig_s { typedef struct systemConfig_s {
uint8_t pidProfileIndex; uint8_t pidProfileIndex;
uint8_t activeRateProfile; uint8_t activeRateProfile;
@ -49,7 +44,7 @@ typedef struct systemConfig_s {
char boardIdentifier[sizeof(TARGET_BOARD_IDENTIFIER) + 1]; char boardIdentifier[sizeof(TARGET_BOARD_IDENTIFIER) + 1];
uint8_t hseMhz; // Not used for non-F4 targets uint8_t hseMhz; // Not used for non-F4 targets
uint8_t configured; uint8_t configured;
uint8_t schedulerPolicy; uint8_t schedulerOptimizeRate;
} systemConfig_t; } systemConfig_t;
PG_DECLARE(systemConfig_t, systemConfig); PG_DECLARE(systemConfig_t, systemConfig);

View file

@ -1175,7 +1175,7 @@ const clivalue_t valueTable[] = {
{ "cpu_overclock", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_OVERCLOCK }, PG_SYSTEM_CONFIG, offsetof(systemConfig_t, cpu_overclock) }, { "cpu_overclock", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_OVERCLOCK }, PG_SYSTEM_CONFIG, offsetof(systemConfig_t, cpu_overclock) },
#endif #endif
{ "pwr_on_arm_grace", VAR_UINT8 | MASTER_VALUE, .config.minmax = { 0, 30 }, PG_SYSTEM_CONFIG, offsetof(systemConfig_t, powerOnArmingGraceTime) }, { "pwr_on_arm_grace", VAR_UINT8 | MASTER_VALUE, .config.minmax = { 0, 30 }, PG_SYSTEM_CONFIG, offsetof(systemConfig_t, powerOnArmingGraceTime) },
{ "scheduler_optimize_rate", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_OFF_ON }, PG_SYSTEM_CONFIG, offsetof(systemConfig_t, schedulerPolicy) }, { "scheduler_optimize_rate", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, .config.lookup = { TABLE_OFF_ON }, PG_SYSTEM_CONFIG, offsetof(systemConfig_t, schedulerOptimizeRate) },
// PG_VTX_CONFIG // PG_VTX_CONFIG
#ifdef USE_VTX_COMMON #ifdef USE_VTX_COMMON

View file

@ -56,7 +56,6 @@ FAST_RAM_ZERO_INIT uint16_t averageSystemLoadPercent = 0;
static FAST_RAM_ZERO_INIT int taskQueuePos = 0; static FAST_RAM_ZERO_INIT int taskQueuePos = 0;
STATIC_UNIT_TESTED FAST_RAM_ZERO_INIT int taskQueueSize = 0; STATIC_UNIT_TESTED FAST_RAM_ZERO_INIT int taskQueueSize = 0;
static FAST_RAM_ZERO_INIT schedulerPolicy_e policy;
static FAST_RAM int periodCalculationBasisOffset = offsetof(cfTask_t, lastExecutedAt); static FAST_RAM int periodCalculationBasisOffset = offsetof(cfTask_t, lastExecutedAt);
// No need for a linked list for the queue, since items are only inserted at startup // No need for a linked list for the queue, since items are only inserted at startup
@ -246,15 +245,9 @@ void schedulerInit(void)
queueAdd(&cfTasks[TASK_SYSTEM]); queueAdd(&cfTasks[TASK_SYSTEM]);
} }
void schedulerSetPolicy(schedulerPolicy_e newPolicy) void schedulerOptimizeRate(bool optimizeRate)
{ {
policy = newPolicy; periodCalculationBasisOffset = optimizeRate ? offsetof(cfTask_t, lastDesiredAt) : offsetof(cfTask_t, lastExecutedAt);
if (policy == SCHEDULER_POLICY_PRIORITIZE_AVERAGE_RATE) {
periodCalculationBasisOffset = offsetof(cfTask_t, lastDesiredAt);
} else
{
periodCalculationBasisOffset = offsetof(cfTask_t, lastExecutedAt);
}
} }
inline static timeUs_t getPeriodCalculationBasis(const cfTask_t* task) inline static timeUs_t getPeriodCalculationBasis(const cfTask_t* task)

View file

@ -185,7 +185,7 @@ void schedulerResetTaskMaxExecutionTime(cfTaskId_e taskId);
void schedulerInit(void); void schedulerInit(void);
void scheduler(void); void scheduler(void);
void taskSystemLoad(timeUs_t currentTime); void taskSystemLoad(timeUs_t currentTime);
void schedulerSetPolicy(schedulerPolicy_e policy); void schedulerOptimizeRate(bool optimizeRate);
#define LOAD_PERCENTAGE_ONE 100 #define LOAD_PERCENTAGE_ONE 100