Skip to content

fix(lora): update LoRa preset settings to reflect accurate BW, SF, and CR values; remove frequency from display - #191

Merged
ITblacksheep merged 1 commit into
masterfrom
bug-189_incorrect_lora_settings_used_in_calculations
Oct 11, 2026
Merged

ITblacksheep merged 1 commit into
masterfrom
bug-189_incorrect_lora_settings_used_in_calculations

Conversation

@Jeymz

@Jeymz Jeymz commented Oct 10, 2026

Copy link
Copy Markdown
Contributor

Summary

fixes #189

The Relay Airtime Share caption assumed SF 8 and displayed a frequency that has no effect on the calculation.

  • Default LoRa preset is now BW 62.5 kHz / SF 7 / CR 4/5 (was SF 8). This matches the US preset already used in public/home.js.
  • The "Assumed LoRa preset" caption now shows BW, SF, CR and preamble only. The frequency is no longer displayed.

Changes

  • cmd/server/relay_airtime_share.go: defaultLoRaPreset() uses SF 7 and has no default frequency. Comments updated.
  • cmd/server/config.go: doc comment for AnalyticsConfig.LoRaPreset updated.
  • config.example.json: loraPreset now has "sf": 7 and no freq. The _comment_ is updated.
  • public/analytics.js: removed the frequency from the caption in renderRelayAirtimeDumbbell. The function is also exposed on window for testing, like the other _analytics* exports.

Compatibility

  • The freq config field is still accepted, and preset.freq_hz is still returned by the API. Nothing is removed. Dropping it from the API would be a breaking change, so it can be deprecated in a later release.
  • Deployments that copied the old config.example.json have "sf": 8 set explicitly. Their display and shares will not change until they edit analytics.loraPreset.sf. This is worth a release-notes line.

Effect on results

SF changes symbol time (SF 7 is about half of SF 8). The preamble is 32 symbols for both, so it is unchanged. Shares are normalized, so percentages shift slightly. For example, the ADVERT/ACK test case moves from 83.48% / 16.52% to 83.88% / 16.12%.

Tests

  • relay_airtime_share_test.go: the hand-computed ToA shares and the derivation comment are redone for SF 7. The preset response check no longer requires a non-zero frequency.
  • tests/unit/test-frontend-helpers.js: new regression test that the caption shows BW 62.5 kHz, SF 7 and CR 4/5 and never contains MHz.

Results:

  • cd cmd/server && go test ./...: pass
  • cd internal/lora && go test ./...: pass
  • node tests/unit/test-frontend-helpers.js: 728 passed, 0 failed

Not yet done: browser validation of the Analytics page (AGENTS.md rule 2).

Performance

No hot-path changes. This is a default value change plus the removal of one string from a caption.

Follow-ups (not in this PR)

  • Derive the preset from observer radio data instead of a global config default.
  • Deprecate freq / freq_hz in the API.

@Jeymz Jeymz added the type:bug Work item type label Oct 10, 2026
@Jeymz Jeymz self-assigned this Oct 10, 2026
@ITblacksheep
ITblacksheep merged commit 26019e3 into master Oct 11, 2026
9 checks passed
ITblacksheep pushed a commit that referenced this pull request Oct 11, 2026
@diffwireauto
diffwireauto deleted the bug-189_incorrect_lora_settings_used_in_calculations branch October 12, 2026 06:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type:bug Work item type

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Relay Airtime Share on Analytics Tab has incorrect LoRa settings used for calculations

2 participants