fix: PullDown

This commit is contained in:
Jakob Gegeniger committed 2026-10-16 21:29:06 +02:00
1 parent 313e097a53
commit b34a3a4acd
15 files changed
+101 -108

No files matched your search

+13 -4
View File
@@ -15,7 +15,8 @@ class MqttChannel {
statTopic(cfg.StationPath + "stat"),
resetTopic(cfg.StationPath + "reset"),
serviceCommands({ // cfg-topic
serviceCommands({
// cfg-topic
{"openLock", ServiceCommands_e::SetLockOpen},
{"closeLock", ServiceCommands_e::SetLockClose},
{"mute", ServiceCommands_e::SetDisableSound},
@@ -24,11 +25,13 @@ class MqttChannel {
{"playSound:Deny", ServiceCommands_e::PlaySoundDeny},
{"playSound:Chosen", ServiceCommands_e::PlaySoundChosen},
}),
setCommands({ // cfg-topic
setCommands({
// cfg-topic
{"volume", ServiceCommands_e::SetConfigVolume},
{"promoDelay", ServiceCommands_e::SetConfigPromoDelay},
}),
gameCommands({ // set-topic
gameCommands({
// set-topic
{"gameStarted", GameModeCommands_e::GameStarted},
{"gameFinished", GameModeCommands_e::GameFinished},
{"stayLocked", GameModeCommands_e::GameNextTryLocked},
@@ -133,6 +136,9 @@ class MqttChannel {
auto code = instance.serviceCommands.at(payload);
switch (code) {
case ServiceCommands_e::SetLockOpen: {
if (instance.IoStat.GameRunning) {
break;
}
instance.IoStat.SwordLatch.moveIn();
auto tE = std::chrono::steady_clock::now() + 6s;
while (std::chrono::steady_clock::now() < tE) {
@@ -142,6 +148,9 @@ class MqttChannel {
auto currE = mon.sampleCurrent();
} break;
case ServiceCommands_e::SetLockClose: {
if (instance.IoStat.GameRunning) {
break;
}
instance.IoStat.SwordLatch.moveOut();
auto tE = std::chrono::steady_clock::now() + 6s;
while (std::chrono::steady_clock::now() < tE) {
@@ -184,7 +193,7 @@ class MqttChannel {
void sendEvent(std::string event) {
try {
auto& s = IoStat;
fmt::println("Sending Event: {}",event);
fmt::println("Sending Event: {}", event);
client.send(eventTopic, fmt::format("{}", event));
} catch (const exception& exc) {
fmt::println(stderr, "\nERROR: Unable to connect to Setup bridge: {}", exc.what());