Browse Source

move to the system module

sensors
Max Prokhorov 5 years ago
parent
commit
385d7360a7
2 changed files with 11 additions and 3 deletions
  1. +1
    -3
      code/espurna/mqtt.ino
  2. +10
    -0
      code/espurna/system.ino

+ 1
- 3
code/espurna/mqtt.ino View File

@ -316,9 +316,7 @@ unsigned long _mqttNextMessageId() {
#if WEB_SUPPORT #if WEB_SUPPORT
bool _mqttWebSocketOnReceive(const char * key, JsonVariant& value) { bool _mqttWebSocketOnReceive(const char * key, JsonVariant& value) {
if (strncmp(key, "mqtt", 3) == 0) return true;
if (strncmp(key, "hb", 2) == 0) return true;
return false;
return (strncmp(key, "mqtt", 3) == 0);
} }
void _mqttWebSocketOnSend(JsonObject& root) { void _mqttWebSocketOnSend(JsonObject& root) {


+ 10
- 0
code/espurna/system.ino View File

@ -86,6 +86,12 @@ void _systemSetupHeartbeat() {
_heartbeat_interval = getSetting("hbInterval", HEARTBEAT_INTERVAL).toInt(); _heartbeat_interval = getSetting("hbInterval", HEARTBEAT_INTERVAL).toInt();
} }
#if WEB_SUPPORT
bool _systemWebSocketOnReceive(const char * key, JsonVariant& value) {
return (strncmp(key, "hb", 2) == 0);
}
#endif
void systemLoop() { void systemLoop() {
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
@ -182,6 +188,10 @@ void systemSetup() {
systemCheck(false); systemCheck(false);
#endif #endif
#if WEB_SUPPORT
wsOnReceiveRegister(_systemWebSocketOnReceive);
#endif
// Init device-specific hardware // Init device-specific hardware
_systemSetupSpecificHardware(); _systemSetupSpecificHardware();


Loading…
Cancel
Save