setup-radio-config.sh never writes en_pin, leaving PiMesh-1W V2 and UltraPeater E22P with a disabled RF front end #155

Open
opened 2026-10-27 09:35:43 +01:00 by adam · 1 comment
Owner

Summary

setup-radio-config.sh reads a board profile out of radio-settings.json and writes the
hardware keys into config.yaml. It handles 22 keys, including txen_pin, rxen_pin,
txled_pin, rxled_pin, cs_pin and is_waveshare, but it never reads or writes en_pin.

Two shipped presets require en_pin:

preset en_pin cs_pin
PiMesh-1W (V2) 26 -1
Zindello Industries UltraPeater E22P 21 16

On those boards en_pin gates the E22P RF front end. Because the script leaves the existing
value in place, a user who selects the PiMesh-1W V2 profile on a config that currently has
en_pin: -1 gets every other pin written correctly and the front end left disabled, with no
warning. The web onboarding wizard does handle en_pin, so the two paths disagree.

Evidence

Keys the script writes back (from the sed calls in apply_hardware_config):

bandwidth, baud_rate, bus_id, busy_pin, coding_rate, cs_id, cs_pin, frequency,
irq_pin, is_waveshare, node_name, pid, port, preamble_length, reset_pin, rxen_pin,
rxled_pin, spreading_factor, txen_pin, txled_pin, tx_power, vid

en_pin is absent. The only matches for the string in the file are the txen_pin and
rxen_pin substrings; there is no standalone en_pin occurrence.

Reproduce

  1. Start from a config.yaml containing en_pin: -1.
  2. Run setup-radio-config.sh and select PiMesh-1W (V2).
  3. Inspect config.yaml: cs_pin, busy_pin, irq_pin, reset_pin, use_dio2_rf,
    use_dio3_tcxo and tx_power are all updated to the preset values, and en_pin is
    still -1.

Suggested fix

Extract en_pin alongside the other pins and write it, adding the key when it is missing
rather than only substituting an existing line, since older configs predate it:

en_pin=$(echo "$hw_config" | jq -r '.en_pin // empty')
...
[ -n "$en_pin" ] && sed "${SED_OPTS[@]}" "s/^  en_pin:.*/  en_pin: $en_pin/" "$CONFIG_FILE"

It would also help to have the script warn when a selected preset contains a key it does not
know how to write, so this class of gap fails loudly instead of silently.

## Summary `setup-radio-config.sh` reads a board profile out of `radio-settings.json` and writes the hardware keys into `config.yaml`. It handles 22 keys, including `txen_pin`, `rxen_pin`, `txled_pin`, `rxled_pin`, `cs_pin` and `is_waveshare`, but it never reads or writes `en_pin`. Two shipped presets require `en_pin`: | preset | `en_pin` | `cs_pin` | |---|---|---| | PiMesh-1W (V2) | 26 | -1 | | Zindello Industries UltraPeater E22P | 21 | 16 | On those boards `en_pin` gates the E22P RF front end. Because the script leaves the existing value in place, a user who selects the PiMesh-1W V2 profile on a config that currently has `en_pin: -1` gets every other pin written correctly and the front end left disabled, with no warning. The web onboarding wizard does handle `en_pin`, so the two paths disagree. ## Evidence Keys the script writes back (from the `sed` calls in `apply_hardware_config`): ``` bandwidth, baud_rate, bus_id, busy_pin, coding_rate, cs_id, cs_pin, frequency, irq_pin, is_waveshare, node_name, pid, port, preamble_length, reset_pin, rxen_pin, rxled_pin, spreading_factor, txen_pin, txled_pin, tx_power, vid ``` `en_pin` is absent. The only matches for the string in the file are the `txen_pin` and `rxen_pin` substrings; there is no standalone `en_pin` occurrence. ## Reproduce 1. Start from a `config.yaml` containing `en_pin: -1`. 2. Run `setup-radio-config.sh` and select **PiMesh-1W (V2)**. 3. Inspect `config.yaml`: `cs_pin`, `busy_pin`, `irq_pin`, `reset_pin`, `use_dio2_rf`, `use_dio3_tcxo` and `tx_power` are all updated to the preset values, and `en_pin` is still `-1`. ## Suggested fix Extract `en_pin` alongside the other pins and write it, adding the key when it is missing rather than only substituting an existing line, since older configs predate it: ```bash en_pin=$(echo "$hw_config" | jq -r '.en_pin // empty') ... [ -n "$en_pin" ] && sed "${SED_OPTS[@]}" "s/^ en_pin:.*/ en_pin: $en_pin/" "$CONFIG_FILE" ``` It would also help to have the script warn when a selected preset contains a key it does not know how to write, so this class of gap fails loudly instead of silently. <!-- github-sync-id:5404819806 -->
Author
Owner

I had a similar issue except my config.yaml had this at the end:

en_pins:
- 0
en_pin: 26 was set but ignored. Commented the last two lines out and restarted.

PiMesh-1W V2 on a raspi 4B. This happened after an update. Made change in config.yaml and working great on openHop Repeater v1.1.5.dev0

I had a similar issue except my config.yaml had this at the end: `en_pins:` `- 0` `en_pin: 26` was set but ignored. Commented the last two lines out and restarted. PiMesh-1W V2 on a raspi 4B. This happened after an update. Made change in config.yaml and working great on openHop Repeater v1.1.5.dev0 <!-- github-comment-id:5658379078 -->
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/pyMC_Repeater#155