Compare commits
1 Commits
15257ae6f2
...
debug2
| Author | SHA1 | Date | |
|---|---|---|---|
| 84449e5235 |
@@ -794,24 +794,6 @@ bool parsePosQuery(const String& line) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Answers `CFG?` with speed and acceleration for every gauge.
|
||||
// Emits one `CFG <id> <maxSpeed> <accel>` line per gauge, then replies `OK`.
|
||||
bool parseCfgQuery(const String& line) {
|
||||
if (line == "CFG?") {
|
||||
for (uint8_t i = 0; i < GAUGE_COUNT; i++) {
|
||||
CMD_PORT.print("CFG ");
|
||||
CMD_PORT.print(i);
|
||||
CMD_PORT.print(' ');
|
||||
CMD_PORT.print((int)gauges[i].maxSpeed);
|
||||
CMD_PORT.print(' ');
|
||||
CMD_PORT.println((int)gauges[i].accel);
|
||||
}
|
||||
sendReply("OK");
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Answers the mandatory life question: are you there?
|
||||
// Reply: `PONG`.
|
||||
bool parsePing(const String& line) {
|
||||
@@ -1076,7 +1058,6 @@ void processLine(const String& line) {
|
||||
if (parseHome(line)) return;
|
||||
if (parseSweep(line)) return;
|
||||
if (parsePosQuery(line)) return;
|
||||
if (parseCfgQuery(line)) return;
|
||||
if (parseLedQuery(line)) return;
|
||||
if (parseLed(line)) return;
|
||||
if (parseBlink(line)) return;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
15
gauge.py
15
gauge.py
@@ -930,19 +930,6 @@ _last_discovery_ms = 0
|
||||
_DISCOVERY_INTERVAL_MS = 350
|
||||
|
||||
|
||||
def _compact_discovery_payload(payload):
|
||||
"""Trim optional HA discovery fields when RAM is tight."""
|
||||
compact = dict(payload)
|
||||
|
||||
# Light entities are the largest payloads because they repeat effect metadata.
|
||||
# Keep core functionality, but omit optional effect declarations to reduce heap use.
|
||||
if compact.get("schema") == "json":
|
||||
compact.pop("effect", None)
|
||||
compact.pop("effect_list", None)
|
||||
|
||||
return compact
|
||||
|
||||
|
||||
def check_mqtt():
|
||||
global client_ref, _mqtt_connected, _last_mqtt_check
|
||||
now = utime.ticks_ms()
|
||||
@@ -997,7 +984,7 @@ def check_mqtt():
|
||||
|
||||
def _publish_discovery_entity(client, topic, payload, log_msg):
|
||||
gc.collect()
|
||||
client.publish(topic, ujson.dumps(_compact_discovery_payload(payload)), retain=True)
|
||||
client.publish(topic, ujson.dumps(payload), retain=True)
|
||||
info(log_msg)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user