making ACR quicker

only:proteus_f7
This commit is contained in:
rusefillc 2023-11-13 17:23:32 -05:00
parent 04c4623fd4
commit e2c2980335
4 changed files with 11 additions and 3 deletions

View File

@ -13,13 +13,15 @@
#if EFI_HD_ACR #if EFI_HD_ACR
static bool getAcrState() { static bool getAcrState() {
bool engineMovedRecently = getTriggerCentral()->engineMovedRecently();
engine->engineState.acrEngineMovedRecently = engineMovedRecently;
auto currentPhase = getTriggerCentral()->getCurrentEnginePhase(getTimeNowNt()); auto currentPhase = getTriggerCentral()->getCurrentEnginePhase(getTimeNowNt());
if (!currentPhase) { if (!currentPhase) {
return false; return engineMovedRecently;
} }
// Turn off the valve if the engine isn't moving - no sense wasting power on a stopped engine // Turn off the valve if the engine isn't moving - no sense wasting power on a stopped engine
if (!getTriggerCentral()->engineMovedRecently()) { if (!engineMovedRecently) {
return false; return false;
} }
@ -58,6 +60,10 @@ void HarleyAcr::onSlowCallback() {
m_active = acrState; m_active = acrState;
} }
void HarleyAcr::updateAcr() {
onSlowCallback();
}
bool HarleyAcr::isActive() const { bool HarleyAcr::isActive() const {
return m_active; return m_active;
} }

View File

@ -2,6 +2,7 @@
class HarleyAcr : public EngineModule { class HarleyAcr : public EngineModule {
public: public:
void updateAcr();
void onSlowCallback() override; void onSlowCallback() override;
bool isActive() const; bool isActive() const;

View File

@ -40,6 +40,7 @@ struct_no_prefix engine_state_s
int8_t startStopState int8_t startStopState
bit startStopPhysicalState bit startStopPhysicalState
bit acrStateDup bit acrStateDup
bit acrEngineMovedRecently
uint32_t startStopStateToggleCounter uint32_t startStopStateToggleCounter
float egtValue1 float egtValue1

View File

@ -766,7 +766,7 @@ void TriggerCentral::handleShaftSignal(trigger_event_e signal, efitick_t timesta
if (firstEventInAWhile) { if (firstEventInAWhile) {
#if EFI_HD_ACR #if EFI_HD_ACR
// let's open that valve on first sign of movement // let's open that valve on first sign of movement
engine->module<HarleyAcr>()->onSlowCallback(); engine->module<HarleyAcr>()->updateAcr();
#endif // EFI_HD_ACR #endif // EFI_HD_ACR
} }