auto-sync
This commit is contained in:
parent
a7d7cf9cf3
commit
e737debcc1
|
@ -22,9 +22,10 @@ void single_wave_s::init(pin_state_t *pinStates) {
|
||||||
}
|
}
|
||||||
|
|
||||||
multi_wave_s::multi_wave_s() {
|
multi_wave_s::multi_wave_s() {
|
||||||
|
reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
multi_wave_s::multi_wave_s(float *switchTimes, single_wave_s *waves) {
|
multi_wave_s::multi_wave_s(float *switchTimes, single_wave_s *waves) : multi_wave_s() {
|
||||||
init(switchTimes, waves);
|
init(switchTimes, waves);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,12 +25,9 @@ static LENameOrdinalPair leVBatt(LE_METHOD_VBATT, "vbatt");
|
||||||
static LENameOrdinalPair leFan(LE_METHOD_FAN, "fan");
|
static LENameOrdinalPair leFan(LE_METHOD_FAN, "fan");
|
||||||
static LENameOrdinalPair leCoolant(LE_METHOD_COOLANT, "coolant");
|
static LENameOrdinalPair leCoolant(LE_METHOD_COOLANT, "coolant");
|
||||||
static LENameOrdinalPair leAcToggle(LE_METHOD_AC_TOGGLE, "ac_on_switch");
|
static LENameOrdinalPair leAcToggle(LE_METHOD_AC_TOGGLE, "ac_on_switch");
|
||||||
static LENameOrdinalPair leFanOnSetting(LE_METHOD_FAN_ON_SETTING,
|
static LENameOrdinalPair leFanOnSetting(LE_METHOD_FAN_ON_SETTING, "fan_on_setting");
|
||||||
"fan_on_setting");
|
static LENameOrdinalPair leFanOffSetting(LE_METHOD_FAN_OFF_SETTING, "fan_off_setting");
|
||||||
static LENameOrdinalPair leFanOffSetting(LE_METHOD_FAN_OFF_SETTING,
|
static LENameOrdinalPair leTimeSinceBoot(LE_METHOD_TIME_SINCE_BOOT, "time_since_boot");
|
||||||
"fan_off_setting");
|
|
||||||
static LENameOrdinalPair leTimeSinceBoot(LE_METHOD_TIME_SINCE_BOOT,
|
|
||||||
"time_since_boot");
|
|
||||||
static LENameOrdinalPair leFsioSsetting(LE_METHOD_FSIO_SETTING, "fsio_setting");
|
static LENameOrdinalPair leFsioSsetting(LE_METHOD_FSIO_SETTING, "fsio_setting");
|
||||||
|
|
||||||
#define LE_EVAL_POOL_SIZE 32
|
#define LE_EVAL_POOL_SIZE 32
|
||||||
|
@ -115,17 +112,19 @@ static void setFsioPin(const char *indexStr, const char *pinName) {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void setFsioExt(engine_configuration_s *engineConfiguration, int index,
|
void setFsioExt(engine_configuration_s *engineConfiguration, int index, brain_pin_e pin, const char * exp, int freq) {
|
||||||
brain_pin_e pin, const char * exp, int freq) {
|
|
||||||
board_configuration_s *boardConfiguration = &engineConfiguration->bc;
|
board_configuration_s *boardConfiguration = &engineConfiguration->bc;
|
||||||
|
|
||||||
boardConfiguration->fsioPins[index] = pin;
|
boardConfiguration->fsioPins[index] = pin;
|
||||||
|
int len = strlen(exp);
|
||||||
|
if (len >= LE_COMMAND_LENGTH) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
strcpy(boardConfiguration->le_formulas[index], exp);
|
strcpy(boardConfiguration->le_formulas[index], exp);
|
||||||
boardConfiguration->fsioFrequency[index] = freq;
|
boardConfiguration->fsioFrequency[index] = freq;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setFsio(engine_configuration_s *engineConfiguration, int index,
|
void setFsio(engine_configuration_s *engineConfiguration, int index, brain_pin_e pin, const char * exp) {
|
||||||
brain_pin_e pin, const char * exp) {
|
|
||||||
setFsioExt(engineConfiguration, index, pin, exp, 0);
|
setFsioExt(engineConfiguration, index, pin, exp, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -214,8 +213,7 @@ static void handleFsio(Engine *engine, int index) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void setPinState(const char * msg, OutputPin *pin, LEElement *element,
|
static void setPinState(const char * msg, OutputPin *pin, LEElement *element, Engine *engine) {
|
||||||
Engine *engine) {
|
|
||||||
if (element == NULL) {
|
if (element == NULL) {
|
||||||
warning(OBD_PCM_Processor_Fault, "invalid expression for %s", msg);
|
warning(OBD_PCM_Processor_Fault, "invalid expression for %s", msg);
|
||||||
} else {
|
} else {
|
||||||
|
@ -233,16 +231,14 @@ static void showFsio(const char *msg, LEElement *element) {
|
||||||
if (msg != NULL)
|
if (msg != NULL)
|
||||||
scheduleMsg(logger, "%s:", msg);
|
scheduleMsg(logger, "%s:", msg);
|
||||||
while (element != NULL) {
|
while (element != NULL) {
|
||||||
scheduleMsg(logger, "action %d: fValue=%f iValue=%d", element->action,
|
scheduleMsg(logger, "action %d: fValue=%f iValue=%d", element->action, element->fValue, element->iValue);
|
||||||
element->fValue, element->iValue);
|
|
||||||
element = element->next;
|
element = element->next;
|
||||||
}
|
}
|
||||||
scheduleMsg(logger, "<end>");
|
scheduleMsg(logger, "<end>");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void showFsioInfo(void) {
|
static void showFsioInfo(void) {
|
||||||
scheduleMsg(logger, "sys used %d/user used %d", sysPool.getSize(),
|
scheduleMsg(logger, "sys used %d/user used %d", sysPool.getSize(), userPool.getSize());
|
||||||
userPool.getSize());
|
|
||||||
showFsio("a/c", acRelayLogic);
|
showFsio("a/c", acRelayLogic);
|
||||||
showFsio("fuel", fuelPumpLogic);
|
showFsio("fuel", fuelPumpLogic);
|
||||||
showFsio("fan", radiatorFanLogic);
|
showFsio("fan", radiatorFanLogic);
|
||||||
|
@ -256,8 +252,7 @@ static void showFsioInfo(void) {
|
||||||
* is the fact that the target audience is more software developers
|
* is the fact that the target audience is more software developers
|
||||||
*/
|
*/
|
||||||
scheduleMsg(logger, "FSIO #%d [%s] at %s@%dHz value=%f", i, exp,
|
scheduleMsg(logger, "FSIO #%d [%s] at %s@%dHz value=%f", i, exp,
|
||||||
hwPortname(boardConfiguration->fsioPins[i]),
|
hwPortname(boardConfiguration->fsioPins[i]), boardConfiguration->fsioFrequency[i],
|
||||||
boardConfiguration->fsioFrequency[i],
|
|
||||||
engineConfiguration2->fsioLastValue[i]);
|
engineConfiguration2->fsioLastValue[i]);
|
||||||
// scheduleMsg(logger, "user-defined #%d value=%f", i, engine->engineConfiguration2->fsioLastValue[i]);
|
// scheduleMsg(logger, "user-defined #%d value=%f", i, engine->engineConfiguration2->fsioLastValue[i]);
|
||||||
showFsio(NULL, fsioLogics[i]);
|
showFsio(NULL, fsioLogics[i]);
|
||||||
|
@ -291,12 +286,10 @@ static void setFsioFrequency(int index, int frequency) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
boardConfiguration->fsioFrequency[index] = frequency;
|
boardConfiguration->fsioFrequency[index] = frequency;
|
||||||
scheduleMsg(logger, "Setting FSIO frequency %d on #%d", frequency,
|
scheduleMsg(logger, "Setting FSIO frequency %d on #%d", frequency, index + 1);
|
||||||
index + 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void setUserOutput(const char *indexStr, const char *quotedLine,
|
static void setUserOutput(const char *indexStr, const char *quotedLine, Engine *engine) {
|
||||||
Engine *engine) {
|
|
||||||
int index = atoi(indexStr) - 1;
|
int index = atoi(indexStr) - 1;
|
||||||
if (index < 0 || index >= LE_COMMAND_COUNT) {
|
if (index < 0 || index >= LE_COMMAND_COUNT) {
|
||||||
scheduleMsg(logger, "invalid index %d", index);
|
scheduleMsg(logger, "invalid index %d", index);
|
||||||
|
@ -334,8 +327,7 @@ void runFsio(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#if EFI_FUEL_PUMP
|
#if EFI_FUEL_PUMP
|
||||||
if (boardConfiguration->fuelPumpPin != GPIO_UNASSIGNED
|
if (boardConfiguration->fuelPumpPin != GPIO_UNASSIGNED && engineConfiguration->isFuelPumpEnabled) {
|
||||||
&& engineConfiguration->isFuelPumpEnabled) {
|
|
||||||
setPinState("pump", &enginePins.fuelPumpRelay, fuelPumpLogic, engine);
|
setPinState("pump", &enginePins.fuelPumpRelay, fuelPumpLogic, engine);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -353,8 +345,7 @@ void runFsio(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (boardConfiguration->alternatorControlPin != GPIO_UNASSIGNED) {
|
if (boardConfiguration->alternatorControlPin != GPIO_UNASSIGNED) {
|
||||||
setPinState("alternator", &enginePins.alternatorField, alternatorLogic,
|
setPinState("alternator", &enginePins.alternatorField, alternatorLogic, engine);
|
||||||
engine);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (boardConfiguration->fanPin != GPIO_UNASSIGNED) {
|
if (boardConfiguration->fanPin != GPIO_UNASSIGNED) {
|
||||||
|
@ -384,11 +375,9 @@ void initFsioImpl(Logging *sharedLogger, Engine *engine) {
|
||||||
if (brainPin != GPIO_UNASSIGNED) {
|
if (brainPin != GPIO_UNASSIGNED) {
|
||||||
int frequency = boardConfiguration->fsioFrequency[i];
|
int frequency = boardConfiguration->fsioFrequency[i];
|
||||||
if (frequency == 0) {
|
if (frequency == 0) {
|
||||||
outputPinRegisterExt2(getGpioPinName(i), &fsioOutputs[i],
|
outputPinRegisterExt2(getGpioPinName(i), &fsioOutputs[i], boardConfiguration->fsioPins[i], &defa);
|
||||||
boardConfiguration->fsioPins[i], &defa);
|
|
||||||
} else {
|
} else {
|
||||||
startSimplePwmExt(&fsioPwm[i], "FSIO", brainPin, &fsioOutputs[i],
|
startSimplePwmExt(&fsioPwm[i], "FSIO", brainPin, &fsioOutputs[i], frequency, 0.5f, applyPinState);
|
||||||
frequency, 0.5f, applyPinState);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -397,16 +386,14 @@ void initFsioImpl(Logging *sharedLogger, Engine *engine) {
|
||||||
brain_pin_e inputPin = engineConfiguration->fsioInputs[i];
|
brain_pin_e inputPin = engineConfiguration->fsioInputs[i];
|
||||||
|
|
||||||
if (inputPin != GPIO_UNASSIGNED) {
|
if (inputPin != GPIO_UNASSIGNED) {
|
||||||
mySetPadMode2("FSIO input", inputPin,
|
mySetPadMode2("FSIO input", inputPin, getInputMode(engineConfiguration->fsioInputModes[i]));
|
||||||
getInputMode(engineConfiguration->fsioInputModes[i]));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* EFI_PROD_CODE */
|
#endif /* EFI_PROD_CODE */
|
||||||
|
|
||||||
addConsoleActionSSP("set_fsio", (VoidCharPtrCharPtrVoidPtr) setUserOutput,
|
addConsoleActionSSP("set_fsio", (VoidCharPtrCharPtrVoidPtr) setUserOutput, engine);
|
||||||
engine);
|
|
||||||
addConsoleActionSS("set_fsio_pin", (VoidCharPtrCharPtr) setFsioPin);
|
addConsoleActionSS("set_fsio_pin", (VoidCharPtrCharPtr) setFsioPin);
|
||||||
addConsoleActionII("set_fsio_frequency", (VoidIntInt) setFsioFrequency);
|
addConsoleActionII("set_fsio_frequency", (VoidIntInt) setFsioFrequency);
|
||||||
addConsoleActionFF("set_fsio_setting", setFsioSetting);
|
addConsoleActionFF("set_fsio_setting", setFsioSetting);
|
||||||
|
|
|
@ -24,12 +24,15 @@ SimplePwm::SimplePwm() {
|
||||||
}
|
}
|
||||||
|
|
||||||
PwmConfig::PwmConfig() {
|
PwmConfig::PwmConfig() {
|
||||||
|
memset(&scheduling, 0, sizeof(scheduling));
|
||||||
scheduling.name = "PwmConfig";
|
scheduling.name = "PwmConfig";
|
||||||
|
periodNt = phaseCount = 0;
|
||||||
|
cycleCallback = NULL;
|
||||||
|
stateChangeCallback = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
PwmConfig::PwmConfig(float *st, single_wave_s *waves) {
|
PwmConfig::PwmConfig(float *st, single_wave_s *waves) : PwmConfig() {
|
||||||
multiWave.init(st, waves);
|
multiWave.init(st, waves);
|
||||||
scheduling.name = "PwmConfig";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PwmConfig::init(float *st, single_wave_s *waves) {
|
void PwmConfig::init(float *st, single_wave_s *waves) {
|
||||||
|
@ -191,7 +194,6 @@ void PwmConfig::weComplexInit(const char *msg, int phaseCount, float *switchTime
|
||||||
safe.phaseIndex = 0;
|
safe.phaseIndex = 0;
|
||||||
safe.periodNt = -1;
|
safe.periodNt = -1;
|
||||||
safe.iteration = -1;
|
safe.iteration = -1;
|
||||||
name = msg;
|
|
||||||
|
|
||||||
// let's start the indefinite callback loop of PWM generation
|
// let's start the indefinite callback loop of PWM generation
|
||||||
timerCallback(this);
|
timerCallback(this);
|
||||||
|
|
|
@ -56,7 +56,6 @@ public:
|
||||||
|
|
||||||
OutputPin *outputPins[PWM_PHASE_MAX_WAVE_PER_PWM];
|
OutputPin *outputPins[PWM_PHASE_MAX_WAVE_PER_PWM];
|
||||||
multi_wave_s multiWave;
|
multi_wave_s multiWave;
|
||||||
const char *name;
|
|
||||||
/**
|
/**
|
||||||
* float value of PWM period
|
* float value of PWM period
|
||||||
* PWM generation is not happening while this value is zero
|
* PWM generation is not happening while this value is zero
|
||||||
|
|
|
@ -129,6 +129,8 @@ ADC_TwoSamplingDelay_5Cycles, // cr1
|
||||||
AdcDevice fastAdc(&adcgrpcfg_fast);
|
AdcDevice fastAdc(&adcgrpcfg_fast);
|
||||||
|
|
||||||
static void pwmpcb_slow(PWMDriver *pwmp) {
|
static void pwmpcb_slow(PWMDriver *pwmp) {
|
||||||
|
efiAssertVoid(getRemainingStack(chThdSelf())> 32, "lwStAdcSlow");
|
||||||
|
|
||||||
#if EFI_INTERNAL_ADC
|
#if EFI_INTERNAL_ADC
|
||||||
(void) pwmp;
|
(void) pwmp;
|
||||||
|
|
||||||
|
@ -154,6 +156,7 @@ static void pwmpcb_slow(PWMDriver *pwmp) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void pwmpcb_fast(PWMDriver *pwmp) {
|
static void pwmpcb_fast(PWMDriver *pwmp) {
|
||||||
|
efiAssertVoid(getRemainingStack(chThdSelf())> 32, "lwStAdcFast");
|
||||||
#if EFI_INTERNAL_ADC
|
#if EFI_INTERNAL_ADC
|
||||||
(void) pwmp;
|
(void) pwmp;
|
||||||
|
|
||||||
|
|
|
@ -144,6 +144,8 @@ static int hipSampleIndex;
|
||||||
* This method is not in the adc* lower-level file because it is more business logic then hardware.
|
* This method is not in the adc* lower-level file because it is more business logic then hardware.
|
||||||
*/
|
*/
|
||||||
void adc_callback_fast(ADCDriver *adcp, adcsample_t *buffer, size_t n) {
|
void adc_callback_fast(ADCDriver *adcp, adcsample_t *buffer, size_t n) {
|
||||||
|
efiAssertVoid(getRemainingStack(chThdSelf()) > 64, "lowstck12a");
|
||||||
|
|
||||||
(void) buffer;
|
(void) buffer;
|
||||||
(void) n;
|
(void) n;
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// This file was generated by Version2Header
|
// This file was generated by Version2Header
|
||||||
// Tue Feb 24 07:56:32 EST 2015
|
// Tue Feb 24 15:02:50 EST 2015
|
||||||
#ifndef VCS_VERSION
|
#ifndef VCS_VERSION
|
||||||
#define VCS_VERSION "7040"
|
#define VCS_VERSION "7053"
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue