delayedShutoffRequested (#3881)
This commit is contained in:
parent
e98ab8433e
commit
2595decb58
|
@ -12,11 +12,9 @@ void MainRelayController::onSlowCallback() {
|
||||||
m_lastIgnitionTime.reset();
|
m_lastIgnitionTime.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
delayedShutoffRequested = engine->module<MainRelayController>()->needsDelayedShutoff();
|
|
||||||
|
|
||||||
// Query whether any engine modules want to keep the lights on
|
// Query whether any engine modules want to keep the lights on
|
||||||
// todo: fix this amazing C++ lambda magic
|
delayedShutoffRequested = engine->engineModules.aggregate([](auto& m, bool prev) { return m.needsDelayedShutoff() | prev; }, false);
|
||||||
// delayedShutoffRequested = engine->engineModules.aggregate([](auto& m, bool prev) { return m->needsDelayedShutoff() | prev; }, false);
|
|
||||||
// TODO: delayed shutoff timeout?
|
// TODO: delayed shutoff timeout?
|
||||||
|
|
||||||
mainRelayState = isBenchTest | hasIgnitionVoltage | delayedShutoffRequested;
|
mainRelayState = isBenchTest | hasIgnitionVoltage | delayedShutoffRequested;
|
||||||
|
|
|
@ -159,6 +159,11 @@ public:
|
||||||
f(*me);
|
f(*me);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<typename return_t, typename func_t>
|
||||||
|
auto aggregate(func_t const& accumulator, return_t seed) {
|
||||||
|
return accumulator(*me, seed);
|
||||||
|
}
|
||||||
|
|
||||||
template<typename has_t>
|
template<typename has_t>
|
||||||
static constexpr bool has() {
|
static constexpr bool has() {
|
||||||
return std::is_same_v<has_t, base_t>;
|
return std::is_same_v<has_t, base_t>;
|
||||||
|
|
Loading…
Reference in New Issue