kivancsikert / ugly-duckling

Firmware for FarmHub devices
0 stars 0 forks source link

Telemetry task always misses deadline #141

Open lptr opened 5 months ago

lptr commented 5 months ago

There are logs about telemetry missing the beat by 58 seconds always:

[-] 0.30.14-8-g63a8dad6-dirty, WIFI: no shield, uptime: 0.4 s, RTC: OK, heap: 275.21 kB, CPU: 160 MHzTask 'console' missed deadline by 2035 ms 
[-] 0.30.14-8-g63a8dad6-dirty, WIFI: disconnecTask 'console' missed deadline by 201 ms
[/] 0.30.14-8-g63a8dad6-dirty, WIFI: 10.180.1.40, uptime: 65.4 s, RTC: OK, heap: 170.10 kB, CPU: 160 MHz, battery: 4.00 VTask 'telemetry' missed deadline by 58009 ms
  65.449 [telemetry/0] I: MQTT: Queuing topic 'devices/ugly-duckling/cucumbers/telemetry' (qos = 0): {
  "uptime": 65448,
  "battery": {
    "voltage": 3.995820522
  },
  "memory": {
    "free-heap": 173028
  }
}
  65.451 [telemetry/0] V: Collecting telemetry for peripheral: flow-control-a
  65.451 [telemetry/0] V: Publishing telemetry for peripheral: flow-control-a
  65.452 [telemetry/0] I: MQTT: Queuing topic 'devices/ugly-duckling/cucumbers/peripherals/flow-control/flow-control-a/telemetry' (qos = 0): {
  "state": 0,
  "volume": 0,
  "flowRate": 0
}
  65.453 [telemetry/0] V: Published telemetry for peripheral: flow-control-a
  65.453 [telemetry/0] V: Collecting telemetry for peripheral: soil-moisture
  65.454 [telemetry/0] V: Soil moisture value: 245
  65.455 [telemetry/0] V: Publishing telemetry for peripheral: soil-moisture
  65.456 [telemetry/0] I: MQTT: Queuing topic 'devices/ugly-duckling/cucumbers/peripherals/environment/soil-moisture/telemetry' (qos = 0): {
  "moisture": 144.9790795
}
  65.457 [telemetry/0] V: Published telemetry for peripheral: soil-moisture
[-] 0.30.14-8-g63a8dad6-dirty, WIFI: 10.180.1.40, uptime: 65.5 s, RTC: OK, heap: 167.82 kB, CPU: 160 MHz, battery: 4.00 VTask 'console' missed deadline by 17 ms
  65.691 [mqtt/0] I: MQTT: Published to 'devices/ugly-duckling/cucumbers/telemetry' (size: 80)
  65.696 [mqtt/0] I: MQTT: Published to 'devices/ugly-duckling/cucumbers/peripherals/flow-control/flow-control-a/telemetry' (size: 35)
  65.701 [mqtt/1] I: MQTT: Published to 'devices/ugly-duckling/cucumbers/peripherals/environment/soil-moisture/telemetry' (size: 24)
[\] 0.30.14-8-g63a8dad6-dirty, WIFI: 10.180.1.40, uptime: 124.4 s, RTC: OK, heap: 170.08 kB, CPU: 160 MHz, battery: 3.96 VTask 'telemetry' missed deadline by 58009 ms

The log comes from this line:

https://github.com/kivancsikert/ugly-duckling/blob/63a8dad61618d421a224dbc17a357651acec519a/src/kernel/Task.hpp#L117-L118

Do we have a problem with how we calculate ticks to wait?