This commit is contained in:
rusefi 2017-05-06 16:12:24 -04:00
commit d62cd26336
40 changed files with 198 additions and 52 deletions

View File

@ -1,11 +1,16 @@
current binaries are always available at http://rusefi.com/build_server/ current binaries are always available at http://rusefi.com/build_server/
[![paypal](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=6YSSN35GWYS3A)
[![Tindie](http://rusefi.com/wiki/images/1/1c/Tindie-smalls.png)](https://www.tindie.com/stores/russian/)
#Releases #Releases
| Release date | Revision | Details | | Release date | Revision | Details |
| ------------ | --------- | ------- | | ------------ | --------- | ------- |
| 05/05/2017 | r13974 | bugfix #404: 36/1 FATAL error: angle range trgSync |
| 05/03/2017 | r13967 | improvement: ChibiOS 3.2 |
| 04/06/2017 | r13759 | major improvement #72: ChibiOS 3.1 | | 04/06/2017 | r13759 | major improvement #72: ChibiOS 3.1 |
| 03/26/2017 | r13330 | super annoying bug #336 fixed | | 03/26/2017 | r13330 | super annoying bug #336 fixed |
| 03/20/2017 | r13233 | improvements #375 & #376: hard FPU mode & migrating to fresh version of arm gcc | | 03/20/2017 | r13233 | improvements #375 & #376: hard FPU mode & migrating to fresh version of arm gcc |

@ -1 +1 @@
Subproject commit 97aaabeedd53ec16147696f8b44b16ee43d86a99 Subproject commit fa9b5ac5ae2f6df6b0b861547260fddde3b37830

@ -1 +1 @@
Subproject commit a7e847a894dbc8d15e178d63cba1e71d043c3fdf Subproject commit 0f416078cc00c1bb1be55453adc8dcdc9bb1baf4

View File

@ -176,6 +176,7 @@ CPPSRC = $(CHCPPSRC) \
$(DEV_SRC_CPP) \ $(DEV_SRC_CPP) \
$(CONTROLLERS_ALGO_SRC_CPP) \ $(CONTROLLERS_ALGO_SRC_CPP) \
$(SYSTEMSRC_CPP) \ $(SYSTEMSRC_CPP) \
$(BOARDSRC_CPP) \
$(ENGINES_SRC_CPP) \ $(ENGINES_SRC_CPP) \
$(HW_LAYER_EMS_CPP) \ $(HW_LAYER_EMS_CPP) \
$(HW_SENSORS_SRC) \ $(HW_SENSORS_SRC) \

View File

@ -13,8 +13,8 @@ rem magic once needed
call update_version.bat call update_version.bat
echo Starting compilation echo Starting compilation
rem the important piece rem the important piece (pass external args if needed)
make make %1 %2 %3
rem cd build rem cd build
rem if not exist rusefi.hex echo "compilation failed" rem if not exist rusefi.hex echo "compilation failed"

View File

@ -57,7 +57,9 @@
* *
* See also STM32F4xx_MCUCONF is defined in mcuconf.h * See also STM32F4xx_MCUCONF is defined in mcuconf.h
*/ */
#ifndef STM32F407xx
#define STM32F407xx #define STM32F407xx
#endif
/* /*
* IO pins assignments. * IO pins assignments.

View File

@ -1,5 +1,9 @@
# List of all the board related files. # List of all the board related files.
BOARDSRC = $(PROJECT_DIR)/config/boards/ST_STM32F4/board.c BOARDSRC = $(PROJECT_DIR)/config/boards/ST_STM32F4/board.c
BOARDSRC_CPP =
# Required include directories # Required include directories
BOARDINC = $(PROJECT_DIR)/config/boards/ST_STM32F4 BOARDINC = $(PROJECT_DIR)/config/boards/ST_STM32F4
# MCU defines
DDEFS += -DSTM32F407xx

View File

@ -180,7 +180,7 @@ void setMazdaMiata2003EngineConfiguration(DECLARE_ENGINE_PARAMETER_F) {
boardConfiguration->alternatorControlPin = GPIOE_10; boardConfiguration->alternatorControlPin = GPIOE_10;
boardConfiguration->alternatorControlPinMode = OM_OPENDRAIN; boardConfiguration->alternatorControlPinMode = OM_OPENDRAIN;
// boardConfiguration->vehicleSpeedSensorInputPin = GPIOA_8; // https://github.com/rusefi/rusefi/issues/401 boardConfiguration->vehicleSpeedSensorInputPin = GPIOA_8;
// enable altdebug // enable altdebug
engineConfiguration->targetVBatt = 13.8; engineConfiguration->targetVBatt = 13.8;

View File

@ -31,8 +31,11 @@ EXTERN_ENGINE;
void setRoverv8(DECLARE_ENGINE_PARAMETER_F) { void setRoverv8(DECLARE_ENGINE_PARAMETER_F) {
setOperationMode(engineConfiguration, FOUR_STROKE_CRANK_SENSOR); setOperationMode(engineConfiguration, FOUR_STROKE_CRANK_SENSOR);
// set trigger_type 9
engineConfiguration->trigger.type = TT_TOOTHED_WHEEL_36_1; engineConfiguration->trigger.type = TT_TOOTHED_WHEEL_36_1;
boardConfiguration->is_enabled_spi_2 = false;
boardConfiguration->isHip9011Enabled = false;
setFrankenstein_01_LCD(boardConfiguration); setFrankenstein_01_LCD(boardConfiguration);
engineConfiguration->specs.displacement = 3.528; engineConfiguration->specs.displacement = 3.528;
@ -114,12 +117,12 @@ void setRoverv8(DECLARE_ENGINE_PARAMETER_F) {
/* Stepper logic: /* Stepper logic:
boardConfiguration->idle.stepperDirectionPin = GPIOE_10; boardConfiguration->idle.stepperDirectionPin = GPIOE_10;
boardConfiguration->idle.stepperStepPin = GPIOE_12; boardConfiguration->idle.stepperStepPin = GPIOE_12; // todo: set pin which would not conflict with coils
engineConfiguration->stepperEnablePin = GPIOE_14; engineConfiguration->stepperEnablePin = GPIOE_14; // todo: set pin which would not conflict with coils
engineConfiguration->idleStepperReactionTime = 10; engineConfiguration->idleStepperReactionTime = 10;
engineConfiguration->idleStepperTotalSteps = 150; engineConfiguration->idleStepperTotalSteps = 150;
*/ */
boardConfiguration->useStepperIdle = true; boardConfiguration->useStepperIdle = false;
// set injection_pin_mode 0 // set injection_pin_mode 0
boardConfiguration->injectionPinMode = OM_DEFAULT; boardConfiguration->injectionPinMode = OM_DEFAULT;

View File

@ -18,6 +18,8 @@
#define EFI_CONSOLE_UART_DEVICE (&SD1) #define EFI_CONSOLE_UART_DEVICE (&SD1)
#define TS_SERIAL_UART_DEVICE (&SD3)
#define EFI_CONSOLE_TX_PORT GPIOC #define EFI_CONSOLE_TX_PORT GPIOC
#define EFI_CONSOLE_TX_PIN 10 #define EFI_CONSOLE_TX_PIN 10
#define EFI_CONSOLE_RX_PORT GPIOC #define EFI_CONSOLE_RX_PORT GPIOC

View File

@ -243,6 +243,10 @@
#define EFI_CONSOLE_UART_DEVICE (&SD3) #define EFI_CONSOLE_UART_DEVICE (&SD3)
#endif #endif
#ifndef TS_SERIAL_UART_DEVICE
#define TS_SERIAL_UART_DEVICE (&SD3)
#endif
// todo: start using consoleSerialTxPin? Not sure // todo: start using consoleSerialTxPin? Not sure
#ifndef EFI_CONSOLE_TX_PORT #ifndef EFI_CONSOLE_TX_PORT
#define EFI_CONSOLE_TX_PORT GPIOC #define EFI_CONSOLE_TX_PORT GPIOC

View File

@ -130,8 +130,6 @@
#define EEPROM_USE_EE25XX TRUE #define EEPROM_USE_EE25XX TRUE
#define rccEnableCRC(lp) rccEnableAHB(RCC_AHBENR_CRCEN, lp)
#define rccDisableCRC(lp) rccDisableAHB(RCC_AHBENR_CRCEN, lp)
/*===========================================================================*/ /*===========================================================================*/
/* CRC driver settings. */ /* CRC driver settings. */

View File

@ -21,10 +21,13 @@ extern LoggingWithStorage tsLogger;
#include "pin_repository.h" #include "pin_repository.h"
#include "usbconsole.h" #include "usbconsole.h"
#include "map_averaging.h" #include "map_averaging.h"
#if HAL_USE_SERIAL_USB || defined(__DOXYGEN__)
extern SerialUSBDriver SDU1; extern SerialUSBDriver SDU1;
#define CONSOLE_DEVICE &SDU1 #define CONSOLE_DEVICE &SDU1
#else
#define TS_SERIAL_UART_DEVICE &SD3 #define CONSOLE_DEVICE TS_SERIAL_UART_DEVICE
#endif
static SerialConfig tsSerialConfig = { 0, 0, USART_CR2_STOP1_BITS | USART_CR2_LINEN, 0 }; static SerialConfig tsSerialConfig = { 0, 0, USART_CR2_STOP1_BITS | USART_CR2_LINEN, 0 };
@ -56,10 +59,13 @@ void startTsPort(void) {
BaseChannel * getTsSerialDevice(void) { BaseChannel * getTsSerialDevice(void) {
#if EFI_PROD_CODE || defined(__DOXYGEN__) #if EFI_PROD_CODE || defined(__DOXYGEN__)
#if EFI_USB_SERIAL || defined(__DOXYGEN__)
if (isCommandLineConsoleOverTTL()) { if (isCommandLineConsoleOverTTL()) {
// if console uses UART then TS uses USB // if console uses UART then TS uses USB
return (BaseChannel *) &SDU1; return (BaseChannel *) CONSOLE_DEVICE;
} else { } else
#endif
{
return (BaseChannel *) TS_SERIAL_UART_DEVICE; return (BaseChannel *) TS_SERIAL_UART_DEVICE;
} }
#else #else

View File

@ -97,7 +97,8 @@ static void setWarningEnabled(int value) {
} }
#if EFI_FILE_LOGGING || defined(__DOXYGEN__) #if EFI_FILE_LOGGING || defined(__DOXYGEN__)
static char FILE_LOGGER[1000] CCM_OPTIONAL; // this one needs to be in main ram so that SD card SPI DMA works fine
static char FILE_LOGGER[1000] MAIN_RAM;
static Logging fileLogger("file logger", FILE_LOGGER, sizeof(FILE_LOGGER)); static Logging fileLogger("file logger", FILE_LOGGER, sizeof(FILE_LOGGER));
#endif /* EFI_FILE_LOGGING */ #endif /* EFI_FILE_LOGGING */
@ -748,7 +749,7 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels DECLARE_
tsOutputChannels->debugFloatField1 = getVoltage("fsio", engineConfiguration->fsioAdc[0]); tsOutputChannels->debugFloatField1 = getVoltage("fsio", engineConfiguration->fsioAdc[0]);
} }
} else if (engineConfiguration->debugMode == DBG_VEHICLE_SPEED_SENSOR) { } else if (engineConfiguration->debugMode == DBG_VEHICLE_SPEED_SENSOR) {
tsOutputChannels->debugIntField1 = engine->engineState.vssCounter; tsOutputChannels->debugIntField1 = engine->engineState.vssDebugEventCounter;
} else if (engineConfiguration->debugMode == DBG_SD_CARD) { } else if (engineConfiguration->debugMode == DBG_SD_CARD) {
tsOutputChannels->debugIntField1 = engine->engineState.totalLoggedBytes; tsOutputChannels->debugIntField1 = engine->engineState.totalLoggedBytes;
} else if (engineConfiguration->debugMode == DBG_CRANKING_DETAILS) { } else if (engineConfiguration->debugMode == DBG_CRANKING_DETAILS) {

View File

@ -16,6 +16,7 @@
#include "tunerstudio_configuration.h" #include "tunerstudio_configuration.h"
#include "fsio_impl.h" #include "fsio_impl.h"
#include "engine_math.h" #include "engine_math.h"
#include "pin_repository.h"
EXTERN_ENGINE EXTERN_ENGINE
; ;
@ -119,15 +120,25 @@ static void turnAuxPidOn(int index) {
engineConfiguration->auxPidFrequency[index], 0.1, applyPinState); engineConfiguration->auxPidFrequency[index], 0.1, applyPinState);
} }
void startAuxPins(void) {
for (int i = 0;i <AUX_PID_COUNT;i++) {
turnAuxPidOn(i);
}
}
void stopAuxPins(void) {
for (int i = 0;i < AUX_PID_COUNT;i++) {
unmarkPin(activeConfiguration.auxPidPins[i]);
}
}
void initAuxPid(Logging *sharedLogger) { void initAuxPid(Logging *sharedLogger) {
chThdCreateStatic(auxPidThreadStack, sizeof(auxPidThreadStack), LOWPRIO, chThdCreateStatic(auxPidThreadStack, sizeof(auxPidThreadStack), LOWPRIO,
(tfunc_t) auxPidThread, NULL); (tfunc_t) auxPidThread, NULL);
logger = sharedLogger; logger = sharedLogger;
for (int i = 0;i< AUX_PID_COUNT;i++) { startAuxPins();
turnAuxPidOn(i);
}
} }
#endif #endif

View File

@ -11,5 +11,7 @@
#include "engine.h" #include "engine.h"
void initAuxPid(Logging *sharedLogger); void initAuxPid(Logging *sharedLogger);
void startAuxPins(void);
void stopAuxPins(void);
#endif /* CONTROLLERS_ALGO_AUX_PID_H_ */ #endif /* CONTROLLERS_ALGO_AUX_PID_H_ */

View File

@ -106,6 +106,7 @@ void Engine::reset() {
sensorChartMode = SC_OFF; sensorChartMode = SC_OFF;
actualLastInjection = 0; actualLastInjection = 0;
isAlternatorControlEnabled = false; isAlternatorControlEnabled = false;
callFromPitStopEndTime = 0;
wallFuelCorrection = 0; wallFuelCorrection = 0;
/** /**
* it's important for fixAngle() that engineCycle field never has zero * it's important for fixAngle() that engineCycle field never has zero
@ -145,7 +146,7 @@ EngineState::EngineState() {
lastErrorCode = 0; lastErrorCode = 0;
crankingTime = 0; crankingTime = 0;
timeSinceCranking = 0; timeSinceCranking = 0;
vssCounter = 0; vssDebugEventCounter = 0;
targetAFR = 0; targetAFR = 0;
tpsAccelEnrich = 0; tpsAccelEnrich = 0;
tChargeK = 0; tChargeK = 0;

View File

@ -158,7 +158,7 @@ public:
float currentVE; float currentVE;
float targetAFR; float targetAFR;
int vssCounter; int vssDebugEventCounter;
int totalLoggedBytes; int totalLoggedBytes;
@ -274,6 +274,14 @@ public:
*/ */
bool isAlternatorControlEnabled; bool isAlternatorControlEnabled;
// floatms_t callToPitEndTime;
/**
* remote telemetry: if not zero, time to stop flashing 'CALL FROM PIT STOP' light
*/
floatms_t callFromPitStopEndTime;
/** /**
* This flag indicated a big enough problem that engine control would be * This flag indicated a big enough problem that engine control would be
* prohibited if this flag is set to true. * prohibited if this flag is set to true.

View File

@ -264,10 +264,6 @@ void prepareVoidConfiguration(engine_configuration_s *activeConfiguration) {
engineConfiguration->cj125ua = EFI_ADC_NONE; engineConfiguration->cj125ua = EFI_ADC_NONE;
engineConfiguration->cj125ur = EFI_ADC_NONE; engineConfiguration->cj125ur = EFI_ADC_NONE;
boardConfiguration->idle.stepperDirectionPin = GPIO_UNASSIGNED;
boardConfiguration->idle.stepperStepPin = GPIO_UNASSIGNED;
engineConfiguration->stepperEnablePin = GPIO_UNASSIGNED;
boardConfiguration->idle.stepperDirectionPin = GPIO_UNASSIGNED; boardConfiguration->idle.stepperDirectionPin = GPIO_UNASSIGNED;
boardConfiguration->idle.stepperStepPin = GPIO_UNASSIGNED; boardConfiguration->idle.stepperStepPin = GPIO_UNASSIGNED;
engineConfiguration->stepperEnablePin = GPIO_UNASSIGNED; engineConfiguration->stepperEnablePin = GPIO_UNASSIGNED;

View File

@ -1838,11 +1838,11 @@ typedef enum {
CUSTOM_ERR_PIN_ALREADY_USED_2 = 6134, CUSTOM_ERR_PIN_ALREADY_USED_2 = 6134,
CUSTOM_ERR_ICU_STATE = 6135, CUSTOM_ERR_ICU_STATE = 6135,
CUSTOM_ERR_TCHARGE_NOT_READY = 6136, CUSTOM_ERR_TCHARGE_NOT_READY = 6136,
CUSTOM_ERR_6137 = 6137, CUSTOM_ERR_TRIGGER_SHAPE_TOO_LONG = 6137,
CUSTOM_ERR_FUEL_TABLE_NOT_READY = 6138, CUSTOM_ERR_FUEL_TABLE_NOT_READY = 6138,
CUSTOM_ERR_TCHARGE_NOT_READY2 = 6139, CUSTOM_ERR_TCHARGE_NOT_READY2 = 6139,
CUSTOM_ERR_6140 = 6140, CUSTOM_ERR_COMMAND_LOWER_CASE_EXPECTED = 6140,
CUSTOM_ERR_FLASH_CRC_FAILED = 6141, CUSTOM_ERR_FLASH_CRC_FAILED = 6141,
CUSTOM_ERR_NOT_INPUT_PIN = 6142, CUSTOM_ERR_NOT_INPUT_PIN = 6142,
CUSTOM_ERR_SKIPPED_TOOTH_SHAPE = 6143, CUSTOM_ERR_SKIPPED_TOOTH_SHAPE = 6143,

View File

@ -296,6 +296,7 @@ void runIoTest(int subsystem, int index) {
} else if (subsystem == 0x16) { } else if (subsystem == 0x16) {
milBench(); milBench();
} else if (subsystem == 0x17) { } else if (subsystem == 0x17) {
} else if (subsystem == 0x20 && index == 0x3456) {
} }
} }

View File

@ -438,6 +438,10 @@ static void printTemperatureInfo(void) {
#endif /* EFI_ANALOG_SENSORS */ #endif /* EFI_ANALOG_SENSORS */
} }
static void setCallFromPitStop(int durationMs) {
engine->callFromPitStopEndTime = currentTimeMillis() + durationMs;
}
static void setCrankingRpm(int value) { static void setCrankingRpm(int value) {
engineConfiguration->cranking.rpm = value; engineConfiguration->cranking.rpm = value;
doPrintConfiguration(engine); doPrintConfiguration(engine);
@ -1024,6 +1028,7 @@ static void setTpsErrorDetectionTooHigh(int v) {
} }
command_i_s commandsI[] = {{"ignition_mode", setIgnitionMode}, command_i_s commandsI[] = {{"ignition_mode", setIgnitionMode},
{"call_from_pitstop", setCallFromPitStop},
{"cranking_rpm", setCrankingRpm}, {"cranking_rpm", setCrankingRpm},
{"cranking_injection_mode", setCrankingInjectionMode}, {"cranking_injection_mode", setCrankingInjectionMode},
{"injection_mode", setInjectionMode}, {"injection_mode", setInjectionMode},

View File

@ -50,13 +50,21 @@ void TriggerShape::calculateTriggerSynchPoint(TriggerState *state DECLARE_ENGINE
triggerShapeSynchPointIndex = findTriggerZeroEventIndex(state, this, triggerConfig PASS_ENGINE_PARAMETER); triggerShapeSynchPointIndex = findTriggerZeroEventIndex(state, this, triggerConfig PASS_ENGINE_PARAMETER);
engine->engineCycleEventCount = getLength(); int length = getLength();
engine->engineCycleEventCount = length;
efiAssertVoid(length > 0, "shapeLength=0");
if (length >= PWM_PHASE_MAX_COUNT) {
warning(CUSTOM_ERR_TRIGGER_SHAPE_TOO_LONG, "Count above %d", length);
shapeDefinitionError = true;
return;
}
float firstAngle = getAngle(triggerShapeSynchPointIndex); float firstAngle = getAngle(triggerShapeSynchPointIndex);
assertAngleRange(triggerShapeSynchPointIndex, "firstAngle");
int frontOnlyIndex = 0; int frontOnlyIndex = 0;
for (int eventIndex = 0; eventIndex < engine->engineCycleEventCount; eventIndex++) { for (int eventIndex = 0; eventIndex < length; eventIndex++) {
if (eventIndex == 0) { if (eventIndex == 0) {
// explicit check for zero to avoid issues where logical zero is not exactly zero due to float nature // explicit check for zero to avoid issues where logical zero is not exactly zero due to float nature
eventAngles[0] = 0; eventAngles[0] = 0;
@ -64,6 +72,7 @@ void TriggerShape::calculateTriggerSynchPoint(TriggerState *state DECLARE_ENGINE
eventAngles[1] = 0; eventAngles[1] = 0;
frontOnlyIndexes[0] = 0; frontOnlyIndexes[0] = 0;
} else { } else {
assertAngleRange(triggerShapeSynchPointIndex, "triggerShapeSynchPointIndex");
int triggerDefinitionCoordinate = (triggerShapeSynchPointIndex + eventIndex) % engine->engineCycleEventCount; int triggerDefinitionCoordinate = (triggerShapeSynchPointIndex + eventIndex) % engine->engineCycleEventCount;
efiAssertVoid(engine->engineCycleEventCount != 0, "zero engineCycleEventCount"); efiAssertVoid(engine->engineCycleEventCount != 0, "zero engineCycleEventCount");
int triggerDefinitionIndex = triggerDefinitionCoordinate >= size ? triggerDefinitionCoordinate - size : triggerDefinitionCoordinate; int triggerDefinitionIndex = triggerDefinitionCoordinate >= size ? triggerDefinitionCoordinate - size : triggerDefinitionCoordinate;
@ -260,7 +269,7 @@ angle_t TriggerShape::getAngle(int index) const {
* See also trigger_central.cpp * See also trigger_central.cpp
* See also getEngineCycleEventCount() * See also getEngineCycleEventCount()
*/ */
efiAssert(size != 0, "shapeSize=0", NAN);
int crankCycle = index / size; int crankCycle = index / size;
int remainder = index % size; int remainder = index % size;

View File

@ -13,7 +13,7 @@
#if EFI_SENSOR_CHART || defined(__DOXYGEN__) #if EFI_SENSOR_CHART || defined(__DOXYGEN__)
#include "status_loop.h" #include "status_loop.h"
static char LOGGING_BUFFER[5000]; static char LOGGING_BUFFER[5000] CCM_OPTIONAL;
static Logging logging("analog chart", LOGGING_BUFFER, sizeof(LOGGING_BUFFER)); static Logging logging("analog chart", LOGGING_BUFFER, sizeof(LOGGING_BUFFER));
static int pendingData = false; static int pendingData = false;

View File

@ -57,6 +57,15 @@ typedef unsigned int time_t;
#define EFI_ERROR_CODE 0xffffffff #define EFI_ERROR_CODE 0xffffffff
#if EFI_USE_CCM && defined __GNUC__
#define MAIN_RAM __attribute__((section(".ram0")))
#elif defined __GNUC__
#define MAIN_RAM
#else
#define MAIN_RAM @ ".ram0"
#endif
#if EFI_USE_CCM && defined __GNUC__ #if EFI_USE_CCM && defined __GNUC__
#define CCM_OPTIONAL __attribute__((section(".ram4"))) #define CCM_OPTIONAL __attribute__((section(".ram4")))
#elif defined __GNUC__ #elif defined __GNUC__

View File

@ -131,7 +131,6 @@ static void canMazdaRX8(void) {
commonTxInit(CAN_MAZDA_RX_RPM_SPEED); commonTxInit(CAN_MAZDA_RX_RPM_SPEED);
#if EFI_VEHICLE_SPEED || defined(__DOXYGEN__)
float kph = getVehicleSpeed(); float kph = getVehicleSpeed();
setShortValue(&txmsg, SWAP_UINT16(getRpmE(engine) * 4), 0); setShortValue(&txmsg, SWAP_UINT16(getRpmE(engine) * 4), 0);
@ -139,7 +138,6 @@ static void canMazdaRX8(void) {
setShortValue(&txmsg, SWAP_UINT16((int )(100 * kph + 10000)), 4); setShortValue(&txmsg, SWAP_UINT16((int )(100 * kph + 10000)), 4);
setShortValue(&txmsg, 0, 6); setShortValue(&txmsg, 0, 6);
sendMessage(); sendMessage();
#endif /* EFI_VEHICLE_SPEED */
commonTxInit(CAN_MAZDA_RX_STATUS_2); commonTxInit(CAN_MAZDA_RX_STATUS_2);
txmsg.data8[0] = 0xFE; //Unknown txmsg.data8[0] = 0xFE; //Unknown
@ -152,13 +150,20 @@ static void canMazdaRX8(void) {
txmsg.data8[7] = 0x00; // Unused txmsg.data8[7] = 0x00; // Unused
commonTxInit(CAN_MAZDA_RX_STATUS_2); commonTxInit(CAN_MAZDA_RX_STATUS_2);
txmsg.data8[0] = 0x98; //temp gauge //~170 is red, ~165 last bar, 152 centre, 90 first bar, 92 second bar txmsg.data8[0] = (char)(engine->sensors.clt + 62); //temp gauge //~170 is red, ~165 last bar, 152 centre, 90 first bar, 92 second bar
txmsg.data8[1] = 0x00; // something to do with trip meter 0x10, 0x11, 0x17 increments by 0.1 miles txmsg.data8[1] = 0x00; // something to do with trip meter 0x10, 0x11, 0x17 increments by 0.1 miles
txmsg.data8[2] = 0x00; // unknown txmsg.data8[2] = 0x00; // unknown
txmsg.data8[3] = 0x00; //unknown txmsg.data8[3] = 0x00; //unknown
txmsg.data8[4] = 0x01; //Oil Pressure (not really a gauge) txmsg.data8[4] = 0x01; //Oil Pressure (not really a gauge)
txmsg.data8[5] = 0x00; //check engine light txmsg.data8[5] = 0x00; //check engine light
txmsg.data8[6] = 0x00; //Coolant, oil and battery txmsg.data8[6] = 0x00; //Coolant, oil and battery
if ((getRpmE(engine)>0) && (engine->sensors.vBatt<13)) {
setTxBit(6, 6); // battery light
}
if (engine->sensors.clt > 98) {
setTxBit(6, 1); // coolant light
}
//oil pressure warning lamp bit is 7
txmsg.data8[7] = 0x00; //unused txmsg.data8[7] = 0x00; //unused
sendMessage(); sendMessage();
} }

View File

@ -189,12 +189,37 @@ digital_input_s * initWaveAnalyzerDriver(const char *msg, brain_pin_e brainPin)
digital_input_s *hw = registeredIcus.add(); digital_input_s *hw = registeredIcus.add();
hw->widthListeners.clear(); hw->widthListeners.clear();
hw->periodListeners.clear(); hw->periodListeners.clear();
hw->started = false;
hw->brainPin = brainPin; hw->brainPin = brainPin;
hw->driver = driver; hw->driver = driver;
turnOnCapturePin(msg, brainPin); turnOnCapturePin(msg, brainPin);
return hw; return hw;
} }
void stopWaveAnalyzerDriver(const char *msg, brain_pin_e brainPin) {
if (brainPin == GPIO_UNASSIGNED) {
return;
}
unmarkPin(brainPin);
ICUDriver *driver = getInputCaptureDriver(msg, brainPin);
if (driver == NULL) {
return;
}
int regSize = registeredIcus.size;
for (int i = 0; i < regSize; i++) {
if (registeredIcus.elements[i].driver == driver) {
// removing from driver from the list of used drivers
memcpy(&registeredIcus.elements[i], &registeredIcus.elements[regSize - 1],
sizeof(digital_input_s));
registeredIcus.size--;
icuDisableNotificationsI(driver);
icuStop(driver);
return;
}
}
}
void startInputDriver(digital_input_s *hw, bool isActiveHigh) { void startInputDriver(digital_input_s *hw, bool isActiveHigh) {
hw->isActiveHigh = isActiveHigh; hw->isActiveHigh = isActiveHigh;
if (hw->isActiveHigh) { if (hw->isActiveHigh) {

View File

@ -28,6 +28,7 @@ digital_input_s *initWaveAnalyzerDriver(const char *msg, brain_pin_e brainPin);
void startInputDriver(digital_input_s *hw, bool isActiveHigh); void startInputDriver(digital_input_s *hw, bool isActiveHigh);
ICUDriver * getInputCaptureDriver(const char *msg, brain_pin_e hwPin); ICUDriver * getInputCaptureDriver(const char *msg, brain_pin_e hwPin);
icuchannel_t getInputCaptureChannel(brain_pin_e hwPin); icuchannel_t getInputCaptureChannel(brain_pin_e hwPin);
void stopWaveAnalyzerDriver(const char *msg, brain_pin_e brainPin);
#endif #endif

View File

@ -40,7 +40,8 @@
#include "svnversion.h" #include "svnversion.h"
#include "engine_configuration.h" #include "engine_configuration.h"
#include "CJ125.h" #include "CJ125.h"
#endif #include "aux_pid.h"
#endif /* EFI_PROD_CODE */
#if EFI_SPEED_DENSITY #if EFI_SPEED_DENSITY
#include "map_averaging.h" #include "map_averaging.h"
@ -230,6 +231,7 @@ void applyNewHardwareSettings(void) {
stopCanPins(); stopCanPins();
stopETBPins(); stopETBPins();
stopVSSPins(); stopVSSPins();
stopAuxPins();
if (engineConfiguration->bc.is_enabled_spi_1 != activeConfiguration.bc.is_enabled_spi_1) if (engineConfiguration->bc.is_enabled_spi_1 != activeConfiguration.bc.is_enabled_spi_1)
stopSpi(SPI_DEVICE_1); stopSpi(SPI_DEVICE_1);
@ -288,6 +290,7 @@ void applyNewHardwareSettings(void) {
startCanPins(); startCanPins();
startETBPins(); startETBPins();
startVSSPins(); startVSSPins();
startAuxPins();
adcConfigListener(engine); adcConfigListener(engine);
} }
@ -371,14 +374,17 @@ void initHardware(Logging *l) {
initTriggerDecoder(); initTriggerDecoder();
#endif #endif
bool isBoardTestMode_b;
if (boardConfiguration->boardTestModeJumperPin != GPIO_UNASSIGNED) {
mySetPadMode2("board test", boardConfiguration->boardTestModeJumperPin, mySetPadMode2("board test", boardConfiguration->boardTestModeJumperPin,
PAL_MODE_INPUT_PULLUP); PAL_MODE_INPUT_PULLUP);
bool isBoardTestMode_b = (!palReadPad(getHwPort(boardConfiguration->boardTestModeJumperPin), getHwPin(boardConfiguration->boardTestModeJumperPin))); isBoardTestMode_b = (!palReadPad(getHwPort(boardConfiguration->boardTestModeJumperPin), getHwPin(boardConfiguration->boardTestModeJumperPin)));
// we can now relese this pin, it is actually used as output sometimes // we can now relese this pin, it is actually used as output sometimes
unmarkPin(boardConfiguration->boardTestModeJumperPin); unmarkPin(boardConfiguration->boardTestModeJumperPin);
} else {
isBoardTestMode_b = false;
}
#if HAL_USE_ADC || defined(__DOXYGEN__) #if HAL_USE_ADC || defined(__DOXYGEN__)
initAdcInputs(isBoardTestMode_b); initAdcInputs(isBoardTestMode_b);

View File

@ -58,6 +58,8 @@ static void extCallback(EXTDriver *extp, expchannel_t channel) {
} }
#if EFI_HD44780_LCD || defined(__DOXYGEN__) #if EFI_HD44780_LCD || defined(__DOXYGEN__)
onJoystick(button); onJoystick(button);
#else
UNUSED(button);
#endif #endif
} }

View File

@ -41,6 +41,8 @@ static time_t GetTimeUnixSec(void) {
rtcGetTime(&RTCD1, &timespec); rtcGetTime(&RTCD1, &timespec);
rtcConvertDateTimeToStructTm(&timespec, &tim, NULL); rtcConvertDateTimeToStructTm(&timespec, &tim, NULL);
return mktime(&tim); return mktime(&tim);
#else
return (time_t)0;
#endif #endif
} }

View File

@ -93,8 +93,9 @@
*/ */
/* Includes ------------------------------------------------------------------*/ /* Includes ------------------------------------------------------------------*/
#define STM32F407xx #ifdef STM32F407xx
#define STM32F40_41xxx #define STM32F40_41xxx
#endif
#define assert_param(expr) ((void)0) #define assert_param(expr) ((void)0)
//#include "stm32f4xx_hal.h" //#include "stm32f4xx_hal.h"

View File

@ -80,8 +80,9 @@
/* Includes ------------------------------------------------------------------*/ /* Includes ------------------------------------------------------------------*/
#define STM32F407xx #ifdef STM32F407xx
#define STM32F40_41xxx #define STM32F40_41xxx
#endif
#define assert_param(expr) ((void)0) #define assert_param(expr) ((void)0)
#define HAL_FLASH_MODULE_ENABLED #define HAL_FLASH_MODULE_ENABLED

View File

@ -44,7 +44,7 @@ float getVehicleSpeed(void) {
} }
static void vsAnaWidthCallback(void) { static void vsAnaWidthCallback(void) {
engine->engineState.vssCounter++; engine->engineState.vssDebugEventCounter++;
efitick_t nowNt = getTimeNowNt(); efitick_t nowNt = getTimeNowNt();
vssDiff = nowNt - lastSignalTimeNt; vssDiff = nowNt - lastSignalTimeNt;
lastSignalTimeNt = nowNt; lastSignalTimeNt = nowNt;
@ -56,7 +56,7 @@ static void speedInfo(void) {
scheduleMsg(logger, "c=%f eventCounter=%d speed=%f", scheduleMsg(logger, "c=%f eventCounter=%d speed=%f",
engineConfiguration->vehicleSpeedCoef, engineConfiguration->vehicleSpeedCoef,
engine->engineState.vssCounter, engine->engineState.vssDebugEventCounter,
getVehicleSpeed()); getVehicleSpeed());
scheduleMsg(logger, "vss diff %d", vssDiff); scheduleMsg(logger, "vss diff %d", vssDiff);
@ -67,8 +67,7 @@ bool hasVehicleSpeedSensor() {
} }
void stopVSSPins(void) { void stopVSSPins(void) {
unmarkPin(activeConfiguration.bc.vehicleSpeedSensorInputPin); stopWaveAnalyzerDriver("VSS", activeConfiguration.bc.vehicleSpeedSensorInputPin);
// todo: remove driver from registeredIcus
} }
void startVSSPins(void) { void startVSSPins(void) {
@ -85,5 +84,10 @@ void initVehicleSpeed(Logging *l) {
vehicleSpeedInput->widthListeners.registerCallback((VoidInt) vsAnaWidthCallback, NULL); vehicleSpeedInput->widthListeners.registerCallback((VoidInt) vsAnaWidthCallback, NULL);
} }
#else /* EFI_VEHICLE_SPEED */
float getVehicleSpeed(void) {
// no VSS support
return 0;
}
#endif /* EFI_VEHICLE_SPEED */ #endif /* EFI_VEHICLE_SPEED */

View File

@ -251,5 +251,5 @@ int getRusEfiVersion(void) {
return 123; // this is here to make the compiler happy about the unused array return 123; // this is here to make the compiler happy about the unused array
if (UNUSED_CCM_SIZE[0] * 0 != 0) if (UNUSED_CCM_SIZE[0] * 0 != 0)
return 3211; // this is here to make the compiler happy about the unused array return 3211; // this is here to make the compiler happy about the unused array
return 20170501; return 20170505;
} }

View File

@ -1,5 +1,5 @@
// This file was generated by Version2Header // This file was generated by Version2Header
// Sat Apr 22 01:25:51 EEST 2017 // Sat May 06 08:17:42 EDT 2017
#ifndef VCS_VERSION #ifndef VCS_VERSION
#define VCS_VERSION "13886" #define VCS_VERSION "13989"
#endif #endif

View File

@ -764,6 +764,10 @@ fileVersion = { 20161225 }
; and may create error messages. ; and may create error messages.
; It is expected that these commands would not typically alter any ram mapped to a Constant. ; It is expected that these commands would not typically alter any ram mapped to a Constant.
;
; see TS_IO_TEST_COMMAND in firmware code
;
cmd_test_spk1 = "w\x00\x12\x00\x01" cmd_test_spk1 = "w\x00\x12\x00\x01"
cmd_test_spk2 = "w\x00\x12\x00\x02" cmd_test_spk2 = "w\x00\x12\x00\x02"
cmd_test_spk3 = "w\x00\x12\x00\x03" cmd_test_spk3 = "w\x00\x12\x00\x03"
@ -803,6 +807,7 @@ cmd_test_fuel_pump = "w\x00\x14\x00\x01"
cmd_test_radiator_fan = "w\x00\x15\x00\x01" cmd_test_radiator_fan = "w\x00\x15\x00\x01"
cmd_test_check_engine_light = "w\x00\x16\x00\x01" cmd_test_check_engine_light = "w\x00\x16\x00\x01"
cmd_test_idle_valve = "w\x00\x17\x00\x01" cmd_test_idle_valve = "w\x00\x17\x00\x01"
cmd_call_from_pit = "w\x00\x20\x34\x56"
[UserDefined] [UserDefined]
@ -1601,11 +1606,13 @@ cmd_test_idle_valve = "w\x00\x17\x00\x01"
commandButton = "Injector #8", cmd_test_inj8 commandButton = "Injector #8", cmd_test_inj8
dialog = testMisc, "Misc" dialog = testMisc, "Misc"
commandButton = "Come To Pit", cmd_call_from_pit
commandButton = "Fuel Pump", cmd_test_fuel_pump commandButton = "Fuel Pump", cmd_test_fuel_pump
commandButton = "Radiator Fan", cmd_test_radiator_fan commandButton = "Radiator Fan", cmd_test_radiator_fan
commandButton = "Check Engine", cmd_test_check_engine_light commandButton = "Check Engine", cmd_test_check_engine_light
commandButton = "Idle Air Valve", cmd_test_idle_valve commandButton = "Idle Air Valve", cmd_test_idle_valve
; bench test
dialog = ioTest, "I-O Test", border dialog = ioTest, "I-O Test", border
panel = testSpark, West panel = testSpark, West
panel = testInjectors, Center panel = testInjectors, Center

View File

@ -50,7 +50,7 @@ static void doAddAction(const char *token, action_type_e type, Void callback, vo
for (int i = 0; i< efiStrlen(token);i++) { for (int i = 0; i< efiStrlen(token);i++) {
char ch = token[i]; char ch = token[i];
if (ch != mytolower(ch)) { if (ch != mytolower(ch)) {
firmwareError(CUSTOM_ERR_6140, "lowerCase expected [%s]", token); firmwareError(CUSTOM_ERR_COMMAND_LOWER_CASE_EXPECTED, "lowerCase expected [%s]", token);
} }
} }
current->token = token; current->token = token;

View File

@ -47,6 +47,7 @@ public class AutoTest {
// todo? sleep(10); // time to reboot // todo? sleep(10); // time to reboot
testBmwE34(); testBmwE34();
testSachs(); testSachs();
testRoverV8();
testMitsu(); testMitsu();
testCamaro(); testCamaro();
testCitroenBerlingo(); testCitroenBerlingo();
@ -266,6 +267,10 @@ public class AutoTest {
assertWaveFall(msg, chart, EngineChart.INJECTOR_4, 0.493, x + 540); assertWaveFall(msg, chart, EngineChart.INJECTOR_4, 0.493, x + 540);
} }
private static void testRoverV8() {
setEngineType(10);
}
private static void testFordFiesta() { private static void testFordFiesta() {
setEngineType(4); setEngineType(4);
EngineChart chart; EngineChart chart;

View File

@ -21,3 +21,22 @@ git submodule update --init
Refresh submodules: Refresh submodules:
git submodule update --recursive --remote git submodule update --recursive --remote
=========================================
Generate diff of specific commit
git diff COMMIT^ COMMIT
(this generates diff between previous to COMMIT and COMMIT)
=========================================
https://help.github.com/articles/configuring-a-remote-for-a-fork/
git remote -v
git remote add upstream https://github.com/ChibiOS/ChibiOS.git
git remote -v
=========================================
https://help.github.com/articles/syncing-a-fork/