mirror of https://github.com/FOME-Tech/fome-fw.git
EFI_ACTIVE_CONFIGURATION_IN_FLASH
This commit is contained in:
parent
1913853adb
commit
48b8f08cb8
|
@ -33,8 +33,6 @@
|
||||||
|
|
||||||
#define EFI_TEXT_LOGGING TRUE
|
#define EFI_TEXT_LOGGING TRUE
|
||||||
|
|
||||||
#define EFI_ACTIVE_CONFIGURATION_IN_FLASH FALSE
|
|
||||||
|
|
||||||
#ifndef EFI_MC33816
|
#ifndef EFI_MC33816
|
||||||
#define EFI_MC33816 TRUE
|
#define EFI_MC33816 TRUE
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -111,22 +111,11 @@
|
||||||
*
|
*
|
||||||
* todo: place this field next to 'engineConfiguration'?
|
* todo: place this field next to 'engineConfiguration'?
|
||||||
*/
|
*/
|
||||||
#if EFI_ACTIVE_CONFIGURATION_IN_FLASH
|
|
||||||
#include "flash_int.h"
|
|
||||||
engine_configuration_s & activeConfiguration = reinterpret_cast<persistent_config_container_s*>(getFlashAddrFirstCopy())->persistentConfiguration.engineConfiguration;
|
|
||||||
// we cannot use this activeConfiguration until we call rememberCurrentConfiguration()
|
|
||||||
bool isActiveConfigurationVoid = true;
|
|
||||||
#else
|
|
||||||
static engine_configuration_s activeConfigurationLocalStorage;
|
static engine_configuration_s activeConfigurationLocalStorage;
|
||||||
engine_configuration_s & activeConfiguration = activeConfigurationLocalStorage;
|
engine_configuration_s & activeConfiguration = activeConfigurationLocalStorage;
|
||||||
#endif /* EFI_ACTIVE_CONFIGURATION_IN_FLASH */
|
|
||||||
|
|
||||||
void rememberCurrentConfiguration() {
|
void rememberCurrentConfiguration() {
|
||||||
#if ! EFI_ACTIVE_CONFIGURATION_IN_FLASH
|
|
||||||
memcpy(&activeConfiguration, engineConfiguration, sizeof(engine_configuration_s));
|
memcpy(&activeConfiguration, engineConfiguration, sizeof(engine_configuration_s));
|
||||||
#else
|
|
||||||
isActiveConfigurationVoid = false;
|
|
||||||
#endif /* EFI_ACTIVE_CONFIGURATION_IN_FLASH */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void wipeString(char *string, int size) {
|
static void wipeString(char *string, int size) {
|
||||||
|
@ -599,10 +588,8 @@ static void setDefaultEngineConfiguration() {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void loadConfiguration() {
|
void loadConfiguration() {
|
||||||
#if ! EFI_ACTIVE_CONFIGURATION_IN_FLASH
|
|
||||||
// Clear the active configuration so that registered output pins (etc) detect the change on startup and init properly
|
// Clear the active configuration so that registered output pins (etc) detect the change on startup and init properly
|
||||||
prepareVoidConfiguration(&activeConfiguration);
|
prepareVoidConfiguration(&activeConfiguration);
|
||||||
#endif /* EFI_ACTIVE_CONFIGURATION_IN_FLASH */
|
|
||||||
|
|
||||||
#if EFI_INTERNAL_FLASH
|
#if EFI_INTERNAL_FLASH
|
||||||
if (IGNORE_FLASH_CONFIGURATION) {
|
if (IGNORE_FLASH_CONFIGURATION) {
|
||||||
|
|
|
@ -85,16 +85,8 @@ extern persistent_config_s *config;
|
||||||
*/
|
*/
|
||||||
extern engine_configuration_s & activeConfiguration;
|
extern engine_configuration_s & activeConfiguration;
|
||||||
|
|
||||||
#if ! EFI_ACTIVE_CONFIGURATION_IN_FLASH
|
|
||||||
// We store a special changeable copy of configuration is RAM, so we can just compare them
|
// We store a special changeable copy of configuration is RAM, so we can just compare them
|
||||||
#define isConfigurationChanged(x) (engineConfiguration->x != activeConfiguration.x)
|
#define isConfigurationChanged(x) (engineConfiguration->x != activeConfiguration.x)
|
||||||
#else
|
|
||||||
// We cannot call prepareVoidConfiguration() for activeConfiguration if it's stored in flash,
|
|
||||||
// so we need to tell the firmware that it's "void" (i.e. zeroed, invalid) by setting a special flag variable,
|
|
||||||
// and then we consider 'x' as changed if it's just non-zero.
|
|
||||||
extern bool isActiveConfigurationVoid;
|
|
||||||
#define isConfigurationChanged(x) ((engineConfiguration->x != activeConfiguration.x) || (isActiveConfigurationVoid && (int)(engineConfiguration->x) != 0))
|
|
||||||
#endif /* EFI_ACTIVE_CONFIGURATION_IN_FLASH */
|
|
||||||
|
|
||||||
#define isPinOrModeChanged(pin, mode) (isConfigurationChanged(pin) || isConfigurationChanged(mode))
|
#define isPinOrModeChanged(pin, mode) (isConfigurationChanged(pin) || isConfigurationChanged(mode))
|
||||||
|
|
||||||
|
|
|
@ -54,11 +54,7 @@ void ButtonDebounce::startConfigurationList () {
|
||||||
|
|
||||||
void ButtonDebounce::stopConfiguration () {
|
void ButtonDebounce::stopConfiguration () {
|
||||||
// If the configuration has changed
|
// If the configuration has changed
|
||||||
#if ! EFI_ACTIVE_CONFIGURATION_IN_FLASH
|
|
||||||
if (*m_pin != active_pin || *m_mode != active_mode) {
|
if (*m_pin != active_pin || *m_mode != active_mode) {
|
||||||
#else
|
|
||||||
if (*m_pin != active_pin || *m_mode != active_mode || (isActiveConfigurationVoid && ((int)(*m_pin) != 0 || (int)(*m_mode) != 0))) {
|
|
||||||
#endif /* EFI_ACTIVE_CONFIGURATION_IN_FLASH */
|
|
||||||
#if EFI_PROD_CODE
|
#if EFI_PROD_CODE
|
||||||
efiSetPadUnused(active_pin);
|
efiSetPadUnused(active_pin);
|
||||||
#endif /* EFI_UNIT_TEST */
|
#endif /* EFI_UNIT_TEST */
|
||||||
|
|
|
@ -34,8 +34,6 @@
|
||||||
|
|
||||||
#define SC_BUFFER_SIZE 4000
|
#define SC_BUFFER_SIZE 4000
|
||||||
|
|
||||||
#define EFI_ACTIVE_CONFIGURATION_IN_FLASH FALSE
|
|
||||||
|
|
||||||
#define EFI_BOOST_CONTROL TRUE
|
#define EFI_BOOST_CONTROL TRUE
|
||||||
|
|
||||||
#define EFI_CANBUS_SLAVE FALSE
|
#define EFI_CANBUS_SLAVE FALSE
|
||||||
|
|
Loading…
Reference in New Issue