diff --git a/.github/workflows/package_raspbian.yml b/.github/workflows/package_raspbian.yml new file mode 100644 index 0000000000..64b0dade2a --- /dev/null +++ b/.github/workflows/package_raspbian.yml @@ -0,0 +1,34 @@ +name: Package Raspbian + +on: workflow_dispatch + +permissions: + contents: write + packages: write + +jobs: + build-raspbian: + uses: ./.github/workflows/build_raspbian.yml + + package-raspbian: + runs-on: [self-hosted, linux, ARM64] + steps: + - name: build .debpkg + run: | + mkdir -p .debpkg/usr/sbin + mkdir -p .debpkg/etc/meshtasticd + mkdir -p .debpkg/usr/lib/systemd/system/ + cp release/meshtasticd_linux_arm64 /usr/sbin/meshtasticd + cp bin/config-dist.yaml /etc/meshtasticd/config.yaml + chmod +x .debpkg/usr/sbin/meshtasticd + cp bin/meshtasticd.service /usr/lib/systemd/system/meshtasticd.service + + - uses: jiro4989/build-deb-action@v3 + with: + package: meshtasticd + package_root: .debpkg + maintainer: Jonathan Bennett + version: ${{ github.ref }} # refs/tags/v*.*.* + arch: arm64 + depends: libyaml-cpp0.7 + desc: Native Linux Meshtastic binary. diff --git a/.trunk/configs/.yamllint.yaml b/.trunk/configs/.yamllint.yaml index 4d444662de..790846156f 100644 --- a/.trunk/configs/.yamllint.yaml +++ b/.trunk/configs/.yamllint.yaml @@ -3,7 +3,7 @@ rules: required: only-when-needed extra-allowed: ["{|}"] empty-values: - forbid-in-block-mappings: true + forbid-in-block-mappings: false forbid-in-flow-mappings: true key-duplicates: {} octal-values: diff --git a/bin/config-dist.yaml b/bin/config-dist.yaml index 2a3abac6ff..3924335a29 100644 --- a/bin/config-dist.yaml +++ b/bin/config-dist.yaml @@ -1,26 +1,21 @@ -# Define your devices here. -# Use Broadcom pin numbering +# Define your devices here using Broadcom pin numbering +# Uncomment the block that corresponds to your hardware +--- +Lora: +# Module: sx1262 # Waveshare SX126X XXXM +# DIO2_AS_RF_SWITCH: true +# CS: 21 +# IRQ: 16 +# Busy: 20 +# Reset: 18 -#Waveshare SX126X XXXM +# Module: sx1262 # Waveshare SX1302 LISTEN ONLY AT THIS TIME! +# CS: 7 +# IRQ: 17 +# Reset: 22 -#USE_SX1262: true -#SX126X_DIO2_AS_RF_SWITCH: true -#SX126X_CS: 21 -#SX126X_DIO1: 16 -#SX126X_BUSY: 20 -#SX126X_RESET: 18 - -#Waveshare SX1302 LISTEN ONLY AT THIS TIME! - -#USE_SX1262: true -#SX126X_CS: 7 -#SX126X_DIO1: 17 -#SX126X_RESET: 22 - -#Adafruit RFM9x - -#USE_RF95: true -#RF95_RESET: 25 -#RF95_NSS: 7 -#RF95_IRQ: 22 -#RF95_DIO1: 23 +# Module: RF95 # Adafruit RFM9x +# Reset: 25 +# CS: 7 +# IRQ: 22 +# Busy: 23 diff --git a/src/main.cpp b/src/main.cpp index 5c3151fc07..cfd6279e0e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -694,8 +694,8 @@ void setup() if (settingsMap[use_sx1262]) { if (!rIf) { PiHal *RadioLibHAL = new PiHal(1); - rIf = new SX1262Interface((LockingArduinoHal *)RadioLibHAL, settingsMap[sx126x_cs], settingsMap[sx126x_dio1], - settingsMap[sx126x_reset], settingsMap[sx126x_busy]); + rIf = new SX1262Interface((LockingArduinoHal *)RadioLibHAL, settingsMap[cs], settingsMap[irq], settingsMap[reset], + settingsMap[busy]); if (!rIf->init()) { LOG_ERROR("Failed to find SX1262 radio\n"); delete rIf; @@ -707,8 +707,8 @@ void setup() } else if (settingsMap[use_rf95]) { if (!rIf) { PiHal *RadioLibHAL = new PiHal(1); - rIf = new RF95Interface((LockingArduinoHal *)RadioLibHAL, settingsMap[rf95_nss], settingsMap[rf95_irq], - settingsMap[rf95_reset], settingsMap[rf95_dio1]); + rIf = new RF95Interface((LockingArduinoHal *)RadioLibHAL, settingsMap[cs], settingsMap[irq], settingsMap[reset], + settingsMap[busy]); if (!rIf->init()) { LOG_ERROR("Failed to find RF95 radio\n"); delete rIf; diff --git a/src/mesh/SX126xInterface.cpp b/src/mesh/SX126xInterface.cpp index ba3f2bc2a8..5083eeb538 100644 --- a/src/mesh/SX126xInterface.cpp +++ b/src/mesh/SX126xInterface.cpp @@ -79,7 +79,7 @@ template bool SX126xInterface::init() bool dio2AsRfSwitch = true; #elif defined(ARCH_RASPBERRY_PI) bool dio2AsRfSwitch = false; - if (settingsMap[sx126x_dio2_as_rf_switch]) { + if (settingsMap[dio2_as_rf_switch]) { LOG_DEBUG("Setting DIO2 as RF switch\n"); dio2AsRfSwitch = true; } diff --git a/src/platform/portduino/PortduinoGlue.cpp b/src/platform/portduino/PortduinoGlue.cpp index b3c2dc5f2e..2e402c0a05 100644 --- a/src/platform/portduino/PortduinoGlue.cpp +++ b/src/platform/portduino/PortduinoGlue.cpp @@ -123,17 +123,21 @@ void portduinoSetup() } try { - settingsMap[use_sx1262] = yamlConfig["USE_SX1262"].as(false); - settingsMap[sx126x_dio2_as_rf_switch] = yamlConfig["SX126X_DIO2_AS_RF_SWITCH"].as(false); - settingsMap[sx126x_cs] = yamlConfig["SX126X_CS"].as(RADIOLIB_NC); - settingsMap[sx126x_dio1] = yamlConfig["SX126X_DIO1"].as(RADIOLIB_NC); - settingsMap[sx126x_busy] = yamlConfig["SX126X_BUSY"].as(RADIOLIB_NC); - settingsMap[sx126x_reset] = yamlConfig["SX126X_RESET"].as(RADIOLIB_NC); - settingsMap[use_rf95] = yamlConfig["USE_RF95"].as(false); - settingsMap[rf95_nss] = yamlConfig["RF95_NSS"].as(RADIOLIB_NC); - settingsMap[rf95_irq] = yamlConfig["RF95_IRQ"].as(RADIOLIB_NC); - settingsMap[rf95_reset] = yamlConfig["RF95_RESET"].as(RADIOLIB_NC); - settingsMap[rf95_dio1] = yamlConfig["RF95_DIO1"].as(RADIOLIB_NC); + if (yamlConfig["Lora"]) { + settingsMap[use_sx1262] = false; + settingsMap[use_rf95] = false; + + if (yamlConfig["Lora"]["Module"] && yamlConfig["Lora"]["Module"].as("") == "sx1262") { + settingsMap[use_sx1262] = true; + } else if (yamlConfig["Lora"]["Module"] && yamlConfig["Lora"]["Module"].as("") == "RF95") { + settingsMap[use_rf95] = true; + } + settingsMap[dio2_as_rf_switch] = yamlConfig["Lora"]["DIO2_AS_RF_SWITCH"].as(false); + settingsMap[cs] = yamlConfig["Lora"]["CS"].as(RADIOLIB_NC); + settingsMap[irq] = yamlConfig["Lora"]["IRQ"].as(RADIOLIB_NC); + settingsMap[busy] = yamlConfig["Lora"]["Busy"].as(RADIOLIB_NC); + settingsMap[reset] = yamlConfig["Lora"]["Reset"].as(RADIOLIB_NC); + } } catch (YAML::Exception e) { std::cout << "*** Exception " << e.what() << std::endl; diff --git a/src/platform/portduino/PortduinoGlue.h b/src/platform/portduino/PortduinoGlue.h index 91fc4c2b1d..7dc563038d 100644 --- a/src/platform/portduino/PortduinoGlue.h +++ b/src/platform/portduino/PortduinoGlue.h @@ -4,18 +4,6 @@ extern std::map settingsMap; -enum { - use_sx1262, - sx126x_cs, - sx126x_dio1, - sx126x_busy, - sx126x_reset, - sx126x_dio2_as_rf_switch, - use_rf95, - rf95_nss, - rf95_irq, - rf95_reset, - rf95_dio1 -}; +enum { use_sx1262, cs, irq, busy, reset, dio2_as_rf_switch, use_rf95 }; #endif \ No newline at end of file