Compare commits

..

No commits in common. "755b8403a376180921c301a9e96dbc791aae98df" and "7a8a2ce030e89f5efddaa319a06a3fd7b35a12d5" have entirely different histories.

2 changed files with 10 additions and 15 deletions

View file

@ -30,9 +30,12 @@ Meshtastic has [made a change to their MQTT server](https://meshtastic.org/blog/
The most accurate resolution that conforms to this specification is 364 meters/1194 feet. The most accurate resolution that conforms to this specification is 364 meters/1194 feet.
Additionally, only the default [LoRa region](https://meshtastic.org/docs/configuration/radio/lora/#region)-based root topics (and all subtopics) are now monitored.
#### To enable MQTT reporting #### To enable MQTT reporting
- Enable the MQTT module, using all default settings, possibly with a custom root topic - Enable the MQTT module, using all default settings, possibly with a custom root topic
- View nodes around your area on the map to find MQTT topics being used - View nodes around your area on the map to find MQTT topics being used
- Only the official [LoRa region](https://meshtastic.org/docs/configuration/radio/lora/#region)-based root topics (and all subtopics) are monitored
- Configure your node to connect to wifi or otherwise connect to the internet - Configure your node to connect to wifi or otherwise connect to the internet
- Enable MQTT uplink on your primary channel - Enable MQTT uplink on your primary channel
- It is not necessary, and not recommended unless you know what you're doing, to enable MQTT downlink - It is not necessary, and not recommended unless you know what you're doing, to enable MQTT downlink

View file

@ -12,14 +12,6 @@ const (
NeighborLimit = 100 NeighborLimit = 100
) )
func cleanFloat(f float32) float32 {
if f != f {
// IEEE 754 says that only NaNs satisfy f != f
return 0
}
return f
}
type NeighborInfo struct { type NeighborInfo struct {
Snr float32 `json:"snr,omitempty"` Snr float32 `json:"snr,omitempty"`
Updated int64 `json:"updated"` Updated int64 `json:"updated"`
@ -156,17 +148,17 @@ func (node *Node) Prune(seenByTtl, neighborTtl, metricsTtl, mapReportTtl int64)
func (node *Node) UpdateDeviceMetrics(batteryLevel uint32, voltage, chUtil, airUtilTx float32, uptime uint32) { func (node *Node) UpdateDeviceMetrics(batteryLevel uint32, voltage, chUtil, airUtilTx float32, uptime uint32) {
node.BatteryLevel = batteryLevel node.BatteryLevel = batteryLevel
node.Voltage = cleanFloat(voltage) node.Voltage = voltage
node.ChUtil = cleanFloat(chUtil) node.ChUtil = chUtil
node.AirUtilTx = cleanFloat(airUtilTx) node.AirUtilTx = airUtilTx
node.Uptime = uptime node.Uptime = uptime
node.LastDeviceMetrics = time.Now().Unix() node.LastDeviceMetrics = time.Now().Unix()
} }
func (node *Node) UpdateEnvironmentMetrics(temperature, relativeHumidity, barometricPressure float32) { func (node *Node) UpdateEnvironmentMetrics(temperature, relativeHumidity, barometricPressure float32) {
node.Temperature = cleanFloat(temperature) node.Temperature = temperature
node.RelativeHumidity = cleanFloat(relativeHumidity) node.RelativeHumidity = relativeHumidity
node.BarometricPressure = cleanFloat(barometricPressure) node.BarometricPressure = barometricPressure
node.LastEnvironmentMetrics = time.Now().Unix() node.LastEnvironmentMetrics = time.Now().Unix()
} }
@ -184,7 +176,7 @@ func (node *Node) UpdateNeighborInfo(neighborNum uint32, snr float32) {
node.Neighbors = make(map[uint32]*NeighborInfo) node.Neighbors = make(map[uint32]*NeighborInfo)
} }
node.Neighbors[neighborNum] = &NeighborInfo{ node.Neighbors[neighborNum] = &NeighborInfo{
Snr: cleanFloat(snr), Snr: snr,
Updated: time.Now().Unix(), Updated: time.Now().Unix(),
} }
} }