Same as NodeDB position_broadcast_secs bug but different (#1645)

* intervalMs
This commit is contained in:
Ben Meadors 2022-08-24 17:29:09 -05:00 committed by GitHub
parent e7831f13c5
commit 9a03b2e49d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -129,9 +129,8 @@ int32_t PositionModule::runOnce()
// We limit our GPS broadcasts to a max rate // We limit our GPS broadcasts to a max rate
uint32_t now = millis(); uint32_t now = millis();
if (lastGpsSend == 0 || now - lastGpsSend >= config.position.position_broadcast_secs uint32_t intervalMs = config.position.position_broadcast_secs > 0 ? config.position.position_broadcast_secs * 1000 : default_broadcast_interval_secs * 1000;
? config.position.position_broadcast_secs if (lastGpsSend == 0 || (now - lastGpsSend) >= intervalMs) {
: default_broadcast_interval_secs * 1000) {
// Only send packets if the channel is less than 40% utilized. // Only send packets if the channel is less than 40% utilized.
if (airTime->channelUtilizationPercent() < 40) { if (airTime->channelUtilizationPercent() < 40) {