Skip to content

Commit

Permalink
debug modes cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
mck1117 committed Sep 13, 2023
1 parent 6eb7cbf commit 0de6cd4
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 33 deletions.
3 changes: 0 additions & 3 deletions firmware/config/engines/custom_engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,6 @@ void setTle8888TestConfiguration() {
engineConfiguration->spi1misoPin = Gpio::B4;
engineConfiguration->spi1sckPin = Gpio::B3; // please note that this pin is also SWO/SWD - Single Wire debug Output
engineConfiguration->is_enabled_spi_1 = true;
engineConfiguration->debugMode = DBG_TLE8888;

engineConfiguration->fuelPumpPin = Gpio::TLE8888_PIN_20;
#endif /* BOARD_TLE8888_COUNT */
Expand Down Expand Up @@ -374,8 +373,6 @@ void setTle8888TestConfiguration() {
*/
static void mreBoardOldTest() {
#if (BOARD_TLE8888_COUNT > 0)
engineConfiguration->debugMode = DBG_TLE8888;

engineConfiguration->triggerSimulatorRpm = 202;
// set cranking_rpm 500
engineConfiguration->cranking.rpm = 100;
Expand Down
8 changes: 3 additions & 5 deletions firmware/controllers/algo/engine_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -238,17 +238,15 @@ typedef enum __attribute__ ((__packed__)) {
DBG_UNUSED12 = 12,
DBG_SD_CARD = 13,
DBG_SR5_PROTOCOL = 14,
DBG_KNOCK = 15,
DBG_15 = 15,
DBG_16 = 16,
/**
* See also DBG_ELECTRONIC_THROTTLE_EXTRA
*/
DBG_ELECTRONIC_THROTTLE_PID = 17,
DBG_EXECUTOR = 18,
/**
* See tunerstudio.cpp
*/
DBG_BENCH_TEST = 19,

DBG_19 = 19,
DBG_20 = 20,
/**
* ADC
Expand Down
21 changes: 0 additions & 21 deletions firmware/controllers/algo/wall_fuel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,6 @@ float WallFuel::adjust(float desiredMassGrams) {
float fuelFilmMass = wallFuel;
float M_cmd = (desiredMassGrams - (1 - alpha) * fuelFilmMass) / (1 - beta);

#if EFI_TUNER_STUDIO
if (engineConfiguration->debugMode == DBG_KNOCK) {
engine->outputChannels.debugFloatField3 = fuelFilmMass;
engine->outputChannels.debugFloatField4 = M_cmd;
}
#endif // EFI_TUNER_STUDIO

// We can't inject a negative amount of fuel
// If this goes below zero we will be over-fueling slightly,
// but that's ok.
Expand All @@ -71,12 +64,6 @@ float WallFuel::adjust(float desiredMassGrams) {
// remainder on walls from last time + new from this time
float fuelFilmMassNext = alpha * fuelFilmMass + beta * M_cmd;

#if EFI_TUNER_STUDIO
if (engineConfiguration->debugMode == DBG_KNOCK) {
engine->outputChannels.debugFloatField5 = fuelFilmMassNext;
}
#endif // EFI_TUNER_STUDIO

wallFuel = fuelFilmMassNext;
wallFuelCorrection = M_cmd - desiredMassGrams;
return M_cmd;
Expand Down Expand Up @@ -185,12 +172,4 @@ void WallFuelController::onFastCallback() {
m_alpha = alpha;
m_beta = beta;
m_enable = true;

#if EFI_TUNER_STUDIO
// TODO: why DBG_KNOCK? That seems wrong.
if (engineConfiguration->debugMode == DBG_KNOCK) {
engine->outputChannels.debugFloatField1 = alpha;
engine->outputChannels.debugFloatField2 = beta;
}
#endif // EFI_TUNER_STUDIO
}
4 changes: 0 additions & 4 deletions firmware/controllers/sensors/impl/software_knock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,6 @@ void processLastKnockEvent() {
float volts = ratio * sampleBuffer[i];

float filtered = knockFilter.filter(volts);
if (i == localCount - 1 && engineConfiguration->debugMode == DBG_KNOCK) {
engine->outputChannels.debugFloatField1 = volts;
engine->outputChannels.debugFloatField2 = filtered;
}

sumSq += filtered * filtered;
}
Expand Down

0 comments on commit 0de6cd4

Please sign in to comment.