fix: use explicit time <epoch> for repeater clock sync

Companion firmware (MeshCore commit 4a869163, 2025-12-30) replaces the
CLI frame timestamp with the companion node's RTC for TXT_TYPE_CLI_DATA,
so "clock sync" sets the repeater clock to the node RTC. Nodes with a
wrong RTC push repeater clocks years into the future; firmware cannot
set the clock backwards without clkreboot.

- RepeaterCommandService: translate "clock sync" to "time <phone epoch>"
  before sending, matching official meshcore-cli behavior
- repeater login dialog: send "time <epoch>" for auto clock sync after
  login (this path bypasses RepeaterCommandService)
- add unit tests for the command translation

Ref: https://github.com/zjs81/meshcore-open/issues/464
This commit is contained in:
hdhog committed 2026-09-09 22:31:11 +04:00
1 parent dbd7f2aa75
commit d791570213
3 files changed
+61 -1

No files matched your search

+5 -1
View File
@@ -7,6 +7,7 @@ import '../l10n/l10n.dart';
import '../models/contact.dart';
import '../l10n/contact_localization.dart';
import '../services/storage_service.dart';
import '../services/repeater_command_service.dart';
import '../connector/meshcore_connector.dart';
import '../connector/meshcore_protocol.dart';
import '../theme/mesh_theme.dart';
@@ -201,7 +202,10 @@ class _RepeaterLoginDialogState extends State<RepeaterLoginDialog> {
await _connector.sendFrame(
buildSendCliCommandFrame(
repeater.publicKey,
'clock sync',
normalizeRepeaterClockSyncCommand(
'clock sync',
nowSeconds: timestampSeconds,
),
timestampSeconds: timestampSeconds,
),
);