1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-14 11:59:58 +03:00

[G4] CLI and config changes for overclocking

This commit is contained in:
jflyper 2019-09-26 20:44:17 +09:00
parent 575460ac52
commit 08f1f91c50
5 changed files with 10 additions and 9 deletions

View file

@ -4673,8 +4673,8 @@ static void cliStatus(const char *cmdName, char *cmdline)
cliPrintf("MCU %s Clock=%dMHz", getMcuTypeById(getMcuTypeId()), (SystemCoreClock / 1000000));
#ifdef STM32F4
// Only F4 is capable of switching between HSE/HSI (for now)
#if defined(STM32F4) || defined(STM32G4)
// Only F4 and G4 is capable of switching between HSE/HSI (for now)
int sysclkSource = SystemSYSCLKSource();
const char *SYSCLKSource[] = { "HSI", "HSE", "PLLP", "PLLR" };

View file

@ -351,7 +351,7 @@ static const char * const lookupTableRatesType[] = {
#ifdef USE_OVERCLOCK
static const char * const lookupOverclock[] = {
"OFF",
#if defined(STM32F40_41xxx)
#if defined(STM32F40_41xxx) || defined(STM32G4)
"192MHZ", "216MHZ", "240MHZ"
#elif defined(STM32F411xE)
"108MHZ", "120MHZ"
@ -1429,7 +1429,7 @@ const clivalue_t valueTable[] = {
#endif // end of #ifdef USE_OSD
// PG_SYSTEM_CONFIG
#if defined(STM32F4)
#if defined(STM32F4) || defined(STM32G4)
{ "system_hse_mhz", VAR_UINT8 | HARDWARE_VALUE, .config.minmaxUnsigned = { 0, 30 }, PG_SYSTEM_CONFIG, offsetof(systemConfig_t, hseMhz) },
#endif
#if defined(USE_TASK_STATISTICS)

View file

@ -126,7 +126,7 @@ PG_RESET_TEMPLATE(systemConfig_t, systemConfig,
.cpu_overclock = DEFAULT_CPU_OVERCLOCK,
.powerOnArmingGraceTime = 5,
.boardIdentifier = TARGET_BOARD_IDENTIFIER,
.hseMhz = SYSTEM_HSE_VALUE, // Not used for non-F4 targets
.hseMhz = SYSTEM_HSE_VALUE, // Only used for F4 and G4 targets
.configurationState = CONFIGURATION_STATE_DEFAULTS_BARE,
.schedulerOptimizeRate = SCHEDULER_OPTIMIZE_RATE_AUTO,
.enableStickArming = false,

View file

@ -55,7 +55,7 @@ typedef struct systemConfig_s {
uint8_t cpu_overclock;
uint8_t powerOnArmingGraceTime; // in seconds
char boardIdentifier[sizeof(TARGET_BOARD_IDENTIFIER) + 1];
uint8_t hseMhz; // Not used for non-F4 targets
uint8_t hseMhz; // Only used for F4 and G4 targets
uint8_t configurationState; // The state of the configuration (defaults / configured)
uint8_t schedulerOptimizeRate;
uint8_t enableStickArming; // boolean that determines whether stick arming can be used

View file

@ -529,8 +529,9 @@ void init(void)
}
#endif
#ifdef STM32F4
// Only F4 has non-8MHz boards
#if defined(STM32F4) || defined(STM32G4)
// F4 has non-8MHz boards
// G4 for Betaflight allow 24 or 27MHz oscillator
systemClockSetHSEValue(systemConfig()->hseMhz * 1000000U);
#endif