more renaming to accomodate review feedback
This commit is contained in:
parent
6e46f05e7d
commit
d441955391
|
@ -90,7 +90,7 @@ PG_RESET_TEMPLATE(systemConfig_t, systemConfig,
|
|||
.boardIdentifier = TARGET_BOARD_IDENTIFIER,
|
||||
.hseMhz = SYSTEM_HSE_VALUE, // Not used for non-F4 targets
|
||||
.configured = false,
|
||||
.schedulerPolicy = SCHEDULER_POLICY_PRIORITIZE_PERIOD,
|
||||
.schedulerOptimizeRate = false,
|
||||
);
|
||||
|
||||
uint8_t getCurrentPidProfileIndex(void)
|
||||
|
@ -124,7 +124,7 @@ void resetConfigs(void)
|
|||
|
||||
static void activateConfig(void)
|
||||
{
|
||||
schedulerSetPolicy(systemConfig()->schedulerPolicy);
|
||||
schedulerOptimizeRate(systemConfig()->schedulerOptimizeRate);
|
||||
loadPidProfile();
|
||||
loadControlRateProfile();
|
||||
|
||||
|
|
|
@ -33,11 +33,6 @@ typedef struct pilotConfig_s {
|
|||
|
||||
PG_DECLARE(pilotConfig_t, pilotConfig);
|
||||
|
||||
typedef enum {
|
||||
SCHEDULER_POLICY_PRIORITIZE_PERIOD,
|
||||
SCHEDULER_POLICY_PRIORITIZE_AVERAGE_RATE,
|
||||
} schedulerPolicy_e;
|
||||
|
||||
typedef struct systemConfig_s {
|
||||
uint8_t pidProfileIndex;
|
||||
uint8_t activeRateProfile;
|
||||
|
@ -49,7 +44,7 @@ typedef struct systemConfig_s {
|
|||
char boardIdentifier[sizeof(TARGET_BOARD_IDENTIFIER) + 1];
|
||||
uint8_t hseMhz; // Not used for non-F4 targets
|
||||
uint8_t configured;
|
||||
uint8_t schedulerPolicy;
|
||||
uint8_t schedulerOptimizeRate;
|
||||
} systemConfig_t;
|
||||
|
||||
PG_DECLARE(systemConfig_t, systemConfig);
|
||||
|
|
|
@ -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) },
|
||||
#endif
|
||||
{ "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
|
||||
#ifdef USE_VTX_COMMON
|
||||
|
|
|
@ -56,7 +56,6 @@ FAST_RAM_ZERO_INIT uint16_t averageSystemLoadPercent = 0;
|
|||
static FAST_RAM_ZERO_INIT int taskQueuePos = 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);
|
||||
|
||||
// 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]);
|
||||
}
|
||||
|
||||
void schedulerSetPolicy(schedulerPolicy_e newPolicy)
|
||||
void schedulerOptimizeRate(bool optimizeRate)
|
||||
{
|
||||
policy = newPolicy;
|
||||
if (policy == SCHEDULER_POLICY_PRIORITIZE_AVERAGE_RATE) {
|
||||
periodCalculationBasisOffset = offsetof(cfTask_t, lastDesiredAt);
|
||||
} else
|
||||
{
|
||||
periodCalculationBasisOffset = offsetof(cfTask_t, lastExecutedAt);
|
||||
}
|
||||
periodCalculationBasisOffset = optimizeRate ? offsetof(cfTask_t, lastDesiredAt) : offsetof(cfTask_t, lastExecutedAt);
|
||||
}
|
||||
|
||||
inline static timeUs_t getPeriodCalculationBasis(const cfTask_t* task)
|
||||
|
|
|
@ -185,7 +185,7 @@ void schedulerResetTaskMaxExecutionTime(cfTaskId_e taskId);
|
|||
void schedulerInit(void);
|
||||
void scheduler(void);
|
||||
void taskSystemLoad(timeUs_t currentTime);
|
||||
void schedulerSetPolicy(schedulerPolicy_e policy);
|
||||
void schedulerOptimizeRate(bool optimizeRate);
|
||||
|
||||
#define LOAD_PERCENTAGE_ONE 100
|
||||
|
||||
|
|
Loading…
Reference in New Issue