start/stop progress

This commit is contained in:
rusefi 2020-03-23 10:32:41 -04:00
parent 165160bb40
commit 31ef10fe1c
4 changed files with 40 additions and 6 deletions

View File

@ -915,6 +915,9 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels DECLARE_
#endif // EFI_ENGINE_CONTROL
switch (engineConfiguration->debugMode) {
case DBG_START_STOP:
tsOutputChannels->debugIntField1 = engine->startStopStateToggleCounter;
break;
case DBG_AUX_TEMPERATURE:
// // 68
tsOutputChannels->debugFloatField1 = engine->sensors.auxTemp1;

View File

@ -176,6 +176,11 @@ public:
*/
efitick_t stopEngineRequestTimeNt = 0;
bool startStopState = false;
efitick_t startStopStateLastPushTime = 0;
int startStopStateToggleCounter = 0;
/**
* This counter is incremented every time user adjusts ECU parameters online (either via rusEfi console or other
* tuning software)

View File

@ -246,6 +246,20 @@ static void resetAccel(void) {
}
}
static void slowStartStopButtonCallback(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
if (CONFIG(startStopButtonPin) != GPIO_UNASSIGNED) {
#if EFI_PROD_CODE
bool startStopState = efiReadPin(CONFIG(startStopButtonPin));
if (startStopState && !engine->startStopState) {
// we are here on transition from 0 to 1
engine->startStopStateToggleCounter++;
}
engine->startStopState = startStopState;
#endif /* EFI_PROD_CODE */
}
}
static void doPeriodicSlowCallback(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
#if EFI_ENGINE_CONTROL && EFI_SHAFT_POSITION_INPUT
efiAssertVoid(CUSTOM_ERR_6661, getCurrentRemainingStack() > 64, "lowStckOnEv");
@ -253,6 +267,8 @@ static void doPeriodicSlowCallback(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
touchTimeCounter();
#endif /* EFI_PROD_CODE */
slowStartStopButtonCallback(PASS_ENGINE_PARAMETER_SIGNATURE);
/**
* Update engine RPM state if needed (check timeouts).
*/

View File

@ -255,8 +255,9 @@ void turnOnHardware(Logging *sharedLogger) {
void stopSpi(spi_device_e device) {
#if HAL_USE_SPI
if (!isSpiInitialized[device])
if (!isSpiInitialized[device]) {
return; // not turned on
}
isSpiInitialized[device] = false;
brain_pin_markUnused(getSckPin(device));
brain_pin_markUnused(getMisoPin(device));
@ -309,17 +310,21 @@ void applyNewHardwareSettings(void) {
stopAuxPins();
#endif /* EFI_AUX_PID */
if (isConfigurationChanged(is_enabled_spi_1))
if (isConfigurationChanged(is_enabled_spi_1)) {
stopSpi(SPI_DEVICE_1);
}
if (isConfigurationChanged(is_enabled_spi_2))
if (isConfigurationChanged(is_enabled_spi_2)) {
stopSpi(SPI_DEVICE_2);
}
if (isConfigurationChanged(is_enabled_spi_3))
if (isConfigurationChanged(is_enabled_spi_3)) {
stopSpi(SPI_DEVICE_3);
}
if (isConfigurationChanged(is_enabled_spi_4))
if (isConfigurationChanged(is_enabled_spi_4)) {
stopSpi(SPI_DEVICE_4);
}
#if EFI_HD44780_LCD
stopHD44780_pins();
@ -328,8 +333,13 @@ void applyNewHardwareSettings(void) {
#if EFI_BOOST_CONTROL
stopBoostPin();
#endif
if (isPinOrModeChanged(clutchUpPin, clutchUpPinMode))
if (isPinOrModeChanged(clutchUpPin, clutchUpPinMode)) {
brain_pin_markUnused(activeConfiguration.clutchUpPin);
}
if (isPinOrModeChanged(startStopButtonPin, startStopButtonMode)) {
brain_pin_markUnused(activeConfiguration.startStopButtonPin);
}
enginePins.unregisterPins();