fix(mqtt): publishSession nicht bei GRATIS-only Burst (lastBurstSec == 0)
This commit is contained in:
parent
d0d4666cf7
commit
ff67b07144
10
src/main.cpp
10
src/main.cpp
|
|
@ -35,12 +35,12 @@ void loop() {
|
|||
wifiConnector.loop();
|
||||
mqttClient.loop();
|
||||
|
||||
// MQTT: Session-Publish nach jedem abgeschlossenen Burst
|
||||
// MQTT: Session-Publish nur wenn Netto-Zeit vorhanden (kein GRATIS-only Burst)
|
||||
if (laserTracker.consumeBurstEnd()) {
|
||||
mqttClient.publishSession(
|
||||
laserTracker.getLastBurstSeconds(),
|
||||
settings.get().gratisSeconds
|
||||
);
|
||||
int lastBurst = laserTracker.getLastBurstSeconds();
|
||||
if (lastBurst > 0) {
|
||||
mqttClient.publishSession(lastBurst, settings.get().gratisSeconds);
|
||||
}
|
||||
}
|
||||
|
||||
// Display mit aktuellen Werten aktualisieren
|
||||
|
|
|
|||
|
|
@ -83,12 +83,13 @@ void loop() {
|
|||
|
||||
// MQTT: Session-Publish nach Burst-Ende
|
||||
if (laserTracker.consumeBurstEnd()) {
|
||||
LOG_I("TEST-MQTT", "BurstEnd erkannt -> publishSession (lastBurst=%ds)",
|
||||
laserTracker.getLastBurstSeconds());
|
||||
mqttClient.publishSession(
|
||||
laserTracker.getLastBurstSeconds(),
|
||||
settings.get().gratisSeconds
|
||||
);
|
||||
int lastBurst = laserTracker.getLastBurstSeconds();
|
||||
if (lastBurst > 0) {
|
||||
LOG_I("TEST-MQTT", "BurstEnd erkannt -> publishSession (lastBurst=%ds)", lastBurst);
|
||||
mqttClient.publishSession(lastBurst, settings.get().gratisSeconds);
|
||||
} else {
|
||||
LOG_I("TEST-MQTT", "BurstEnd erkannt, aber nur Gratiszeit -> kein Publish");
|
||||
}
|
||||
}
|
||||
|
||||
// Display
|
||||
|
|
|
|||
|
|
@ -75,12 +75,12 @@ void loop() {
|
|||
wifiConnector.loop();
|
||||
mqttClient.loop();
|
||||
|
||||
// MQTT: Session-Publish nach Burst-Ende
|
||||
// MQTT: Session-Publish nur wenn Netto-Zeit vorhanden (kein GRATIS-only Burst)
|
||||
if (laserTracker.consumeBurstEnd()) {
|
||||
mqttClient.publishSession(
|
||||
laserTracker.getLastBurstSeconds(),
|
||||
settings.get().gratisSeconds
|
||||
);
|
||||
int lastBurst = laserTracker.getLastBurstSeconds();
|
||||
if (lastBurst > 0) {
|
||||
mqttClient.publishSession(lastBurst, settings.get().gratisSeconds);
|
||||
}
|
||||
}
|
||||
|
||||
// Display
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user