CONFIG_RESET_SWITCH

This commit is contained in:
Matthew Kennedy 2023-07-25 23:25:50 -07:00
parent f2f3cb2395
commit 1d309460e7
3 changed files with 1 additions and 23 deletions

View File

@ -66,7 +66,6 @@
#define LED_CRITICAL_ERROR_BRAIN_PIN Gpio::A13
#undef CONSOLE_MODE_SWITCH_PORT
#undef CONFIG_RESET_SWITCH_PORT
//!!!!!!!!!!!!!!!
//#undef EFI_INTERNAL_ADC

View File

@ -379,15 +379,6 @@
#define LED_CRITICAL_ERROR_BRAIN_PIN Gpio::D14
#endif
#ifndef CONFIG_RESET_SWITCH_PORT
// looks like this feature is not extremely popular, we can try living without it now :)
//#define CONFIG_RESET_SWITCH_PORT GPIOD
#endif
#ifndef CONFIG_RESET_SWITCH_PIN
#define CONFIG_RESET_SWITCH_PIN 6
#endif
#ifndef EFI_STORAGE_INT_FLASH
#define EFI_STORAGE_INT_FLASH TRUE
#endif

View File

@ -607,31 +607,19 @@ static void setDefaultEngineConfiguration() {
#include "default_script.lua"
}
#ifdef CONFIG_RESET_SWITCH_PORT
// this pin is not configurable at runtime so that we have a reliable way to reset configuration
#define SHOULD_IGNORE_FLASH() (palReadPad(CONFIG_RESET_SWITCH_PORT, CONFIG_RESET_SWITCH_PIN) == 0)
#else
#define SHOULD_IGNORE_FLASH() (false)
#endif // CONFIG_RESET_SWITCH_PORT
// by default, do not ignore config from flash! use it!
#ifndef IGNORE_FLASH_CONFIGURATION
#define IGNORE_FLASH_CONFIGURATION false
#endif
void loadConfiguration() {
#ifdef CONFIG_RESET_SWITCH_PORT
// initialize the reset pin if necessary
palSetPadMode(CONFIG_RESET_SWITCH_PORT, CONFIG_RESET_SWITCH_PIN, PAL_MODE_INPUT_PULLUP);
#endif /* CONFIG_RESET_SWITCH_PORT */
#if ! EFI_ACTIVE_CONFIGURATION_IN_FLASH
// Clear the active configuration so that registered output pins (etc) detect the change on startup and init properly
prepareVoidConfiguration(&activeConfiguration);
#endif /* EFI_ACTIVE_CONFIGURATION_IN_FLASH */
#if EFI_INTERNAL_FLASH
if (SHOULD_IGNORE_FLASH() || IGNORE_FLASH_CONFIGURATION) {
if (IGNORE_FLASH_CONFIGURATION) {
engineConfiguration->engineType = engine_type_e::DEFAULT_ENGINE_TYPE;
resetConfigurationExt(engineConfiguration->engineType);
writeToFlashNow();