Add TX/RX LED pin configuration to radio settings and setup script

This commit is contained in:
Lloyd
2025-11-15 00:47:19 +00:00
parent 600a18c076
commit 8d974780ee
4 changed files with 21 additions and 0 deletions

View File

@@ -78,6 +78,10 @@ sx1262:
txen_pin: -1
rxen_pin: -1
# LED pins for TX/RX indication (-1 to disable)
txled_pin: -1
rxled_pin: -1
use_dio3_tcxo: false
# Waveshare hardware flag

View File

@@ -10,6 +10,8 @@
"irq_pin": 16,
"txen_pin": 13,
"rxen_pin": 12,
"txled_pin": -1,
"rxled_pin": -1,
"tx_power": 22,
"preamble_length": 17,
"is_waveshare": true
@@ -24,6 +26,8 @@
"irq_pin": 26,
"txen_pin": -1,
"rxen_pin": -1,
"txled_pin": -1,
"rxled_pin": -1,
"tx_power": 22,
"preamble_length": 17
},
@@ -37,6 +41,8 @@
"irq_pin": 16,
"txen_pin": -1,
"rxen_pin": 12,
"txled_pin": -1,
"rxled_pin": -1,
"tx_power": 22,
"preamble_length": 17
},
@@ -50,6 +56,8 @@
"irq_pin": 16,
"txen_pin": 13,
"rxen_pin": 12,
"txled_pin": -1,
"rxled_pin": -1,
"tx_power": 22,
"use_dio3_tcxo": true,

View File

@@ -113,6 +113,9 @@ def get_radio_for_board(board_config: dict):
"irq_pin": spi_config["irq_pin"],
"txen_pin": spi_config["txen_pin"],
"rxen_pin": spi_config["rxen_pin"],
"txled_pin": spi_config.get("txled_pin", -1),
"rxled_pin": spi_config.get("rxled_pin", -1),
"use_dio3_tcxo": spi_config.get("use_dio3_tcxo", False),
"is_waveshare": spi_config.get("is_waveshare", False),
"frequency": int(radio_config["frequency"]),
"tx_power": radio_config["tx_power"],

View File

@@ -214,6 +214,8 @@ else
irq_pin=$(echo "$hw_config" | jq -r '.irq_pin // empty')
txen_pin=$(echo "$hw_config" | jq -r '.txen_pin // empty')
rxen_pin=$(echo "$hw_config" | jq -r '.rxen_pin // empty')
txled_pin=$(echo "$hw_config" | jq -r '.txled_pin // empty')
rxled_pin=$(echo "$hw_config" | jq -r '.rxled_pin // empty')
tx_power=$(echo "$hw_config" | jq -r '.tx_power // empty')
preamble_length=$(echo "$hw_config" | jq -r '.preamble_length // empty')
is_waveshare=$(echo "$hw_config" | jq -r '.is_waveshare // empty')
@@ -228,6 +230,8 @@ else
[ -n "$irq_pin" ] && sed "${SED_OPTS[@]}" "s/^ irq_pin:.*/ irq_pin: $irq_pin/" "$CONFIG_FILE"
[ -n "$txen_pin" ] && sed "${SED_OPTS[@]}" "s/^ txen_pin:.*/ txen_pin: $txen_pin/" "$CONFIG_FILE"
[ -n "$rxen_pin" ] && sed "${SED_OPTS[@]}" "s/^ rxen_pin:.*/ rxen_pin: $rxen_pin/" "$CONFIG_FILE"
[ -n "$txled_pin" ] && sed "${SED_OPTS[@]}" "s/^ txled_pin:.*/ txled_pin: $txled_pin/" "$CONFIG_FILE"
[ -n "$rxled_pin" ] && sed "${SED_OPTS[@]}" "s/^ rxled_pin:.*/ rxled_pin: $rxled_pin/" "$CONFIG_FILE"
[ -n "$tx_power" ] && sed "${SED_OPTS[@]}" "s/^ tx_power:.*/ tx_power: $tx_power/" "$CONFIG_FILE"
[ -n "$preamble_length" ] && sed "${SED_OPTS[@]}" "s/^ preamble_length:.*/ preamble_length: $preamble_length/" "$CONFIG_FILE"
@@ -268,6 +272,8 @@ if [ -n "$bus_id" ]; then
echo " IRQ Pin: $irq_pin"
[ "$txen_pin" != "-1" ] && echo " TX Enable Pin: $txen_pin"
[ "$rxen_pin" != "-1" ] && echo " RX Enable Pin: $rxen_pin"
[ "$txled_pin" != "-1" ] && echo " TX LED Pin: $txled_pin"
[ "$rxled_pin" != "-1" ] && echo " RX LED Pin: $rxled_pin"
echo " TX Power: $tx_power dBm"
echo " Preamble Length: $preamble_length"
[ -n "$is_waveshare" ] && echo " Waveshare: $is_waveshare"