Compare commits
3 Commits
25aa2d6cb6
...
0e842294be
| Author | SHA1 | Date | |
|---|---|---|---|
| 0e842294be | |||
| 57957740d9 | |||
| fa1b288f4d |
@@ -9,6 +9,13 @@ namespace commands
|
|||||||
esp_restart();
|
esp_restart();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const ArduinoJson::JsonDocument Commands::setBuzz(const devices_t &dev, const ArduinoJson::JsonDocument ¶ms)
|
||||||
|
{
|
||||||
|
ArduinoJson::JsonDocument response;
|
||||||
|
dev.buzzer.beep(500, NOTE_Bb);
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
// CONFIG //
|
// CONFIG //
|
||||||
// CONFIG //
|
// CONFIG //
|
||||||
const ArduinoJson::JsonDocument Commands::setConfig(const devices_t &dev, const ArduinoJson::JsonDocument ¶ms)
|
const ArduinoJson::JsonDocument Commands::setConfig(const devices_t &dev, const ArduinoJson::JsonDocument ¶ms)
|
||||||
@@ -488,7 +495,7 @@ namespace commands
|
|||||||
response["values"]["drift"] = (uint32_t)timeDiff.count();
|
response["values"]["drift"] = (uint32_t)timeDiff.count();
|
||||||
response["values"]["direction"] = "RTC is [" + std::string(direction) + "] NTP time";
|
response["values"]["direction"] = "RTC is [" + std::string(direction) + "] NTP time";
|
||||||
|
|
||||||
LOG_INFO("getTimeDrift -> RTC is [", (uint32_t)timeDiff.count(), "] sec, [", std::string(direction).c_str(), "] NTP time");
|
LOG_INFO("getTimeDrift -> RTC is [", (int32_t)timeDiff.count(), "] sec, [", std::string(direction).c_str(), "] NTP time");
|
||||||
|
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,6 +64,9 @@ namespace commands
|
|||||||
Commands() = delete;
|
Commands() = delete;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
// TEST //
|
||||||
|
static const ArduinoJson::JsonDocument setBuzz(const devices_t &dev, const ArduinoJson::JsonDocument ¶ms);
|
||||||
|
|
||||||
// CONFIG //
|
// CONFIG //
|
||||||
static const ArduinoJson::JsonDocument setConfig(const devices_t &dev, const ArduinoJson::JsonDocument ¶ms);
|
static const ArduinoJson::JsonDocument setConfig(const devices_t &dev, const ArduinoJson::JsonDocument ¶ms);
|
||||||
static const ArduinoJson::JsonDocument getConfig(const devices_t &dev, const ArduinoJson::JsonDocument ¶ms);
|
static const ArduinoJson::JsonDocument getConfig(const devices_t &dev, const ArduinoJson::JsonDocument ¶ms);
|
||||||
@@ -94,6 +97,9 @@ namespace commands
|
|||||||
};
|
};
|
||||||
|
|
||||||
static const std::map<const std::string, Command> s_commandMap = {
|
static const std::map<const std::string, Command> s_commandMap = {
|
||||||
|
|
||||||
|
{"setBuzz", Commands::setBuzz},
|
||||||
|
|
||||||
{"setConfig", Commands::setConfig},
|
{"setConfig", Commands::setConfig},
|
||||||
{"getConfig", Commands::getConfig},
|
{"getConfig", Commands::getConfig},
|
||||||
|
|
||||||
|
|||||||
@@ -144,8 +144,8 @@ void loop()
|
|||||||
buzzer.beep(250, NOTE_B);
|
buzzer.beep(250, NOTE_B);
|
||||||
led.setColor(led.COLOR_GREEN);
|
led.setColor(led.COLOR_GREEN);
|
||||||
mqtt.subscribe(conf.m_mqttSubscribe["commands"], commandsCallback);
|
mqtt.subscribe(conf.m_mqttSubscribe["commands"], commandsCallback);
|
||||||
mqtt.setOnMessageCb(onMessage);
|
//mqtt.setOnMessageCb(onMessage);
|
||||||
mqtt.setOnPublishCb(onPublish);
|
//mqtt.setOnPublishCb(onPublish);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
delay(250);
|
delay(250);
|
||||||
|
|||||||
Reference in New Issue
Block a user