mirror of https://github.com/FOME-Tech/fome-fw.git
better logging
This commit is contained in:
parent
7f90b056cc
commit
9c6bb2d08f
|
@ -308,6 +308,11 @@ static void setAutoPeriod(int period) {
|
||||||
autoTune.reset();
|
autoTune.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void setAutoOffset(int offset) {
|
||||||
|
tuneWorkingPidSettings.offset = offset;
|
||||||
|
autoTune.reset();
|
||||||
|
}
|
||||||
|
|
||||||
void initElectronicThrottle(void) {
|
void initElectronicThrottle(void) {
|
||||||
addConsoleAction("ethinfo", showEthInfo);
|
addConsoleAction("ethinfo", showEthInfo);
|
||||||
if (!hasPedalPositionSensor()) {
|
if (!hasPedalPositionSensor()) {
|
||||||
|
@ -334,6 +339,7 @@ void initElectronicThrottle(void) {
|
||||||
addConsoleActionF("set_etbat_output", setTempOutput);
|
addConsoleActionF("set_etbat_output", setTempOutput);
|
||||||
addConsoleActionF("set_etbat_step", setAutoStep);
|
addConsoleActionF("set_etbat_step", setAutoStep);
|
||||||
addConsoleActionI("set_etbat_period", setAutoPeriod);
|
addConsoleActionI("set_etbat_period", setAutoPeriod);
|
||||||
|
addConsoleActionI("set_etbat_offset", setAutoOffset);
|
||||||
|
|
||||||
applyPidSettings();
|
applyPidSettings();
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,7 @@ void PID_AutoTune::reset() {
|
||||||
|
|
||||||
controlType = ZIEGLER_NICHOLS_PID;
|
controlType = ZIEGLER_NICHOLS_PID;
|
||||||
noiseBand = 0.5;
|
noiseBand = 0.5;
|
||||||
setState(AUTOTUNER_OFF);
|
state = AUTOTUNER_OFF; // cannot invoke setter here since logger is not initialized yet
|
||||||
oStep = 10.0;
|
oStep = 10.0;
|
||||||
memset(lastPeaks, 0, sizeof(lastPeaks));
|
memset(lastPeaks, 0, sizeof(lastPeaks));
|
||||||
memset(lastInputs, 0, sizeof(lastInputs));
|
memset(lastInputs, 0, sizeof(lastInputs));
|
||||||
|
@ -111,6 +111,7 @@ double PID_AutoTune::calculatePhaseLag(double inducedAmplitude)
|
||||||
|
|
||||||
void PID_AutoTune::setState(PidAutoTune_AutoTunerState state) {
|
void PID_AutoTune::setState(PidAutoTune_AutoTunerState state) {
|
||||||
this->state = state;
|
this->state = state;
|
||||||
|
scheduleMsg(logger, "setState %s", getPidAutoTune_AutoTunerState(state));
|
||||||
#if EFI_UNIT_TEST
|
#if EFI_UNIT_TEST
|
||||||
printf("setState %s\r\n", getPidAutoTune_AutoTunerState(state));
|
printf("setState %s\r\n", getPidAutoTune_AutoTunerState(state));
|
||||||
#endif /* EFI_UNIT_TEST */
|
#endif /* EFI_UNIT_TEST */
|
||||||
|
@ -118,6 +119,7 @@ void PID_AutoTune::setState(PidAutoTune_AutoTunerState state) {
|
||||||
|
|
||||||
void PID_AutoTune::setPeakType(PidAutoTune_Peak peakType) {
|
void PID_AutoTune::setPeakType(PidAutoTune_Peak peakType) {
|
||||||
this->peakType = peakType;
|
this->peakType = peakType;
|
||||||
|
scheduleMsg(logger, "setPeakType %s", getPidAutoTune_Peak(peakType));
|
||||||
#if EFI_UNIT_TEST
|
#if EFI_UNIT_TEST
|
||||||
printf("peakType %s\r\n", getPidAutoTune_Peak(peakType));
|
printf("peakType %s\r\n", getPidAutoTune_Peak(peakType));
|
||||||
#endif /* EFI_UNIT_TEST */
|
#endif /* EFI_UNIT_TEST */
|
||||||
|
@ -356,6 +358,7 @@ bool PID_AutoTune::Runtime(Logging *logger)
|
||||||
if (inputCount <= nLookBack)
|
if (inputCount <= nLookBack)
|
||||||
{
|
{
|
||||||
lastInputs[nLookBack - inputCount] = refVal;
|
lastInputs[nLookBack - inputCount] = refVal;
|
||||||
|
scheduleMsg(logger, "AT need more data %d %d", inputCount, nLookBack);
|
||||||
#if EFI_UNIT_TEST
|
#if EFI_UNIT_TEST
|
||||||
printf("need more data %d %d\r\n", inputCount, nLookBack);
|
printf("need more data %d %d\r\n", inputCount, nLookBack);
|
||||||
#endif /* EFI_UNIT_TEST */
|
#endif /* EFI_UNIT_TEST */
|
||||||
|
@ -380,6 +383,7 @@ bool PID_AutoTune::Runtime(Logging *logger)
|
||||||
lastInputs[i + 1] = val;
|
lastInputs[i + 1] = val;
|
||||||
}
|
}
|
||||||
lastInputs[0] = refVal;
|
lastInputs[0] = refVal;
|
||||||
|
scheduleMsg(logger, "isMin=%d isMax=%d", isMin, isMax);
|
||||||
|
|
||||||
// for AMIGOf tuning rule, perform an initial
|
// for AMIGOf tuning rule, perform an initial
|
||||||
// step change to calculate process gain K_process
|
// step change to calculate process gain K_process
|
||||||
|
@ -514,6 +518,8 @@ bool PID_AutoTune::Runtime(Logging *logger)
|
||||||
if (justChanged)
|
if (justChanged)
|
||||||
{
|
{
|
||||||
peakCount++;
|
peakCount++;
|
||||||
|
scheduleMsg(logger, "peakCount=%d", peakCount);
|
||||||
|
|
||||||
|
|
||||||
#if defined (AUTOTUNE_DEBUG)
|
#if defined (AUTOTUNE_DEBUG)
|
||||||
Serial.println(F("peakCount "));
|
Serial.println(F("peakCount "));
|
||||||
|
|
Loading…
Reference in New Issue