Lua should have access to time since engine stop was requested #6609
only:redundant logging & minor guards improvement
This commit is contained in:
parent
598af73d50
commit
2b0431502a
|
@ -1077,11 +1077,11 @@ void configureRusefiLuaHooks(lua_State* lState) {
|
|||
lua_register(lState, "setAirmass", lua_setAirmass);
|
||||
#endif // EFI_ENGINE_CONTROL
|
||||
|
||||
#if EFI_SHAFT_POSITION_INPUT
|
||||
lua_register(lState, "stopEngine", [](lua_State*) {
|
||||
doScheduleStopEngine();
|
||||
return 0;
|
||||
});
|
||||
#if EFI_SHAFT_POSITION_INPUT
|
||||
lua_register(lState, "getTimeSinceTriggerEventMs", [](lua_State* l) {
|
||||
int result = engine->triggerCentral.m_lastEventTimer.getElapsedUs() / 1000;
|
||||
lua_pushnumber(l, result);
|
||||
|
|
|
@ -6,10 +6,10 @@
|
|||
#include "pch.h"
|
||||
|
||||
void doScheduleStopEngine() {
|
||||
efiPrintf("Starting doScheduleStopEngine");
|
||||
#if EFI_ENGINE_CONTROL
|
||||
#if EFI_SHAFT_POSITION_INPUT
|
||||
efiPrintf("Let's stop this engine!");
|
||||
getLimpManager()->shutdownController.stopEngine();
|
||||
#endif // EFI_ENGINE_CONTROL
|
||||
#endif // EFI_SHAFT_POSITION_INPUT
|
||||
// todo: initiate stepper motor parking
|
||||
// make sure we have stored all the info
|
||||
#if EFI_PROD_CODE
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include "start_stop.h"
|
||||
#include "ignition_controller.h"
|
||||
|
||||
#if EFI_SHAFT_POSITION_INPUT
|
||||
void initStartStopButton() {
|
||||
/* startCrankingDuration is efitimesec_t, so we need to multiply it by 1000 to get milliseconds*/
|
||||
engine->startStopState.startStopButtonDebounce.init((engineConfiguration->startCrankingDuration*1000),
|
||||
|
@ -27,7 +28,6 @@ static void onStartStopButtonToggle() {
|
|||
hwPortname(engineConfiguration->starterControlPin));
|
||||
}
|
||||
} else if (engine->rpmCalculator.isRunning()) {
|
||||
efiPrintf("Let's stop this engine!");
|
||||
doScheduleStopEngine();
|
||||
}
|
||||
}
|
||||
|
@ -95,3 +95,4 @@ void slowStartStopButtonCallback() {
|
|||
disengageStarterIfNeeded();
|
||||
}
|
||||
}
|
||||
#endif // EFI_SHAFT_POSITION_INPUT
|
||||
|
|
Loading…
Reference in New Issue