Corretto calcolo del tempo heartbeat

This commit is contained in:
2019-11-05 16:15:53 +01:00
parent 187c3ed9fc
commit 64a4b9b122
3 changed files with 21 additions and 3 deletions

View File

@@ -31,13 +31,13 @@ void mqtt_callback::message_arrived(mqtt::const_message_ptr msg) {
intMsg[mem_->comSettings.TS]);
if (!intMsg[mem_->comSettings.NODE].compare(mem_->comSettings.nodeNames["relay"])){
mem_->commonStatus.relayRunning = true;
mem_->commonStatus.relayLast = std::stod(intMsg[mem_->comSettings.TS]);
mem_->commonStatus.relayLast = fabs(mem_->commonStatus.relayLast - std::stod(intMsg[mem_->comSettings.TS]));
} else if (!intMsg[mem_->comSettings.NODE].compare(mem_->comSettings.nodeNames["follower"])) {
mem_->commonStatus.followerRunning = true;
mem_->commonStatus.followerLast = std::stod(intMsg[mem_->comSettings.TS]);
mem_->commonStatus.followerLast = fabs(mem_->commonStatus.followerLast - std::stod(intMsg[mem_->comSettings.TS]));
} else if (!intMsg[mem_->comSettings.NODE].compare(mem_->comSettings.nodeNames["recorder"])) {
mem_->commonStatus.recorderRunning = true;
mem_->commonStatus.recorderLast = std::stod(intMsg[mem_->comSettings.TS]);
mem_->commonStatus.recorderLast = fabs(mem_->commonStatus.recorderLast - std::stod(intMsg[mem_->comSettings.TS]));
} else {
log_->error("Node {} unknown", intMsg[mem_->comSettings.NODE].c_str());
}