diff --git a/firmware/config/boards/me7_pnp/board_configuration.cpp b/firmware/config/boards/me7_pnp/board_configuration.cpp index 61aed0604c..1fb7bbed46 100644 --- a/firmware/config/boards/me7_pnp/board_configuration.cpp +++ b/firmware/config/boards/me7_pnp/board_configuration.cpp @@ -62,7 +62,6 @@ void setBoardConfigurationOverrides(void) { boardConfiguration->triggerSimulatorPins[2] = GPIO_UNASSIGNED; boardConfiguration->triggerSimulatorPinModes[1] = OM_DEFAULT; boardConfiguration->triggerSimulatorPinModes[2] = OM_DEFAULT; - boardConfiguration->boardTestModeJumperPin = GPIO_UNASSIGNED; boardConfiguration->digitalPotentiometerSpiDevice = SPI_NONE; boardConfiguration->max31855spiDevice = SPI_NONE; engineConfiguration->warningLedPin = GPIO_UNASSIGNED; diff --git a/firmware/config/boards/nucleo_f767/board_configuration.cpp b/firmware/config/boards/nucleo_f767/board_configuration.cpp index 3417f4775e..5d8ac256ea 100644 --- a/firmware/config/boards/nucleo_f767/board_configuration.cpp +++ b/firmware/config/boards/nucleo_f767/board_configuration.cpp @@ -70,7 +70,7 @@ void setBoardConfigurationOverrides(void) { boardConfiguration->triggerSimulatorPinModes[1] = OM_DEFAULT; boardConfiguration->triggerSimulatorPinModes[2] = OM_DEFAULT; boardConfiguration->vehicleSpeedSensorInputPin = GPIO_UNASSIGNED; - boardConfiguration->boardTestModeJumperPin = GPIO_UNASSIGNED; + boardConfiguration->acRelayPin = GPIO_UNASSIGNED; boardConfiguration->digitalPotentiometerSpiDevice = SPI_NONE; boardConfiguration->max31855spiDevice = SPI_NONE; diff --git a/firmware/config/boards/prometheus/board_configuration.cpp b/firmware/config/boards/prometheus/board_configuration.cpp index dd3584294d..9fa4a961c1 100644 --- a/firmware/config/boards/prometheus/board_configuration.cpp +++ b/firmware/config/boards/prometheus/board_configuration.cpp @@ -216,7 +216,7 @@ void setBoardConfigurationOverrides(void) { boardConfiguration->triggerSimulatorPinModes[1] = OM_DEFAULT; boardConfiguration->triggerSimulatorPinModes[2] = OM_DEFAULT; boardConfiguration->vehicleSpeedSensorInputPin = GPIO_UNASSIGNED; - boardConfiguration->boardTestModeJumperPin = GPIO_UNASSIGNED; + boardConfiguration->acRelayPin = GPIO_UNASSIGNED; boardConfiguration->digitalPotentiometerSpiDevice = SPI_NONE; boardConfiguration->max31855spiDevice = SPI_NONE; diff --git a/firmware/config/boards/subaru-ej20gn/board_configuration.cpp b/firmware/config/boards/subaru-ej20gn/board_configuration.cpp index f3ab365c16..4cf9e5c694 100644 --- a/firmware/config/boards/subaru-ej20gn/board_configuration.cpp +++ b/firmware/config/boards/subaru-ej20gn/board_configuration.cpp @@ -178,7 +178,7 @@ void setBoardConfigurationOverrides(void) { boardConfiguration->digitalPotentiometerChipSelect[2] = GPIO_UNASSIGNED; boardConfiguration->digitalPotentiometerChipSelect[3] = GPIO_UNASSIGNED; boardConfiguration->vehicleSpeedSensorInputPin = GPIO_UNASSIGNED; - boardConfiguration->boardTestModeJumperPin = GPIO_UNASSIGNED; + boardConfiguration->acRelayPin = GPIO_UNASSIGNED; boardConfiguration->digitalPotentiometerSpiDevice = SPI_NONE; boardConfiguration->max31855spiDevice = SPI_NONE; diff --git a/firmware/config/stm32f4ems/efifeatures.h b/firmware/config/stm32f4ems/efifeatures.h index 773ce64055..9e0c0fff09 100644 --- a/firmware/config/stm32f4ems/efifeatures.h +++ b/firmware/config/stm32f4ems/efifeatures.h @@ -398,7 +398,6 @@ */ #define INTERMEDIATE_LOGGING_BUFFER_SIZE 2000 -#define EFI_BOARD_TEST TRUE #define EFI_JOYSTICK TRUE #endif /* EFIFEATURES_STM32F4_H_ */ diff --git a/firmware/controllers/algo/engine_configuration.cpp b/firmware/controllers/algo/engine_configuration.cpp index 45ba175ba5..55fe1b6b14 100644 --- a/firmware/controllers/algo/engine_configuration.cpp +++ b/firmware/controllers/algo/engine_configuration.cpp @@ -983,7 +983,6 @@ static void setDefaultFrankensoConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE) //boardConfiguration->logicAnalyzerPins[1] = GPIOE_5; // GPIOE_5 is a popular option (if available) - boardConfiguration->boardTestModeJumperPin = GPIOB_0; // set this to SPI_DEVICE_3 to enable stimulation //boardConfiguration->digitalPotentiometerSpiDevice = SPI_DEVICE_3; diff --git a/firmware/controllers/engine_controller.cpp b/firmware/controllers/engine_controller.cpp index 7ec86db45f..cb3d19b9d1 100644 --- a/firmware/controllers/engine_controller.cpp +++ b/firmware/controllers/engine_controller.cpp @@ -812,6 +812,6 @@ int getRusEfiVersion(void) { if (initBootloader() != 0) return 123; #endif /* EFI_BOOTLOADER_INCLUDE_CODE */ - return 20190728; + return 20190802; } #endif /* EFI_UNIT_TEST */ diff --git a/firmware/controllers/settings.cpp b/firmware/controllers/settings.cpp index a2344fe785..8452989197 100644 --- a/firmware/controllers/settings.cpp +++ b/firmware/controllers/settings.cpp @@ -282,8 +282,7 @@ void printConfiguration(const engine_configuration_s *engineConfiguration) { scheduleMsg(&logger, "clutchDown@%s: %s", hwPortname(boardConfiguration->clutchDownPin), boolToString(engine->clutchDownState)); - scheduleMsg(&logger, "boardTestModeJumperPin: %s/nesting=%d", - hwPortname(boardConfiguration->boardTestModeJumperPin), maxNesting); + scheduleMsg(&logger, "nesting=%d", maxNesting); scheduleMsg(&logger, "digitalPotentiometerSpiDevice %d", boardConfiguration->digitalPotentiometerSpiDevice); diff --git a/firmware/hw_layer/adc_inputs.cpp b/firmware/hw_layer/adc_inputs.cpp index 09d686c2ed..358398385e 100644 --- a/firmware/hw_layer/adc_inputs.cpp +++ b/firmware/hw_layer/adc_inputs.cpp @@ -32,7 +32,6 @@ #include "pin_repository.h" #include "engine_math.h" -#include "board_test.h" #include "engine_controller.h" #include "maf.h" //#include "biquad.h" @@ -533,7 +532,7 @@ static void configureInputs(void) { setAdcChannelOverrides(); } -void initAdcInputs(bool boardTestMode) { +void initAdcInputs() { printMsg(&logger, "initAdcInputs()"); if (ADC_BUF_DEPTH_FAST > MAX_ADC_GRP_BUF_DEPTH) firmwareError(CUSTOM_ERR_ADC_DEPTH_FAST, "ADC_BUF_DEPTH_FAST too high"); @@ -559,7 +558,7 @@ void initAdcInputs(bool boardTestMode) { /** * in board test mode all currently enabled ADC channels are running in slow mode */ - if (mode == ADC_SLOW || (boardTestMode && mode == ADC_FAST)) { + if (mode == ADC_SLOW) { slowAdc.enableChannelAndPin((adc_channel_e) (ADC_CHANNEL_IN0 + adc)); } else if (mode == ADC_FAST) { fastAdc.enableChannelAndPin((adc_channel_e) (ADC_CHANNEL_IN0 + adc)); diff --git a/firmware/hw_layer/adc_inputs.h b/firmware/hw_layer/adc_inputs.h index 9b98fadf55..45bb08e880 100644 --- a/firmware/hw_layer/adc_inputs.h +++ b/firmware/hw_layer/adc_inputs.h @@ -15,7 +15,7 @@ #if HAL_USE_ADC const char * getAdcMode(adc_channel_e hwChannel); -void initAdcInputs(bool boardTestMode); +void initAdcInputs(); // deprecated - migrate to 'getAdcChannelBrainPin' int getAdcChannelPin(adc_channel_e hwChannel); diff --git a/firmware/hw_layer/board_test.cpp b/firmware/hw_layer/board_test.cpp deleted file mode 100644 index 79b0d82576..0000000000 --- a/firmware/hw_layer/board_test.cpp +++ /dev/null @@ -1,234 +0,0 @@ -/** - * @file board_test.cpp - * @brief This is a simple board testing utility - * - * By default this is enabled by grounding PB0 - * - * @date Mar 12, 2014 - * @author Andrey Belomutskiy, (c) 2012-2018 - * - * This file is part of rusEfi - see http://rusefi.com - * - * rusEfi is free software; you can redistribute it and/or modify it under the terms of - * the GNU General Public License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * rusEfi is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without - * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with this program. - * If not, see . - */ - -#include "global.h" - -#if EFI_BOARD_TEST -#include "engine.h" -#include "board_test.h" -#include "pin_repository.h" -#include "efi_gpio.h" -#include "adc_inputs.h" -#include "AdcConfiguration.h" - -static volatile int stepCoutner = 0; -static volatile brain_pin_e currentPin = GPIO_UNASSIGNED; - -static bool isTimeForNextStep(int copy) { - return copy != stepCoutner; -} - -#if HAL_USE_ADC -extern AdcDevice slowAdc; -extern AdcDevice fastAdc; - -EXTERN_ENGINE; - -static void processAdcPin(AdcDevice *adc, int index) { - adc_channel_e hwIndex = adc->getAdcHardwareIndexByInternalIndex(index); - ioportid_t port = getAdcChannelPort("test", hwIndex); - int pin = getAdcChannelPin(hwIndex); - - int copy = stepCoutner; - - int c = 0; - - while (!isTimeForNextStep(copy)) { - print("ch%d hwIndex=%d %s%d\r\n", index, hwIndex, portname(port), pin); - int adcValue = adc->getAdcValueByIndex(index); - -// print("ADC%d val= %d%s", hwIndex, value, DELIMETER); - float volts = adcToVolts(adcValue) * 2; - print("v=%.2f adc=%d c=%d (hit 'n' for next step\r\n", volts, adcValue, c++); - - chThdSleepMilliseconds(300); - - } -} -#endif -static volatile int currentIndex = 0; - -static void waitForKey(void) { - print("Please hit N to continue\r\n"); - int copy = stepCoutner; - while (!isTimeForNextStep(copy)) { - chThdSleepMilliseconds(200); - } -} - -static void nextTestStep(void) { - stepCoutner++; -} - -static void setIndex(int index) { - currentIndex = index; - nextTestStep(); -} - -static brain_pin_e BLINK_PINS[] = { - GPIOE_8, // HIGH DRIVER 1 - GPIOE_10, // HIGH DRIVER 2 - GPIOE_12, // HIGH DRIVER 3 - GPIOE_14, // HIGH DRIVER 4 - GPIOC_9, // HIGH DRIVER 5 - GPIOC_7, // HIGH DRIVER 6 - GPIOD_8, // HIGH DRIVER 7 - GPIOD_9, // HIGH DRIVER 8 - // index = 6 - GPIOC_14, // OUT 1 - GPIOC_15, // OUT2 - GPIOE_6, // OUT3 - GPIOC_13, // OUT4 - GPIOE_4, // OUT5 - GPIOE_5, // OUT6 - GPIOE_2, // OUT7 - GPIOE_3, // OUT8 - GPIOE_0, // OUT9 - GPIOE_1, // OUT10 - GPIOB_8, // OUT11 - GPIOB_9, // OUT12 - GPIOD_3, // Frankenso PE1 reroute - GPIOD_5, // Frankenso PE0 reroute - GPIOD_7, // OUT3 Frankenso - GPIOB_7, // OUT12 Frankenso - }; - -int pinsCount = sizeof(BLINK_PINS) / sizeof(brain_pin_e); - -static THD_WORKING_AREA(btThreadStack, UTILITY_THREAD_STACK_SIZE); - -static void setCurrentPinValue(bool value) { - ioportid_t hwPort = getHwPort("test", currentPin); - uint32_t hwPin = getHwPin("test", currentPin); - palWritePad(hwPort, hwPin, value); -} - -static msg_t ivThread(int param) { - (void) param; - chRegSetThreadName("board test blinking"); - - int value = 0; - - while (TRUE) { - chThdSleepMilliseconds(250); - value = 1 - value; - setCurrentPinValue(value); - } -#if defined __GNUC__ - return 0; -#endif -} - -static bool is_board_test_mode = false; - -bool isBoardTestMode(void) { - return is_board_test_mode; -} - -void printBoardTestState(void) { - print("Current index=%d\r\n", currentIndex); - print("'n' for next step and 'set X' to return to step X\r\n"); -#if HAL_USE_ADC - print("ADC count: slow %d/fast %d\r\n", slowAdc.size(), fastAdc.size()); -#endif - - if (currentPin != GPIO_UNASSIGNED) { - print("Blinking %s\r\n", hwPortname(currentPin)); - } -} - -static void btInitOutputPins() { - for (int i = 0; i < pinsCount; i++) { - currentPin = BLINK_PINS[i]; - efiSetPadMode("test", currentPin, PAL_STM32_MODE_OUTPUT); - } -} - -static void blinkAllOutputPins() { - int msgCounter = 0; - for (int k = 0; k < 6; k++) { - for (int i = 0; i < pinsCount; i++) { - currentPin = BLINK_PINS[i]; - setCurrentPinValue(k % 2); - } - print("blinking %d\r\n", msgCounter++); - chThdSleepMilliseconds(250); - } - currentPin = GPIO_UNASSIGNED; - /** - * Now let's blink all pins one by one - */ - for (int k = 0; k < 2; k++) { - for (int i = 0; i < pinsCount; i++) { - if (currentPin != GPIO_UNASSIGNED) - setCurrentPinValue(false); // turn off previous pin - - currentPin = BLINK_PINS[i]; - setCurrentPinValue(true); - print("blinking %d!\r\n", msgCounter++); - chThdSleepMilliseconds(250); - } - } - setCurrentPinValue(false); - currentPin = GPIO_UNASSIGNED; -} - -void initBoardTest(void) { - is_board_test_mode = true; - addConsoleAction("n", nextTestStep); - addConsoleActionI("set", setIndex); - - btInitOutputPins(); - blinkAllOutputPins(); - - chThdCreateStatic(btThreadStack, sizeof(btThreadStack), NORMALPRIO, (tfunc_t)(void*) ivThread, NULL); - // this code is ugly as hell, I had no time to think. Todo: refactor - -#if HAL_USE_ADC - /** - * in board test mode all currently enabled ADC channels are running in slow mode - */ - while (currentIndex < slowAdc.size()) { - processAdcPin(&slowAdc, currentIndex); - currentIndex++; - } -#endif - - currentIndex = 0; - - while (currentIndex < pinsCount) { - currentPin = BLINK_PINS[currentIndex]; - - printBoardTestState(); - - currentIndex++; - waitForKey(); - } - // no buffered logger still, just plain old stdout - while (1) { - print("Board test done, thank you! Time to remove that jumper and reboot\r\n"); - print("Bye!\r\n"); - chThdSleepSeconds(1); - } -} -#endif /* EFI_BOARD_TEST */ diff --git a/firmware/hw_layer/board_test.h b/firmware/hw_layer/board_test.h deleted file mode 100644 index b2237561a4..0000000000 --- a/firmware/hw_layer/board_test.h +++ /dev/null @@ -1,39 +0,0 @@ -/** - * @file board_test.h - * - * @date Mar 12, 2014 - * @author Andrey Belomutskiy, (c) 2012-2017 - * - * This file is part of rusEfi - see http://rusefi.com - * - * rusEfi is free software; you can redistribute it and/or modify it under the terms of - * the GNU General Public License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * rusEfi is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without - * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with this program. - * If not, see . - * - */ - -#ifndef BOARD_TEST_H_ -#define BOARD_TEST_H_ - -void initBoardTest(void); - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -bool isBoardTestMode(void); -void printBoardTestState(void); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* BOARD_TEST_H_ */ diff --git a/firmware/hw_layer/hardware.cpp b/firmware/hw_layer/hardware.cpp index 3c24758635..d61b759a3a 100644 --- a/firmware/hw_layer/hardware.cpp +++ b/firmware/hw_layer/hardware.cpp @@ -33,7 +33,6 @@ #include "AdcConfiguration.h" #include "electronic_throttle.h" -#include "board_test.h" #include "mcp3208.h" #include "hip9011.h" #include "histogram.h" @@ -452,31 +451,12 @@ void initHardware(Logging *l) { initTriggerDecoder(); #endif - bool isBoardTestMode_b; - if (CONFIGB(boardTestModeJumperPin) != GPIO_UNASSIGNED) { - efiSetPadMode("board test", CONFIGB(boardTestModeJumperPin), - PAL_MODE_INPUT_PULLUP); - isBoardTestMode_b = (!efiReadPin(CONFIGB(boardTestModeJumperPin))); - - // we can now relese this pin, it is actually used as output sometimes - brain_pin_markUnused(CONFIGB(boardTestModeJumperPin)); - } else { - isBoardTestMode_b = false; - } - #if HAL_USE_ADC - initAdcInputs(isBoardTestMode_b); + initAdcInputs(); // wait for first set of ADC values so that we do not produce invalid sensor data waitForSlowAdc(1); #endif /* HAL_USE_ADC */ -#if EFI_BOARD_TEST - if (isBoardTestMode_b) { - // this method never returns - initBoardTest(); - } -#endif /* EFI_BOARD_TEST */ - initRtc(); #if HAL_USE_SPI diff --git a/firmware/hw_layer/hw_layer.mk b/firmware/hw_layer/hw_layer.mk index 0e5268de4e..20150308ea 100644 --- a/firmware/hw_layer/hw_layer.mk +++ b/firmware/hw_layer/hw_layer.mk @@ -19,7 +19,6 @@ HW_LAYER_EMS_CPP = $(HW_LAYER_EGT_CPP) \ $(PROJECT_DIR)/hw_layer/mmc_card.cpp \ $(PROJECT_DIR)/hw_layer/lcd/lcd_HD44780.cpp \ $(PROJECT_DIR)/hw_layer/adc_inputs.cpp \ - $(PROJECT_DIR)/hw_layer/board_test.cpp \ $(PROJECT_DIR)/hw_layer/pwm_generator.cpp \ $(PROJECT_DIR)/hw_layer/trigger_input.cpp \ $(PROJECT_DIR)/hw_layer/hip9011.cpp \ diff --git a/firmware/integration/rusefi_config.txt b/firmware/integration/rusefi_config.txt index 5108f1cf84..192a98ab6e 100644 --- a/firmware/integration/rusefi_config.txt +++ b/firmware/integration/rusefi_config.txt @@ -539,7 +539,7 @@ switch_input_pin_e clutchDownPin;some cars have a switch to indicate that clutch brain_pin_e wboHeaterPin; brain_pin_e cj125CsPin; spi_device_e max31855spiDevice; - brain_pin_e boardTestModeJumperPin; + brain_pin_e unused1133; spi_device_e digitalPotentiometerSpiDevice;Digital Potentiometer is used by stock ECU stimulation code brain_pin_e mc33972_cs; diff --git a/firmware/util/cli_registry.cpp b/firmware/util/cli_registry.cpp index 3bf1be5ebc..a825789185 100644 --- a/firmware/util/cli_registry.cpp +++ b/firmware/util/cli_registry.cpp @@ -18,10 +18,6 @@ #include "cli_registry.h" #include "efilib.h" -#if EFI_PROD_CODE -#include "board_test.h" -#endif - #if ! EFI_UNIT_TEST #include "eficonsole.h" #endif /* ! EFI_UNIT_TEST */ @@ -167,12 +163,6 @@ static int getParameterCount(action_type_e parameterType) { * @brief This function prints out a list of all available commands */ void helpCommand(void) { -#if EFI_BOARD_TEST - if (isBoardTestMode()) { - printBoardTestState(); - return; - } -#endif /* EFI_BOARD_TEST */ #if EFI_PROD_CODE || EFI_SIMULATOR scheduleMsg(logging, "%d actions available", consoleActionCount); 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 f07d2ccd3d..7ab4e5d747 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 integration\rusefi_config.txt Sun Jul 21 16:54:25 EDT 2019 +// this file was generated automatically by rusEfi tool ConfigDefinition.jar based on integration\rusefi_config.txt Fri Aug 02 01:26:57 EDT 2019 // by class com.rusefi.output.JavaFieldsConsumer import com.rusefi.config.*; @@ -163,7 +163,6 @@ public class Fields { public static final int biQuad_b2_offset = 2348; public static final int biQuad_offset = 2332; public static final int BLOCKING_FACTOR = 400; - public static final int boardTestModeJumperPin_offset = 676; public static final int boostCutPressure_offset = 2132; public static final int boostCutPressure_offset_hex = 854; public static final int brakePedalPin_offset = 2608; @@ -1169,6 +1168,7 @@ public class Fields { public static final int twoWireBatchInjection_offset = 1476; public static final int uartConsoleSerialSpeed_offset = 2076; public static final int unrealisticRpmThreashold_offset = 760; + public static final int unused1133_offset = 676; public static final int unused1234234_offset = 2042; public static final int unused_1484_bit_20_offset = 1476; public static final int unused_1484_bit_21_offset = 1476; @@ -1451,7 +1451,7 @@ public class Fields { public static final Field WBOHEATERPIN = Field.create("WBOHEATERPIN", 673, FieldType.INT8, brain_pin_e); public static final Field CJ125CSPIN = Field.create("CJ125CSPIN", 674, FieldType.INT8, brain_pin_e); public static final Field MAX31855SPIDEVICE = Field.create("MAX31855SPIDEVICE", 675, FieldType.INT8); - public static final Field BOARDTESTMODEJUMPERPIN = Field.create("BOARDTESTMODEJUMPERPIN", 676, FieldType.INT8, brain_pin_e); + public static final Field UNUSED1133 = Field.create("UNUSED1133", 676, FieldType.INT8, brain_pin_e); public static final Field DIGITALPOTENTIOMETERSPIDEVICE = Field.create("DIGITALPOTENTIOMETERSPIDEVICE", 677, FieldType.INT8); public static final Field MC33972_CS = Field.create("MC33972_CS", 678, FieldType.INT8, brain_pin_e); public static final Field MC33972_CSPINMODE = Field.create("MC33972_CSPINMODE", 679, FieldType.INT8, pin_output_mode_e); @@ -2224,7 +2224,7 @@ public class Fields { WBOHEATERPIN, CJ125CSPIN, MAX31855SPIDEVICE, - BOARDTESTMODEJUMPERPIN, + UNUSED1133, DIGITALPOTENTIOMETERSPIDEVICE, MC33972_CS, MC33972_CSPINMODE,