meshtastic / firmware

Meshtastic device firmware
https://meshtastic.org
GNU General Public License v3.0
3.31k stars 800 forks source link

Implement replies for all telemetry types based on variant tag #4164

Closed GUVWAF closed 2 months ago

GUVWAF commented 2 months ago

This allows nodes to request all different telemetry types based on the variant tag in the payload (closes #4120). I had to decode the payload in allocReply() to check the tag. Also created getTelemetry() methods that return true if there is valid data, which is used in sendTelemetry() and allocReply().

Tested with DeviceMetrics, and also checked that a NAK with NO_RESPONSE is sent when there's no data available. I couldn't easily test real data with Environment, AirQuality and Power, but logic is the same.

Also remove the check for ignoreRequest in allocReply(). The logic is that a module can set it to true to avoid sending the NAK (e.g. for NodeInfo). So it doesn't need to check the value, because it's always false at the beginning.