void mqtt_loop() {
mqtt_poll_mower(millis());
mqtt_connect();
// mqttClient.loop();
mqtt_publish_props();
mqtt_publish_state();
mqtt_publish_stats();
}
{"battery_voltage":28.59000015,"position":{"x":8.430000305,"y":-20.55999947,"delta":-2.880000114,"solution":0,"age":230.5,"accuracy":607400.0625,"visible_satellites":0,"visible_satellites_dgps":0,"mow_point_index":1142},"target":{"x":0,"y":0},"job":2,"sensor":0,"amps":-0.01,"map_crc":-3820500}
10:59:31.704 -> 1101949 UART rx:S,28.59,8.43,-20.56,1.32,0,2,1142,1116.86,0,0.00,0.00,607400.06,0,-0.01,0,-3820500,0.00,-1,0,0x7d
12:24:38.568 -> 5106496 UART rx:S,28.58,8.43,-20.56,1.76,0,2,1142,6217.75,0,0.00,0.00,607400.06,0,-0.01,0,-3820500,0.00,-1,0,0x89
13:10:16.052 -> 133738 UART rx:S,28.59,8.43,-20.56,-2.88,0,2,1142,279.21,0,0.00,0.00,607400.06,0,-0.01,0,-3820500,0.00,-1,0,0x84
13:10:24.929 -> 142651 UART rx:S,28.59,8.43,-20.56,-2.88,0,2,1142,288.11,0,0.00,0.00,607400.06,0,-0.01,0,-3820500,0.00,-1,0,0x83
13:10:40.113 -> 157803 UART rx:S,28.59,8.43,-20.56,-2.88,0,2,1142,303.25,0,0.00,0.00,607400.06,0,-0.01,0,-3820500,0.00,-1,0,0x7c
13:10:54.850 -> 172551 UART rx:S,28.59,8.43,-20.56,-2.88,0,2,1142,317.98,0,0.00,0.00,607400.06,0,-0.01,0,-3820500,0.00,-1,0,0x8b
void mqtt_publish_state() {
if (!mqttPendingPublishState) return;
CONSOLE.println("Before state Json");
CONSOLE.println(mower.state.toJson());
if (!mqttClient.publish(mqtt_topic("/state").c_str(), mower.state.toJson().c_str())) return;
mqttPendingPublishState = false;
}
13:35:19.043 -> Before state Json
13:35:19.043 -> Guru Meditation Error: Core 1 panic'ed (LoadProhibited). Exception was unhandled.
13:35:19.043 ->
13:35:19.043 -> Core 1 register dump:
13:35:19.043 -> PC : 0x400d6582 PS : 0x00060330 A0 : 0x800d6e07 A1 : 0x3ffcdfe0
13:35:19.043 -> A2 : 0x0000d0d0 A3 : 0x3ffce050 A4 : 0x0000ffff A5 : 0x0000ffff
13:35:19.043 -> A6 : 0x00000000 A7 : 0x3f40091a A8 : 0x0000ffff A9 : 0x3ffcdfc0
13:35:19.043 -> A10 : 0xa5a5a6a5 A11 : 0x00000100 A12 : 0x3ffdd0d0 A13 : 0x3ffce0dc
13:35:19.091 -> A14 : 0x00000000 A15 : 0x00000001 SAR : 0x00000013 EXCCAUSE: 0x0000001c
13:35:19.091 -> EXCVADDR: 0xa5a5a6af LBEG : 0x4008a871 LEND : 0x4008a881 LCOUNT : 0xfffffffc
13:39:57.438 -> UART tx:S,28.59,8.43,-20.56,-2.73,0,2,1142,317.40,0,0.00,0.00,607400.06,0,-0.01,0,-3820500,0.00,-1,0,0x78
String ArduMower::State::State::toJson() {
String result = "";
DynamicJsonDocument doc(1024);
doc["battery_voltage"] = batteryVoltage;
//doc["position"] = position.toJsonObject();
//doc["target"] = target.toJsonObject();
doc["job"] = job;
doc["sensor"] = sensor;
doc["amps"] = amps;
doc["map_crc"] = mapCrc;
serializeJson(doc, result);
return result;
}
14:17:53.683 -> Before state Json
14:17:53.683 -> {"battery_voltage":28.45999908,"job":0,"sensor":0,"amps":0,"map_crc":-3820500}