diff --git a/firmware/console/status_loop.cpp b/firmware/console/status_loop.cpp index ac89c9affb..00404e1af8 100644 --- a/firmware/console/status_loop.cpp +++ b/firmware/console/status_loop.cpp @@ -571,8 +571,6 @@ static void initStatusLeds(void) { enginePins.runningLedPin.initPin("led: running status", engineConfiguration->runningLedPin); enginePins.debugTriggerSync.initPin("debug: sync", CONFIG(debugTriggerSync)); - enginePins.debugTimerCallback.initPin("debug: timer callback", CONFIG(debugTimerCallback)); - enginePins.debugSetTimer.initPin("debug: set timer", CONFIG(debugSetTimer)); } #define BLINKING_PERIOD_MS 33 diff --git a/firmware/controllers/algo/obd_error_codes.h b/firmware/controllers/algo/obd_error_codes.h index 0bb0177425..ffe9086049 100644 --- a/firmware/controllers/algo/obd_error_codes.h +++ b/firmware/controllers/algo/obd_error_codes.h @@ -1872,7 +1872,7 @@ typedef enum { CUSTOM_ERR_UNEXPECTED_SPI = 6524, CUSTOM_ERR_EXT_MODE = 6525, CUSTOM_ERR_TIMER_OVERFLOW = 6526, - CUSTOM_ERR_NULL_TIMER_CALLBACK = 6527, + CUSTOM_ERR_6527 = 6527, CUSTOM_ERR_SCHEDULING_ERROR = 6528, CUSTOM_ERR_LOGGING_NOT_READY = 6529, ERROR_NAN_FIND_INDEX = 6530, diff --git a/firmware/controllers/system/efi_gpio.h b/firmware/controllers/system/efi_gpio.h index 400582c7fa..44fc631412 100644 --- a/firmware/controllers/system/efi_gpio.h +++ b/firmware/controllers/system/efi_gpio.h @@ -145,8 +145,6 @@ public: OutputPin runningLedPin; // green LED on brain board by default OutputPin debugTriggerSync; - OutputPin debugTimerCallback; - OutputPin debugSetTimer; OutputPin boostPin; OutputPin idleSolenoidPin; OutputPin secondIdleSolenoidPin; diff --git a/firmware/controllers/system/timer/single_timer_executor.cpp b/firmware/controllers/system/timer/single_timer_executor.cpp index c2f06bad58..a30dff3aa2 100644 --- a/firmware/controllers/system/timer/single_timer_executor.cpp +++ b/firmware/controllers/system/timer/single_timer_executor.cpp @@ -35,8 +35,6 @@ #include "engine.h" EXTERN_ENGINE; -extern schfunc_t globalTimerCallback; - /** * these fields are global in order to facilitate debugging */ @@ -45,15 +43,9 @@ static efitime_t nextEventTimeNt = 0; uint32_t hwSetTimerDuration; uint32_t lastExecutionCount; -static void executorCallback(void *arg) { - (void)arg; +void globalTimerCallback() { efiAssertVoid(CUSTOM_ERR_6624, getCurrentRemainingStack() > EXPECTED_REMAINING_STACK, "lowstck#2y"); -// callbackTime = getTimeNowNt(); -// if ((callbackTime > nextEventTimeNt) && (callbackTime - nextEventTimeNt > US2NT(5000))) { -// timerIsLate++; -// } - ___engine.executor.onTimerCallback(); } @@ -180,7 +172,6 @@ void SingleTimerExecutor::scheduleTimerCallback() { } void initSingleTimerExecutorHardware(void) { - globalTimerCallback = executorCallback; initMicrosecondTimer(); } diff --git a/firmware/hw_layer/microsecond_timer.cpp b/firmware/hw_layer/microsecond_timer.cpp index a32be13e3a..23c0715edd 100644 --- a/firmware/hw_layer/microsecond_timer.cpp +++ b/firmware/hw_layer/microsecond_timer.cpp @@ -46,13 +46,11 @@ uint32_t maxPrecisionCallbackDuration = 0; static volatile efitick_t lastSetTimerTimeNt; static int lastSetTimerValue; -static volatile bool isTimerPending = FALSE; +static volatile bool isTimerPending = false; static volatile int timerCallbackCounter = 0; static volatile int timerRestartCounter = 0; -schfunc_t globalTimerCallback; - static const char * msg; static char buff[32]; @@ -66,7 +64,6 @@ static volatile bool hwStarted = false; * This function should be invoked under kernel lock which would disable interrupts. */ void setHardwareUsTimer(int32_t deltaTimeUs) { - enginePins.debugSetTimer.setValue(1); efiAssertVoid(OBD_PCM_Processor_Fault, hwStarted, "HW.started"); setHwTimerCounter++; /** @@ -83,7 +80,6 @@ void setHardwareUsTimer(int32_t deltaTimeUs) { if (deltaTimeUs >= TOO_FAR_INTO_FUTURE_US) { // we are trying to set callback for too far into the future. This does not look right at all firmwareError(CUSTOM_ERR_TIMER_OVERFLOW, "setHardwareUsTimer() too far: %d", deltaTimeUs); - // let's make this look special and NOT toggle enginePins.debugSetTimer return; } @@ -92,39 +88,32 @@ void setHardwareUsTimer(int32_t deltaTimeUs) { } if (GPTDEVICE.state != GPT_READY) { firmwareError(CUSTOM_HW_TIMER, "HW timer state %d/%d", GPTDEVICE.state, setHwTimerCounter); - // let's make this look special and NOT toggle enginePins.debugSetTimer return; } if (hasFirmwareError()) { - // let's make this look special and NOT toggle enginePins.debugSetTimer return; } gptStartOneShotI(&GPTDEVICE, deltaTimeUs); lastSetTimerTimeNt = getTimeNowNt(); lastSetTimerValue = deltaTimeUs; - isTimerPending = TRUE; + isTimerPending = true; timerRestartCounter++; - enginePins.debugSetTimer.setValue(0); } +void globalTimerCallback(); + static void hwTimerCallback(GPTDriver *gptp) { (void)gptp; - enginePins.debugTimerCallback.setValue(1); timerCallbackCounter++; - if (globalTimerCallback == NULL) { - firmwareError(CUSTOM_ERR_NULL_TIMER_CALLBACK, "NULL globalTimerCallback"); - return; - } isTimerPending = false; uint32_t before = getTimeNowLowerNt(); - globalTimerCallback(NULL); + globalTimerCallback(); uint32_t precisionCallbackDuration = getTimeNowLowerNt() - before; if (precisionCallbackDuration > maxPrecisionCallbackDuration) { maxPrecisionCallbackDuration = precisionCallbackDuration; } - enginePins.debugTimerCallback.setValue(0); } class MicrosecondTimerWatchdogController : public PeriodicTimerController { @@ -203,7 +192,6 @@ static void validateHardwareTimer() { } void initMicrosecondTimer(void) { - gptStart(&GPTDEVICE, &gpt5cfg); efiAssertVoid(CUSTOM_ERR_TIMER_STATE, GPTDEVICE.state == GPT_READY, "hw state"); hwStarted = true; diff --git a/firmware/integration/rusefi_config.txt b/firmware/integration/rusefi_config.txt index f0b41ed20b..cafe5b4b87 100644 --- a/firmware/integration/rusefi_config.txt +++ b/firmware/integration/rusefi_config.txt @@ -643,7 +643,7 @@ custom adc_channel_mode_e 4 bits, U32, @OFFSET@, [0:7], "Off", "Slow", "Fas brain_pin_e canRxPin;set_can_rx_pin X pin_input_mode_e throttlePedalUpPinMode; - brain_pin_e debugTimerCallback + uint8_t unused711; int idleThreadPeriodMs; int consoleLoopPeriodMs; @@ -717,7 +717,7 @@ pin_output_mode_e hip9011IntHoldPinMode; custom uart_device_e 1 bits,U32, @OFFSET@, [0:7], "Off", "UART1", "UART2", "UART3" int16_t sdCardPeriodMs;+SD card logging period, in milliseconds;"ms", 1, 0, 0, 30000, 0 - brain_pin_e debugSetTimer + uint8_t unused806 brain_pin_e debugMapAveraging; output_pin_e starterRelayDisablePin; pin_output_mode_e starterRelayDisableMode;On some vehicles we can disable starter once engine is already running diff --git a/firmware/tunerstudio/rusefi.input b/firmware/tunerstudio/rusefi.input index b1f643943d..783385d9ab 100644 --- a/firmware/tunerstudio/rusefi.input +++ b/firmware/tunerstudio/rusefi.input @@ -1918,8 +1918,6 @@ cmd_set_engine_type_default = "w\x00\x31\x00\x00" field = "LCD D6 pin", HD44780_db6 field = "LCD D7 pin", HD44780_db7 field = "Debug Trigger Sync", debugTriggerSync - field = "Debug Timer Callback", debugTimerCallback - field = "Debug Set Timer", debugSetTimer field = "Aux Fast Analog", auxFastSensor1_adcChannel dialog = allPins1_3 diff --git a/java_console/models/src/com/rusefi/config/generated/Fields.java b/java_console/models/src/com/rusefi/config/generated/Fields.java index 4391139cc0..caac298e07 100644 --- a/java_console/models/src/com/rusefi/config/generated/Fields.java +++ b/java_console/models/src/com/rusefi/config/generated/Fields.java @@ -1,6 +1,6 @@ package com.rusefi.config.generated; -// this file was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.bat integration\rusefi_config.txt Thu Apr 23 23:48:34 EDT 2020 +// this file was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.bat integration\rusefi_config.txt Fri Apr 24 23:22:49 EDT 2020 // by class com.rusefi.output.FileJavaFieldsConsumer import com.rusefi.config.*; @@ -336,9 +336,6 @@ public class Fields { public static final int debugMapAveraging_offset = 807; public static final int debugMapAveraging_offset_hex = 327; public static final int debugMode_offset = 2092; - public static final int debugSetTimer_offset = 806; - public static final int debugSetTimer_offset_hex = 326; - public static final int debugTimerCallback_offset = 711; public static final int debugTriggerSync_offset = 676; public static final int DIGIPOT_COUNT = 4; public static final int digitalPotentiometerChipSelect1_offset = 668; @@ -1440,7 +1437,10 @@ public class Fields { public static final int unused1059_offset = 3964; public static final int unused2432_offset = 2432; public static final int unused2432_offset_hex = 980; + public static final int unused711_offset = 711; public static final int unused76b0_offset = 76; + public static final int unused806_offset = 806; + public static final int unused806_offset_hex = 326; public static final int unused_1484_bit_24_offset = 1476; public static final int unused_1484_bit_25_offset = 1476; public static final int unused_1484_bit_26_offset = 1476; @@ -1811,7 +1811,7 @@ public class Fields { public static final Field CANTXPIN = Field.create("CANTXPIN", 708, FieldType.INT8, brain_pin_e); public static final Field CANRXPIN = Field.create("CANRXPIN", 709, FieldType.INT8, brain_pin_e); public static final Field THROTTLEPEDALUPPINMODE = Field.create("THROTTLEPEDALUPPINMODE", 710, FieldType.INT8); - public static final Field DEBUGTIMERCALLBACK = Field.create("DEBUGTIMERCALLBACK", 711, FieldType.INT8, brain_pin_e); + public static final Field UNUSED711 = Field.create("UNUSED711", 711, FieldType.INT8); public static final Field IDLETHREADPERIODMS = Field.create("IDLETHREADPERIODMS", 712, FieldType.INT); public static final Field CONSOLELOOPPERIODMS = Field.create("CONSOLELOOPPERIODMS", 716, FieldType.INT); public static final Field LCDTHREADPERIODMS = Field.create("LCDTHREADPERIODMS", 720, FieldType.INT); @@ -1909,7 +1909,7 @@ public class Fields { public static final Field MAX31855_CS7 = Field.create("MAX31855_CS7", 802, FieldType.INT8, brain_pin_e); public static final Field MAX31855_CS8 = Field.create("MAX31855_CS8", 803, FieldType.INT8, brain_pin_e); public static final Field SDCARDPERIODMS = Field.create("SDCARDPERIODMS", 804, FieldType.INT16); - public static final Field DEBUGSETTIMER = Field.create("DEBUGSETTIMER", 806, FieldType.INT8, brain_pin_e); + public static final Field UNUSED806 = Field.create("UNUSED806", 806, FieldType.INT8); public static final Field DEBUGMAPAVERAGING = Field.create("DEBUGMAPAVERAGING", 807, FieldType.INT8, brain_pin_e); public static final Field STARTERRELAYDISABLEPIN = Field.create("STARTERRELAYDISABLEPIN", 808, FieldType.INT8, output_pin_e); public static final Field STARTERRELAYDISABLEMODE = Field.create("STARTERRELAYDISABLEMODE", 809, FieldType.INT8, pin_output_mode_e); @@ -2739,7 +2739,7 @@ public class Fields { CANTXPIN, CANRXPIN, THROTTLEPEDALUPPINMODE, - DEBUGTIMERCALLBACK, + UNUSED711, IDLETHREADPERIODMS, CONSOLELOOPPERIODMS, LCDTHREADPERIODMS, @@ -2837,7 +2837,7 @@ public class Fields { MAX31855_CS7, MAX31855_CS8, SDCARDPERIODMS, - DEBUGSETTIMER, + UNUSED806, DEBUGMAPAVERAGING, STARTERRELAYDISABLEPIN, STARTERRELAYDISABLEMODE,