mirror of
https://github.com/zjs81/meshcore-open.git
synced 2026-07-03 15:30:57 +10:00
Merge branch 'dev' of https://github.com/zjs81/meshcore-open into dev
This commit is contained in:
@@ -2207,6 +2207,7 @@ class MeshCoreConnector extends ChangeNotifier {
|
||||
return;
|
||||
}
|
||||
_bleInitialSyncStarted = true;
|
||||
_pendingInitialContactsSync = true;
|
||||
|
||||
await _requestDeviceInfo();
|
||||
_startBatteryPolling();
|
||||
@@ -4184,7 +4185,9 @@ class MeshCoreConnector extends ChangeNotifier {
|
||||
if (_contacts.isEmpty) return 0;
|
||||
var latest = 0;
|
||||
for (final contact in _contacts) {
|
||||
final seconds = contact.lastSeen.millisecondsSinceEpoch ~/ 1000;
|
||||
// prefer lastmod per spec, fallback to lastseen
|
||||
final source = contact.lastModified ?? contact.lastSeen;
|
||||
final seconds = source.millisecondsSinceEpoch ~/ 1000;
|
||||
if (seconds > latest) {
|
||||
latest = seconds;
|
||||
}
|
||||
|
||||
@@ -735,10 +735,15 @@ Uint8List buildUpdateContactPathFrame(
|
||||
writer.writeInt32LE((longitude * 1e6).round());
|
||||
}
|
||||
|
||||
if (lastModified != null) {
|
||||
// Last modified
|
||||
final lastModifiedTimestamp = lastModified.millisecondsSinceEpoch ~/ 1000;
|
||||
writer.writeUInt32LE(lastModifiedTimestamp);
|
||||
final hasLocation = lat != null && lon != null;
|
||||
if (hasLocation || lastModified != null) {
|
||||
writer.writeInt32LE(hasLocation ? (lat * 1e6).round() : 0);
|
||||
writer.writeInt32LE(hasLocation ? (lon * 1e6).round() : 0);
|
||||
if (lastModified != null) {
|
||||
// Last modified
|
||||
final lastModifiedTimestamp = lastModified.millisecondsSinceEpoch ~/ 1000;
|
||||
writer.writeUInt32LE(lastModifiedTimestamp);
|
||||
}
|
||||
}
|
||||
|
||||
return writer.toBytes();
|
||||
|
||||
Reference in New Issue
Block a user