mirror of
https://github.com/brianshea2/meshmap.net.git
synced 2025-03-05 21:00:01 -08:00
Compare commits
3 commits
da626616b2
...
59b76c9087
Author | SHA1 | Date | |
---|---|---|---|
|
59b76c9087 | ||
|
c1243ee74f | ||
|
3e5f76a5ca |
|
@ -44,8 +44,9 @@ func handleMessage(from uint32, topic string, portNum generated.PortNum, payload
|
||||||
}
|
}
|
||||||
latitude := position.GetLatitudeI()
|
latitude := position.GetLatitudeI()
|
||||||
longitude := position.GetLongitudeI()
|
longitude := position.GetLongitudeI()
|
||||||
|
altitude := position.GetAltitude()
|
||||||
precision := position.GetPrecisionBits()
|
precision := position.GetPrecisionBits()
|
||||||
log.Printf("[msg] %v (%v) %s: (%v, %v) %v/32", from, topic, portNum, latitude, longitude, precision)
|
log.Printf("[msg] %v (%v) %s: (%v, %v, %v) %v/32", from, topic, portNum, latitude, longitude, altitude, precision)
|
||||||
if latitude == 0 && longitude == 0 {
|
if latitude == 0 && longitude == 0 {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -53,7 +54,7 @@ func handleMessage(from uint32, topic string, portNum generated.PortNum, payload
|
||||||
if Nodes[from] == nil {
|
if Nodes[from] == nil {
|
||||||
Nodes[from] = meshtastic.NewNode(topic)
|
Nodes[from] = meshtastic.NewNode(topic)
|
||||||
}
|
}
|
||||||
Nodes[from].UpdatePosition(latitude, longitude, precision)
|
Nodes[from].UpdatePosition(latitude, longitude, altitude, precision)
|
||||||
Nodes[from].UpdateSeenBy(topic)
|
Nodes[from].UpdateSeenBy(topic)
|
||||||
NodesMutex.Unlock()
|
NodesMutex.Unlock()
|
||||||
case generated.PortNum_NODEINFO_APP:
|
case generated.PortNum_NODEINFO_APP:
|
||||||
|
@ -147,12 +148,13 @@ func handleMessage(from uint32, topic string, portNum generated.PortNum, payload
|
||||||
onlineLocalNodes := mapReport.GetNumOnlineLocalNodes()
|
onlineLocalNodes := mapReport.GetNumOnlineLocalNodes()
|
||||||
latitude := mapReport.GetLatitudeI()
|
latitude := mapReport.GetLatitudeI()
|
||||||
longitude := mapReport.GetLongitudeI()
|
longitude := mapReport.GetLongitudeI()
|
||||||
|
altitude := mapReport.GetAltitude()
|
||||||
precision := mapReport.GetPositionPrecision()
|
precision := mapReport.GetPositionPrecision()
|
||||||
log.Printf(
|
log.Printf(
|
||||||
"[msg] %v (%v) %s: {\"%v\" \"%v\" %v %v %v %v %v %v %v} (%v, %v) %v/32",
|
"[msg] %v (%v) %s: {\"%v\" \"%v\" %v %v %v %v %v %v %v} (%v, %v, %v) %v/32",
|
||||||
from, topic, portNum,
|
from, topic, portNum,
|
||||||
longName, shortName, hwModel, role, fwVersion, region, modemPreset, hasDefaultCh, onlineLocalNodes,
|
longName, shortName, hwModel, role, fwVersion, region, modemPreset, hasDefaultCh, onlineLocalNodes,
|
||||||
latitude, longitude, precision,
|
latitude, longitude, altitude, precision,
|
||||||
)
|
)
|
||||||
if len(longName) == 0 {
|
if len(longName) == 0 {
|
||||||
return
|
return
|
||||||
|
@ -166,7 +168,7 @@ func handleMessage(from uint32, topic string, portNum generated.PortNum, payload
|
||||||
}
|
}
|
||||||
Nodes[from].UpdateUser(longName, shortName, hwModel, role)
|
Nodes[from].UpdateUser(longName, shortName, hwModel, role)
|
||||||
Nodes[from].UpdateMapReport(fwVersion, region, modemPreset, hasDefaultCh, onlineLocalNodes)
|
Nodes[from].UpdateMapReport(fwVersion, region, modemPreset, hasDefaultCh, onlineLocalNodes)
|
||||||
Nodes[from].UpdatePosition(latitude, longitude, precision)
|
Nodes[from].UpdatePosition(latitude, longitude, altitude, precision)
|
||||||
Nodes[from].UpdateSeenBy(topic)
|
Nodes[from].UpdateSeenBy(topic)
|
||||||
NodesMutex.Unlock()
|
NodesMutex.Unlock()
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -33,6 +33,7 @@ type Node struct {
|
||||||
// Position
|
// Position
|
||||||
Latitude int32 `json:"latitude"`
|
Latitude int32 `json:"latitude"`
|
||||||
Longitude int32 `json:"longitude"`
|
Longitude int32 `json:"longitude"`
|
||||||
|
Altitude int32 `json:"altitude,omitempty"`
|
||||||
Precision uint32 `json:"precision,omitempty"`
|
Precision uint32 `json:"precision,omitempty"`
|
||||||
// DeviceMetrics
|
// DeviceMetrics
|
||||||
BatteryLevel uint32 `json:"batteryLevel,omitempty"`
|
BatteryLevel uint32 `json:"batteryLevel,omitempty"`
|
||||||
|
@ -157,9 +158,10 @@ func (node *Node) UpdateNeighborInfo(neighborNum uint32, snr float32) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (node *Node) UpdatePosition(latitude, longitude int32, precision uint32) {
|
func (node *Node) UpdatePosition(latitude, longitude, altitude int32, precision uint32) {
|
||||||
node.Latitude = latitude
|
node.Latitude = latitude
|
||||||
node.Longitude = longitude
|
node.Longitude = longitude
|
||||||
|
node.Altitude = altitude
|
||||||
node.Precision = precision
|
node.Precision = precision
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
+++ b/protobufs/meshtastic/deviceonly.proto
|
+++ b/protobufs/meshtastic/deviceonly.proto
|
||||||
@@ -7,14 +7,12 @@ import "meshtastic/localonly.proto";
|
@@ -7,14 +7,12 @@ import "meshtastic/localonly.proto";
|
||||||
import "meshtastic/mesh.proto";
|
import "meshtastic/mesh.proto";
|
||||||
import "meshtastic/module_config.proto";
|
|
||||||
import "meshtastic/telemetry.proto";
|
import "meshtastic/telemetry.proto";
|
||||||
|
import "meshtastic/config.proto";
|
||||||
-import "nanopb.proto";
|
-import "nanopb.proto";
|
||||||
|
|
||||||
option csharp_namespace = "Meshtastic.Protobufs";
|
option csharp_namespace = "Meshtastic.Protobufs";
|
||||||
|
@ -15,7 +15,7 @@
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -191,7 +189,7 @@ message DeviceState {
|
@@ -235,7 +233,7 @@ message DeviceState {
|
||||||
/*
|
/*
|
||||||
* New lite version of NodeDB to decrease memory footprint
|
* New lite version of NodeDB to decrease memory footprint
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -219,7 +219,7 @@
|
||||||
const {
|
const {
|
||||||
longName, shortName, hwModel, role,
|
longName, shortName, hwModel, role,
|
||||||
fwVersion, region, modemPreset, hasDefaultCh, onlineLocalNodes,
|
fwVersion, region, modemPreset, hasDefaultCh, onlineLocalNodes,
|
||||||
latitude, longitude, precision,
|
latitude, longitude, altitude, precision,
|
||||||
batteryLevel, voltage, chUtil, airUtilTx, uptime,
|
batteryLevel, voltage, chUtil, airUtilTx, uptime,
|
||||||
neighbors, seenBy
|
neighbors, seenBy
|
||||||
} = node
|
} = node
|
||||||
|
@ -246,6 +246,7 @@
|
||||||
${airUtilTx ? `<tr><th>AirUtilTX</th><td>${airUtilTx.toFixed(2)}%</td></tr>` : ''}
|
${airUtilTx ? `<tr><th>AirUtilTX</th><td>${airUtilTx.toFixed(2)}%</td></tr>` : ''}
|
||||||
${uptime ? `<tr><th>Uptime</th><td>${duration(uptime)}</td></tr>` : ''}
|
${uptime ? `<tr><th>Uptime</th><td>${duration(uptime)}</td></tr>` : ''}
|
||||||
${onlineLocalNodes ? `<tr><th>Online local nodes</th><td>${onlineLocalNodes}</td></tr>` : ''}
|
${onlineLocalNodes ? `<tr><th>Online local nodes</th><td>${onlineLocalNodes}</td></tr>` : ''}
|
||||||
|
${altitude ? `<tr><th>Altitude</th><td>${altitude.toLocaleString()} m above MSL</td></tr>` : ''}
|
||||||
${precision && precisionMargins[precision-1] ?
|
${precision && precisionMargins[precision-1] ?
|
||||||
`<tr><th>Location precision</th><td>± ${precisionMargins[precision-1].toLocaleString()} m (orange circle)</td></tr>` : ''
|
`<tr><th>Location precision</th><td>± ${precisionMargins[precision-1].toLocaleString()} m (orange circle)</td></tr>` : ''
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue