auto-sync
This commit is contained in:
parent
abaa6584d7
commit
9a61e8b0e0
|
@ -33,7 +33,8 @@
|
|||
#include "electronic_throttle.h"
|
||||
#include "idle_thread.h"
|
||||
#include "alternatorController.h"
|
||||
#endif
|
||||
#include "hardware.h"
|
||||
#endif /* EFI_PROD_CODE */
|
||||
|
||||
#include "hip9011_lookup.h"
|
||||
|
||||
|
@ -110,6 +111,21 @@ static fuel_table_t alphaNfuel = {
|
|||
|
||||
static volatile int globalConfigurationVersion = 0;
|
||||
|
||||
/**
|
||||
* Current engine configuration. On firmware start we assign empty configuration, then
|
||||
* we copy actual configuration after reading settings.
|
||||
* This is useful to compare old and new configurations in order to apply new settings.
|
||||
*
|
||||
* todo: place this field next to 'engineConfiguration'?
|
||||
*/
|
||||
engine_configuration_s activeConfiguration;
|
||||
|
||||
extern engine_configuration_s *engineConfiguration;
|
||||
|
||||
void rememberCurrentConfiguration(void) {
|
||||
memcpy(&activeConfiguration, engineConfiguration, sizeof(engine_configuration_s));
|
||||
}
|
||||
|
||||
/**
|
||||
* This counter is incremented every time user adjusts ECU parameters online (either via dev console or other
|
||||
* tuning software)
|
||||
|
@ -118,8 +134,16 @@ int getGlobalConfigurationVersion(void) {
|
|||
return globalConfigurationVersion;
|
||||
}
|
||||
|
||||
/**
|
||||
* this is the top-level method which should be called in case of any changes to engine configuration
|
||||
* online tuning of most values in the maps does not count as configuration change, but 'Burn' command does
|
||||
*/
|
||||
void incrementGlobalConfigurationVersion(void) {
|
||||
globalConfigurationVersion++;
|
||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
||||
applyNewHardwareSettings();
|
||||
#endif /* EFI_PROD_CODE */
|
||||
rememberCurrentConfiguration();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -53,6 +53,7 @@ void setWholeTimingTable(angle_t value DECLARE_ENGINE_PARAMETER_S);
|
|||
void setConstantDwell(floatms_t dwellMs DECLARE_ENGINE_PARAMETER_S);
|
||||
void printFloatArray(const char *prefix, float array[], int size);
|
||||
|
||||
void rememberCurrentConfiguration(void);
|
||||
void incrementGlobalConfigurationVersion(void);
|
||||
int getGlobalConfigurationVersion(void);
|
||||
|
||||
|
|
|
@ -390,7 +390,7 @@ static void setBit(const char *offsetStr, const char *bitStr, const char *valueS
|
|||
* this response is part of dev console API
|
||||
*/
|
||||
scheduleMsg(&logger, "bit @%d/%d is %d", offset, bit, value);
|
||||
applyNewConfiguration();
|
||||
incrementGlobalConfigurationVersion();
|
||||
}
|
||||
|
||||
static void setShort(const int offset, const int value) {
|
||||
|
@ -399,7 +399,7 @@ static void setShort(const int offset, const int value) {
|
|||
uint16_t *ptr = (uint16_t *) (&((char *) engineConfiguration)[offset]);
|
||||
*ptr = (uint16_t) value;
|
||||
getShort(offset);
|
||||
applyNewConfiguration();
|
||||
incrementGlobalConfigurationVersion();
|
||||
}
|
||||
|
||||
static void getBit(int offset, int bit) {
|
||||
|
@ -430,7 +430,7 @@ static void setInt(const int offset, const int value) {
|
|||
int *ptr = (int *) (&((char *) engineConfiguration)[offset]);
|
||||
*ptr = value;
|
||||
getInt(offset);
|
||||
applyNewConfiguration();
|
||||
incrementGlobalConfigurationVersion();
|
||||
}
|
||||
|
||||
static void getFloat(int offset) {
|
||||
|
|
|
@ -618,7 +618,7 @@ static void setIgnitionPin(const char *indexStr, const char *pinName) {
|
|||
}
|
||||
scheduleMsg(&logger, "setting ignition pin[%d] to %s please save&restart", index, hwPortname(pin));
|
||||
boardConfiguration->ignitionPins[index] = pin;
|
||||
applyNewConfiguration();
|
||||
incrementGlobalConfigurationVersion();
|
||||
}
|
||||
|
||||
static void setIndividualPin(const char *pinName, brain_pin_e *targetPin, const char *name) {
|
||||
|
@ -629,7 +629,7 @@ static void setIndividualPin(const char *pinName, brain_pin_e *targetPin, const
|
|||
}
|
||||
scheduleMsg(&logger, "setting %s pin to %s please save&restart", name, hwPortname(pin));
|
||||
*targetPin = pin;
|
||||
applyNewConfiguration();
|
||||
incrementGlobalConfigurationVersion();
|
||||
}
|
||||
|
||||
// set_idle_pin none
|
||||
|
@ -665,7 +665,7 @@ static void setInjectionPin(const char *indexStr, const char *pinName) {
|
|||
}
|
||||
scheduleMsg(&logger, "setting injection pin[%d] to %s please save&restart", index, hwPortname(pin));
|
||||
boardConfiguration->injectionPins[index] = pin;
|
||||
applyNewConfiguration();
|
||||
incrementGlobalConfigurationVersion();
|
||||
}
|
||||
|
||||
static void setTriggerInputPin(const char *indexStr, const char *pinName) {
|
||||
|
@ -680,7 +680,7 @@ static void setTriggerInputPin(const char *indexStr, const char *pinName) {
|
|||
}
|
||||
scheduleMsg(&logger, "setting trigger pin[%d] to %s please save&restart", index, hwPortname(pin));
|
||||
boardConfiguration->triggerInputPins[index] = pin;
|
||||
applyNewConfiguration();
|
||||
incrementGlobalConfigurationVersion();
|
||||
}
|
||||
|
||||
static void setTriggerSimulatorMode(const char *indexStr, const char *modeCode) {
|
||||
|
@ -706,7 +706,7 @@ static void setEgtCSPin(const char *indexStr, const char *pinName, board_configu
|
|||
}
|
||||
scheduleMsg(&logger, "setting EGT CS pin[%d] to %s please save&restart", index, hwPortname(pin));
|
||||
boardConfiguration->max31855_cs[index] = pin;
|
||||
applyNewConfiguration();
|
||||
incrementGlobalConfigurationVersion();
|
||||
}
|
||||
|
||||
static void setTriggerSimulatorPin(const char *indexStr, const char *pinName) {
|
||||
|
@ -720,7 +720,7 @@ static void setTriggerSimulatorPin(const char *indexStr, const char *pinName) {
|
|||
}
|
||||
scheduleMsg(&logger, "setting trigger simulator pin[%d] to %s please save&restart", index, hwPortname(pin));
|
||||
boardConfiguration->triggerSimulatorPins[index] = pin;
|
||||
applyNewConfiguration();
|
||||
incrementGlobalConfigurationVersion();
|
||||
}
|
||||
|
||||
#if HAL_USE_ADC || defined(__DOXYGEN__)
|
||||
|
@ -748,7 +748,7 @@ static void setAnalogInputPin(const char *sensorStr, const char *pinName) {
|
|||
engineConfiguration->tpsAdcChannel = channel;
|
||||
scheduleMsg(&logger, "setting TPS to %s/%d", pinName, channel);
|
||||
}
|
||||
applyNewConfiguration();
|
||||
incrementGlobalConfigurationVersion();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -135,6 +135,8 @@ bool hasFirmwareErrorFlag = false;
|
|||
|
||||
static virtual_timer_t resetTimer;
|
||||
|
||||
extern engine_configuration_s activeConfiguration;
|
||||
|
||||
EXTERN_ENGINE
|
||||
;
|
||||
|
||||
|
@ -158,24 +160,6 @@ static void scheduleReboot(void) {
|
|||
unlockAnyContext();
|
||||
}
|
||||
|
||||
/**
|
||||
* Current engine configuration. On firmware start we assign empty configuration, then
|
||||
* we copy actual configuration after reading settings.
|
||||
* This is useful to compare old and new configurations in order to apply new settings.
|
||||
*
|
||||
* todo: place this field next to 'engineConfiguration'?
|
||||
*/
|
||||
engine_configuration_s activeConfiguration;
|
||||
|
||||
static void rememberCurrentConfiguration(void) {
|
||||
memcpy(&activeConfiguration, engineConfiguration, sizeof(engine_configuration_s));
|
||||
}
|
||||
|
||||
void applyNewConfiguration(void) {
|
||||
applyNewHardwareSettings();
|
||||
rememberCurrentConfiguration();
|
||||
}
|
||||
|
||||
void runRusEfi(void) {
|
||||
efiAssertVoid(getRemainingStack(chThdSelf()) > 512, "init s");
|
||||
initIntermediateLoggingBuffer();
|
||||
|
|
|
@ -9,6 +9,5 @@
|
|||
#define RUSEFI_H_
|
||||
|
||||
void runRusEfi(void);
|
||||
void applyNewConfiguration(void);
|
||||
|
||||
#endif /* RUSEFI_H_ */
|
||||
|
|
Loading…
Reference in New Issue