Skip to content

fix(config): add RegionCode values 33-37 + fix ITU2_2M label (#3927)#3928

Merged
Yeraze merged 1 commit into
mainfrom
fix/3927-region-codes-33-37
Jul 5, 2026
Merged

fix(config): add RegionCode values 33-37 + fix ITU2_2M label (#3927)#3928
Yeraze merged 1 commit into
mainfrom
fix/3927-region-codes-33-37

Conversation

@Yeraze

@Yeraze Yeraze commented Jul 5, 2026

Copy link
Copy Markdown
Owner

Summary

The upstream RegionCode enum (meshtastic/protobufs config.proto) now goes up to 37, but three parallel region lists in MeshMonitor had drifted behind. Devices reporting/configured to a newer region showed no label, weren't selectable in the dropdown, and got no calculated LoRa frequency. This brings all three lists current and fixes an existing mislabel spotted while cross-referencing.

Fixes #3927.

Changes

  • REGION_OPTIONS (src/components/configuration/constants.ts) — the region dropdown. Was stopping at 32; adds 33–37 (ITU3_2M, ITU1_70CM, ITU2_70CM, ITU3_70CM, ITU2_125CM) and corrects value 28 from the non-upstream ITU23_2M to the upstream name ITU2_2M.
  • regionFrequencyBounds (src/utils/loraFrequency.ts) — a parallel list with the same drift. Adds 33–37 with freqStart/freqEnd taken from firmware RadioInterface.cpp, and fixes the value-28 comment.
  • EnumMappings.RegionCode (src/server/services/deviceBackupService.ts) — the backup export name map was even further behind (stopped at 26), so device backups of anything ITU1_2M+ exported a raw number. Completed 27–37.

Sources / verification

  • Enum names + values verified against protobufs master config.proto.
  • Frequency bounds verified against firmware RadioInterface.cpp (added in meshtastic/firmware#10627, currently on develop / awaiting a firmware release — mirrors the existing "awaiting firmware" EU_874/EU_917 entries). Value 37 band is 220–225 MHz per the proto/firmware (the issue paraphrased 220–222).

Issues Resolved

Fixes #3927

Documentation Updates

No documentation changes needed (region lists are self-describing labels).

Testing

  • Full unit suite passes (7946 / 0, success: true)
  • TypeScript compiles cleanly
  • New constants.test.ts: REGION_OPTIONS covers contiguous values 0–37, no dupes, valid NAME - description labels, value-28 label is ITU2_2M, and 33–37 present
  • loraFrequency.test.ts: slot-0 frequency for each new region (e.g. ITU2_70CM 420.0 → 420.125 MHz)
  • Manual: in Radio Config, confirm regions 33–37 appear in the dropdown and a device on one shows its label + frequency

🤖 Generated with Claude Code

The upstream RegionCode enum (meshtastic/protobufs config.proto) now goes
to 37, but three parallel region lists in MeshMonitor had drifted behind,
so devices reporting/configured to newer regions showed no label, weren't
selectable, and got no calculated frequency.

- REGION_OPTIONS (dropdown, constants.ts): was stopping at 32; add 33-37
  (ITU3_2M, ITU1_70CM, ITU2_70CM, ITU3_70CM, ITU2_125CM) and correct the
  value-28 label from the non-upstream `ITU23_2M` to `ITU2_2M`.
- regionFrequencyBounds (loraFrequency.ts): was stopping at 32; add 33-37
  with freqStart/freqEnd from firmware RadioInterface.cpp (firmware#10627,
  on develop / awaiting release), and fix the value-28 comment.
- EnumMappings.RegionCode (deviceBackupService.ts): was stopping at 26 —
  device backups of anything ITU1_2M+ exported a raw number; add 27-37.

Names/values verified against protobufs master config.proto; frequency
bounds against firmware develop. Note 33-37 ship in a future firmware
release (mirrors the existing "awaiting firmware" EU_874/EU_917 entries).

Tests: REGION_OPTIONS contiguous-coverage + label guards (new
constants.test.ts) and slot-0 frequency for each new region. Full suite
green (7946/0).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015AFBA76hsjqhsXe1BdnYub
@github-actions

github-actions Bot commented Jul 5, 2026

Copy link
Copy Markdown

Claude finished @Yeraze's task —— View job


PR Review — fix(config): add RegionCode values 33-37 + fix ITU2_2M label

  • Read changed files
  • Verify RegionCode values against upstream protobufs
  • Review code quality and test coverage
  • Post review feedback

Summary

The changes are correct and well-structured. The enum additions are accurately sourced, the frequency bounds align with the firmware, and the test suite is solid. There is one bug that was missed in this PR.


Bug: REGION_MAP is incomplete and retains the stale ITU23_2M key

File: src/components/configuration/constants.ts:173-182

The PR correctly fixes REGION_OPTIONS (the dropdown) and EnumMappings.RegionCode (backup export), but REGION_MAP — the reverse lookup used by ConfigurationTab.tsx when parsing a saved LoRa config — was not updated. It still has two problems:

  1. Stale key ITU23_2M (line 180) — should be ITU2_2M to match the upstream proto name. A device config restored with the old name will fail to map to value 28.
  2. Missing keys 33–37 — if a device config file uses string names like ITU3_2M, ITU1_70CM, etc., the REGION_MAP[lora.region] || 0 fallback in ConfigurationTab.tsx will silently reset the region to UNSET.
-  'ITU23_2M': 28, 'EU_866': 29, 'EU_874': 30, 'EU_917': 31,
-  'EU_N_868': 32
+  'ITU2_2M': 28, 'EU_866': 29, 'EU_874': 30, 'EU_917': 31,
+  'EU_N_868': 32, 'ITU3_2M': 33, 'ITU1_70CM': 34, 'ITU2_70CM': 35,
+  'ITU3_70CM': 36, 'ITU2_125CM': 37

The existing constants.test.ts doesn't cover REGION_MAP at all, so this slipped through. It would be worth adding a test that asserts REGION_MAP is the inverse of REGION_OPTIONS (or at minimum covers the corrected name for 28 and the new 33–37 entries).


Other observations (non-blocking)

ModemPreset enum in deviceBackupService.ts is truncated at value 8 (SHORT_TURBO, line 149). The MODEM_PRESET_OPTIONS in constants.ts goes up to 13 (NARROW_SLOW). This isn't introduced by this PR, but since the file was touched it's worth noting — backups of devices using presets 9–13 will export a raw number instead of a name. A separate follow-up would be warranted.

Frequency bounds for ITU3_2M (33) — The PR notes it as 144–148 MHz (same as ITU2_2M/28). The label correctly says "144-148 MHz" and the loraFrequency.ts bound is [144.0, 148.0]. The ITU Region 1 2m band (value 27) uses 144–146 MHz. This is accurate per ITU band plans.

Test coverage is good overall:

  • constants.test.ts guards against future proto drift with a contiguous-values check — a nice pattern.
  • loraFrequency.test.ts includes slot-0 spot checks for all five new regions.
  • The test for the ITU2_2M label rename (line 20-23) is well-targeted.

Verdict

The core data changes are correct and the PR is a clear improvement. The REGION_MAP omission should be fixed before merging — it's the one code path (config restore from YAML/string names) that remains broken for value 28 and the new 33–37 entries.

@Yeraze Yeraze merged commit 5f5afbb into main Jul 5, 2026
19 checks passed
@Yeraze Yeraze deleted the fix/3927-region-codes-33-37 branch July 5, 2026 14:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Region dropdown missing RegionCode values 33-37 (ITU3_2M, ITU1/2/3_70CM, ITU2_125CM)

1 participant