From b3bb926ee85dbd2789f1524f0236cf3907eaccac Mon Sep 17 00:00:00 2001 From: rusEfi Date: Mon, 13 Jul 2015 20:02:18 -0400 Subject: [PATCH] auto-sync --- firmware/controllers/flash_main.cpp | 20 ++++++++++++++------ firmware/controllers/settings.cpp | 1 - firmware/hw_layer/hardware.cpp | 7 ++++++- firmware/hw_layer/hardware.h | 2 -- firmware/hw_layer/pin_repository.cpp | 3 +++ 5 files changed, 23 insertions(+), 10 deletions(-) diff --git a/firmware/controllers/flash_main.cpp b/firmware/controllers/flash_main.cpp index 8b91d1cbf5..772f47eadb 100644 --- a/firmware/controllers/flash_main.cpp +++ b/firmware/controllers/flash_main.cpp @@ -14,6 +14,9 @@ #include "flash.h" #include "rusefi.h" +// this message is part of console API, see FLASH_SUCCESS_MSG in java code +#define FLASH_SUCCESS_MSG "FLASH_SUCESS" + #if EFI_TUNER_STUDIO || defined(__DOXYGEN__) #include "tunerstudio.h" #endif @@ -67,15 +70,20 @@ void writeToFlashNow(void) { persistentState.size = PERSISTENT_SIZE; persistentState.version = FLASH_DATA_VERSION; scheduleMsg(logger, "flash compatible with %d", persistentState.version); - crc_t result = flashStateCrc(&persistentState); - persistentState.value = result; + crc_t crcResult = flashStateCrc(&persistentState); + persistentState.value = crcResult; scheduleMsg(logger, "Reseting flash: size=%d", PERSISTENT_SIZE); flashErase(FLASH_ADDR, PERSISTENT_SIZE); - scheduleMsg(logger, "Flashing with CRC=%d", result); + scheduleMsg(logger, "Flashing with CRC=%d", crcResult); efitimems_t nowMs = currentTimeMillis(); - result = flashWrite(FLASH_ADDR, (const char *) &persistentState, PERSISTENT_SIZE); - scheduleMsg(logger, "Flash programmed in (ms): %d", currentTimeMillis() - nowMs); - scheduleMsg(logger, "Flashing result: %d", result); + int result = flashWrite(FLASH_ADDR, (const char *) &persistentState, PERSISTENT_SIZE); + scheduleMsg(logger, "Flash programmed in %dms", currentTimeMillis() - nowMs); + bool_t isSuccess = result == FLASH_RETURN_SUCCESS; + if (isSuccess) { + scheduleMsg(logger, FLASH_SUCCESS_MSG); + } else { + scheduleMsg(logger, "Flashing failed"); + } maxLockTime = 0; } diff --git a/firmware/controllers/settings.cpp b/firmware/controllers/settings.cpp index 9e35c25e0f..01550af504 100644 --- a/firmware/controllers/settings.cpp +++ b/firmware/controllers/settings.cpp @@ -915,7 +915,6 @@ static void printAllInfo(void) { #endif #if EFI_PROD_CODE scheduleMsg(&logger, "console mode jumper: %s", boolToString(!GET_CONSOLE_MODE_VALUE())); - scheduleMsg(&logger, "board test mode jumper: %s", boolToString(GET_BOARD_TEST_MODE_VALUE())); #endif } diff --git a/firmware/hw_layer/hardware.cpp b/firmware/hw_layer/hardware.cpp index 9b220c251e..6b0efee42f 100644 --- a/firmware/hw_layer/hardware.cpp +++ b/firmware/hw_layer/hardware.cpp @@ -282,7 +282,12 @@ void initHardware(Logging *l) { mySetPadMode2("board test", boardConfiguration->boardTestModeJumperPin, PAL_MODE_INPUT_PULLUP); - bool isBoardTestMode_b = GET_BOARD_TEST_MODE_VALUE(); + bool isBoardTestMode_b = (!palReadPad(getHwPort(boardConfiguration->boardTestModeJumperPin), getHwPin(boardConfiguration->boardTestModeJumperPin))); + + // we can now relese this pin, it is actually used as output sometimes + unmarkPin(boardConfiguration->boardTestModeJumperPin); + + #if HAL_USE_ADC || defined(__DOXYGEN__) initAdcInputs(isBoardTestMode_b); diff --git a/firmware/hw_layer/hardware.h b/firmware/hw_layer/hardware.h index eeb2a5a8f3..0e6df20196 100644 --- a/firmware/hw_layer/hardware.h +++ b/firmware/hw_layer/hardware.h @@ -41,8 +41,6 @@ brain_pin_e getSckPin(spi_device_e device); #endif /* HAL_USE_SPI */ -#define GET_BOARD_TEST_MODE_VALUE() (!palReadPad(getHwPort(boardConfiguration->boardTestModeJumperPin), getHwPin(boardConfiguration->boardTestModeJumperPin))) - #ifdef __cplusplus #if EFI_PROD_CODE diff --git a/firmware/hw_layer/pin_repository.cpp b/firmware/hw_layer/pin_repository.cpp index 2fd20d6ee7..00a4afd09f 100644 --- a/firmware/hw_layer/pin_repository.cpp +++ b/firmware/hw_layer/pin_repository.cpp @@ -149,6 +149,9 @@ void initPinRepository(void) { addConsoleAction("pins", reportPins); } +/** + * See also unmarkPin() + */ static inline void markUsed(int index, const char *msg) { PIN_USED[index] = msg; totalPinsUsed++;