positions now sent using the new API

1.2-legacy
Kevin Hester 2020-12-05 08:46:19 +08:00
rodzic 9b24cc6dd6
commit f1179bd3ea
3 zmienionych plików z 13 dodań i 15 usunięć

Wyświetl plik

@ -8,13 +8,14 @@ For app cleanup:
* require a recent python api to talk to these new device loads
* on android for received positions handle either old or new positions
* on android side send old or new positions as needed
* fix position sending to use new plugin
* DONE fix position sending to use new plugin
* Add SinglePortNumPlugin - as the new most useful baseclass
* move positions into regular data packets (use new app framework)
* DONE move positions into regular data packets (use new app framework)
* move user info into regular data packets (use new app framework)
* test that positions, text messages and user info still work
* test that position, text messages and user info work properly with new android app and old device code
* call the plugin setup functions
* fix the RTC drift bug
For high speed/lots of devices/short range tasks:

2
proto

@ -1 +1 @@
Subproject commit 8b24fbab195ca76932e70456750cd0172d47db79
Subproject commit be48f1cbef1f00a4dbe67c81780dc53916ba5335

Wyświetl plik

@ -284,10 +284,10 @@ void MeshService::sendNetworkPing(NodeNum dest, bool wantReplies)
int MeshService::onGPSChanged(const meshtastic::GPSStatus *unused)
{
// Update our local node info with our position (even if we don't decide to update anyone else)
MeshPacket *p = router->allocForSending();
p->decoded.which_payload = SubPacket_position_tag;
Position &pos = p->decoded.position;
Position pos;
memset(&pos, 0, sizeof(pos));
if (gps->hasLock()) {
if (gps->altitude != 0)
@ -304,20 +304,17 @@ int MeshService::onGPSChanged(const meshtastic::GPSStatus *unused)
// DEBUG_MSG("got gps notify time=%u, lat=%d, bat=%d\n", pos.latitude_i, pos.time, pos.battery_level);
// Update our current position in the local DB
nodeDB.updatePosition(nodeDB.getNodeNum(), pos);
// We limit our GPS broadcasts to a max rate
static uint32_t lastGpsSend;
uint32_t now = millis();
if (lastGpsSend == 0 || now - lastGpsSend > getPref_position_broadcast_secs() * 1000) {
lastGpsSend = now;
DEBUG_MSG("Sending position to mesh\n");
sendToMesh(p);
} else {
// We don't need to send this packet to anyone else, but it still serves as a nice uniform way to update our local state
nodeDB.updateFrom(*p);
releaseToPool(p);
}
DEBUG_MSG("Sending position to mesh (not requesting replies)\n");
positionPlugin.sendOurPosition();
}
return 0;
}