mirror of
https://github.com/liquidraver/ZephCore.git
synced 2026-10-15 08:50:15 +00:00
import / contact save fiddling
This commit is contained in:
+2
-2
@@ -385,7 +385,7 @@ config ZEPHCORE_BLE_CONN_MAX_INTERVAL
|
||||
range 6 3200
|
||||
help
|
||||
Maximum BLE connection interval in 1.25ms units.
|
||||
36 = 45ms. Matches Arduino default. Higher = lower power when idle.
|
||||
36 = 45ms. Higher = lower power when idle.
|
||||
|
||||
config ZEPHCORE_BLE_CONN_LATENCY
|
||||
int "BLE connection latency (skip events)"
|
||||
@@ -393,7 +393,7 @@ config ZEPHCORE_BLE_CONN_LATENCY
|
||||
range 0 500
|
||||
help
|
||||
Skip up to N connection events when idle to save power.
|
||||
4 = skip 4 events (effective interval up to 375ms idle).
|
||||
4 = skip 4 events (effective interval up to 225ms idle at 45ms).
|
||||
|
||||
config ZEPHCORE_BLE_CONN_TIMEOUT
|
||||
int "BLE supervision timeout (units: 10ms)"
|
||||
|
||||
@@ -276,22 +276,19 @@ void CompanionMesh::timeSyncTick()
|
||||
|
||||
void CompanionMesh::markContactsDirty(bool substantive)
|
||||
{
|
||||
int64_t deadline = _ms->getMillis() +
|
||||
(substantive ? LAZY_WRITE_DELAY_MS
|
||||
: LAZY_WRITE_LIVENESS_MS);
|
||||
int64_t now = _ms->getMillis();
|
||||
|
||||
/* Only set the timer on first dirty — don't keep pushing
|
||||
* the deadline forward or a busy mesh never flushes. */
|
||||
if (!_dirty_contacts_expiry) {
|
||||
_dirty_contacts_expiry = deadline;
|
||||
/* A substantive change restarts the short delay, as upstream: a burst
|
||||
* (a contacts import) is written once, after its last change. */
|
||||
if (substantive) {
|
||||
_dirty_contacts_expiry = now + LAZY_WRITE_DELAY_MS;
|
||||
return;
|
||||
}
|
||||
|
||||
/* ...but a substantive change must not have to sit out a liveness wait
|
||||
* that is already pending. Pulling the deadline IN cannot starve the
|
||||
* flush, only hasten it. */
|
||||
if (substantive && deadline < _dirty_contacts_expiry) {
|
||||
_dirty_contacts_expiry = deadline;
|
||||
/* A liveness change only arms the long deadline; it never moves a
|
||||
* pending one (devdocs/lld/06-companion.md). */
|
||||
if (!_dirty_contacts_expiry) {
|
||||
_dirty_contacts_expiry = now + LAZY_WRITE_LIVENESS_MS;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user