Skip to content

Commit 5437a0c

Browse files
committed
Fix some compile issues
1 parent f307bd7 commit 5437a0c

File tree

3 files changed

+8
-22
lines changed

3 files changed

+8
-22
lines changed

src/EasyMqtt.h

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,10 @@ class EasyMqtt : public MqttEntry {
100100
#endif
101101
deviceId = String(ESP.getChipId());
102102

103-
setInterval(10);
103+
setInterval(60);
104+
setForce(10);
104105

105-
get("system").setInterval(30);
106+
get("system").setInterval(300);
106107
get("system")["deviceId"] << [this]() {
107108
return deviceId;
108109
};
@@ -116,15 +117,15 @@ class EasyMqtt : public MqttEntry {
116117
// Setup wifi diag
117118
get("system")["wifi"]["rssi"] << []() {
118119
return String(WiFi.RSSI());
119-
}
120+
};
120121
get("system")["wifi"]["quality"] << []() {
121122
int rssi = WiFi.RSSI();
122123
int quality = 0;
123124
if(rssi <= -100) {
124125
} else if (rssi >= -50) {
125-
rssi = 100;
126+
quality = 100;
126127
} else {
127-
quality = 2 * (RSSI + 100);
128+
quality = 2 * (rssi + 100);
128129
}
129130
return String(quality);
130131
};
@@ -156,19 +157,6 @@ class EasyMqtt : public MqttEntry {
156157
debug(key + " = " + value);
157158
}
158159

159-
void debug(String msg) {
160-
#ifdef DEBUG
161-
Serial.println(msg);
162-
#endif
163-
if(mqttClient.connected()) {
164-
get("system/debug").publish(msg);
165-
}
166-
}
167-
168-
void debug(String key, String value) {
169-
debug(key + " = " + value);
170-
}
171-
172160
String getDeviceId() {
173161
return deviceId;
174162
}

src/MqttEntry.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,6 @@ class MqttEntry {
3939

4040
protected:
4141
MqttEntry(const char* name, PubSubClient& mqttClient) {
42-
interval = 5;
43-
forceUpdate = 10;
4442
client = &mqttClient;
4543
setName(name);
4644
}
@@ -53,7 +51,7 @@ class MqttEntry {
5351
}
5452
child = child->next;
5553
}
56-
return addChild(new MqttEntry(name, client));
54+
return addChild(new MqttEntry(name, *client));
5755
}
5856

5957
MqttEntry *getRoot() {

src/WebPortal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ class WebPortal {
102102
}
103103

104104
void handleRest() {
105-
MqttEntry* entry = &mqtt->get(webServer->uri().substring(6));
105+
MqttEntry* entry = &mqtt->get(webServer->uri().substring(6).c_str());
106106
if(webServer->method() == HTTP_GET && entry->isIn()) {
107107
webServer->send(200, "text/plain", entry->getValue());
108108
} else if(webServer->method() == HTTP_POST && entry->isOut()) {

0 commit comments

Comments
 (0)