From db12eab08341aa3b0c5697c435729e8204f1eac6 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Wed, 19 Oct 2022 08:51:00 -0500 Subject: [PATCH 1/6] Update setup-python --- .github/workflows/main_matrix.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/main_matrix.yml b/.github/workflows/main_matrix.yml index 4bff8691c..a841850b6 100644 --- a/.github/workflows/main_matrix.yml +++ b/.github/workflows/main_matrix.yml @@ -57,7 +57,7 @@ jobs: sudo apt-get install -y cppcheck - name: Setup Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: 3.x @@ -112,7 +112,7 @@ jobs: repository: ${{github.event.pull_request.head.repo.full_name}} - name: Setup Python - uses: actions/setup-python@v2 + uses: actions/setup-python with: python-version: 3.x @@ -190,7 +190,7 @@ jobs: repository: ${{github.event.pull_request.head.repo.full_name}} - name: Setup Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: 3.x @@ -245,7 +245,7 @@ jobs: repository: ${{github.event.pull_request.head.repo.full_name}} - name: Setup Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: 3.x @@ -292,7 +292,7 @@ jobs: repository: ${{github.event.pull_request.head.repo.full_name}} - name: Setup Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: 3.x @@ -429,7 +429,7 @@ jobs: uses: actions/checkout@v2 - name: Setup Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: 3.x From 15ec8ba6a3fe5cec526fcdf1992296a1022c0f45 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Wed, 19 Oct 2022 08:58:14 -0500 Subject: [PATCH 2/6] Whoops --- .github/workflows/main_matrix.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main_matrix.yml b/.github/workflows/main_matrix.yml index a841850b6..91a77b968 100644 --- a/.github/workflows/main_matrix.yml +++ b/.github/workflows/main_matrix.yml @@ -112,7 +112,7 @@ jobs: repository: ${{github.event.pull_request.head.repo.full_name}} - name: Setup Python - uses: actions/setup-python + uses: actions/setup-python@v4 with: python-version: 3.x From d3540e82ffdabf48209490300eec84e7a331cd73 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Wed, 19 Oct 2022 10:44:09 -0500 Subject: [PATCH 3/6] I think these tokens are extra --- .github/workflows/main_matrix.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/main_matrix.yml b/.github/workflows/main_matrix.yml index 91a77b968..e6a21e2ac 100644 --- a/.github/workflows/main_matrix.yml +++ b/.github/workflows/main_matrix.yml @@ -157,7 +157,7 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} - name: Get release version string - run: echo "{version}={$(./bin/buildinfo.py long)}" >> $GITHUB_OUTPUT + run: echo "version=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT id: version - name: Store binaries as an artifact @@ -214,7 +214,7 @@ jobs: run: bin/build-nrf52.sh ${{ matrix.board }} - name: Get release version string - run: echo "{version}={$(./bin/buildinfo.py long)}" >> $GITHUB_OUTPUT + run: echo "version=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT id: version - name: Store binaries as an artifact @@ -269,7 +269,7 @@ jobs: run: ./bin/build-rpi2040.sh ${{ matrix.board }} - name: Get release version string - run: echo "{version}={$(./bin/buildinfo.py long)}" >> $GITHUB_OUTPUT + run: echo "version=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT id: version - name: Store binaries as an artifact @@ -327,7 +327,7 @@ jobs: run: bin/build-native.sh - name: Get release version string - run: echo "{version}={$(./bin/buildinfo.py long)}" >> $GITHUB_OUTPUT + run: echo "version=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT id: version - name: Store binaries as an artifact @@ -365,7 +365,7 @@ jobs: path: ./ - name: Get release version string - run: echo "{version}={$(./bin/buildinfo.py long)}" >> $GITHUB_OUTPUT + run: echo "version=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT id: version - name: Move files up @@ -434,7 +434,7 @@ jobs: python-version: 3.x - name: Get release version string - run: echo "{version}={$(./bin/buildinfo.py long)}" >> $GITHUB_OUTPUT + run: echo "version=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT id: version - uses: actions/download-artifact@v2 From b6154639815a206e83c391db17c964de4d5e1b53 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Wed, 19 Oct 2022 11:35:25 -0500 Subject: [PATCH 4/6] Update download-artifiact version --- .github/workflows/main_matrix.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main_matrix.yml b/.github/workflows/main_matrix.yml index e6a21e2ac..512805478 100644 --- a/.github/workflows/main_matrix.yml +++ b/.github/workflows/main_matrix.yml @@ -360,7 +360,7 @@ jobs: ref: ${{github.event.pull_request.head.ref}} repository: ${{github.event.pull_request.head.repo.full_name}} - - uses: actions/download-artifact@v2 + - uses: actions/download-artifact@v3 with: path: ./ @@ -384,7 +384,7 @@ jobs: ./device-*.bat retention-days: 90 - - uses: actions/download-artifact@v2 + - uses: actions/download-artifact@v3 with: name: firmware-${{ steps.version.outputs.version }} path: ./output @@ -437,7 +437,7 @@ jobs: run: echo "version=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT id: version - - uses: actions/download-artifact@v2 + - uses: actions/download-artifact@v3 with: name: firmware-${{ steps.version.outputs.version }} path: ./output @@ -450,7 +450,7 @@ jobs: - name: Zip firmware run: zip -j -r ./firmware-${{ steps.version.outputs.version }}.zip ./output - - uses: actions/download-artifact@v2 + - uses: actions/download-artifact@v3 with: name: debug-elfs-${{ steps.version.outputs.version }}.zip path: ./elfs From 3d9845ff6d10f9a82cc7603adcd56a49e6e0740a Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Wed, 19 Oct 2022 11:43:24 -0500 Subject: [PATCH 5/6] Update checkout version and release string --- .github/workflows/main_matrix.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main_matrix.yml b/.github/workflows/main_matrix.yml index 512805478..fd4acbdba 100644 --- a/.github/workflows/main_matrix.yml +++ b/.github/workflows/main_matrix.yml @@ -426,7 +426,7 @@ jobs: needs: [gather-artifacts, after-checks] steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Setup Python uses: actions/setup-python@v4 @@ -468,7 +468,7 @@ jobs: with: draft: true prerelease: true - release_name: Meshtastic Device ${{ steps.version.outputs.version }} alpha - Public Preview + release_name: Meshtastic Device ${{ steps.version.outputs.version }} Alpha tag_name: v${{ steps.version.outputs.version }} body: | Autogenerated by github action, developer should edit as required before publishing... From 056a93f0c949c6ac1a949210f651c4673f2190e8 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Wed, 19 Oct 2022 19:19:04 -0500 Subject: [PATCH 6/6] Consolidate reboots (#1827) --- src/modules/AdminModule.cpp | 33 ++++++++++++++------------------- src/modules/AdminModule.h | 1 + 2 files changed, 15 insertions(+), 19 deletions(-) diff --git a/src/modules/AdminModule.cpp b/src/modules/AdminModule.cpp index 883ed0ac3..72e0e7fe1 100644 --- a/src/modules/AdminModule.cpp +++ b/src/modules/AdminModule.cpp @@ -101,9 +101,7 @@ bool AdminModule::handleReceivedProtobuf(const MeshPacket &mp, AdminMessage *r) * Other */ case AdminMessage_reboot_seconds_tag: { - int32_t s = r->reboot_seconds; - DEBUG_MSG("Rebooting in %d seconds\n", s); - rebootAtMsec = (s < 0) ? 0 : (millis() + s * 1000); + reboot(r->reboot_seconds); break; } case AdminMessage_reboot_ota_seconds_tag: { @@ -135,13 +133,13 @@ bool AdminModule::handleReceivedProtobuf(const MeshPacket &mp, AdminMessage *r) case AdminMessage_factory_reset_tag: { DEBUG_MSG("Initiating factory reset\n"); nodeDB.factoryReset(); - rebootAtMsec = millis() + (5 * 1000); + reboot(5); break; } case AdminMessage_nodedb_reset_tag: { DEBUG_MSG("Initiating node-db reset\n"); nodeDB.resetNodes(); - rebootAtMsec = millis() + (5 * 1000); + reboot(5); break; } #ifdef ARCH_PORTDUINO @@ -196,14 +194,12 @@ void AdminModule::handleSetOwner(const User &o) if (changed) { // If nothing really changed, don't broadcast on the network or write to flash service.reloadOwner(); DEBUG_MSG("Rebooting due to owner changes\n"); - screen->startRebootScreen(); - rebootAtMsec = millis() + (5 * 1000); + reboot(5); } } void AdminModule::handleSetConfig(const Config &c) { - bool requiresReboot = false; bool isRouter = (config.device.role == Config_DeviceConfig_Role_ROUTER); bool isRegionUnset = (config.lora.region == Config_LoRaConfig_RegionCode_UNSET); @@ -218,7 +214,6 @@ void AdminModule::handleSetConfig(const Config &c) nodeDB.initConfigIntervals(); nodeDB.initModuleConfigIntervals(); } - requiresReboot = true; break; case Config_position_tag: DEBUG_MSG("Setting config: Position\n"); @@ -234,7 +229,6 @@ void AdminModule::handleSetConfig(const Config &c) DEBUG_MSG("Setting config: WiFi\n"); config.has_network = true; config.network = c.payload_variant.network; - requiresReboot = true; break; case Config_display_tag: DEBUG_MSG("Setting config: Display\n"); @@ -249,23 +243,16 @@ void AdminModule::handleSetConfig(const Config &c) config.lora.region > Config_LoRaConfig_RegionCode_UNSET) { config.lora.tx_enabled = true; } - requiresReboot = true; break; case Config_bluetooth_tag: DEBUG_MSG("Setting config: Bluetooth\n"); config.has_bluetooth = true; config.bluetooth = c.payload_variant.bluetooth; - requiresReboot = true; break; } service.reloadConfig(SEGMENT_CONFIG); - // Reboot 5 seconds after a config that requires rebooting is set - if (requiresReboot) { - DEBUG_MSG("Rebooting due to config changes\n"); - screen->startRebootScreen(); - rebootAtMsec = millis() + (5 * 1000); - } + reboot(5); } void AdminModule::handleSetModuleConfig(const ModuleConfig &c) @@ -307,8 +294,9 @@ void AdminModule::handleSetModuleConfig(const ModuleConfig &c) moduleConfig.canned_message = c.payload_variant.canned_message; break; } - + service.reloadConfig(SEGMENT_MODULECONFIG); + reboot(5); } void AdminModule::handleSetChannel(const Channel &cc) @@ -468,6 +456,13 @@ void AdminModule::handleGetChannel(const MeshPacket &req, uint32_t channelIndex) } } +void AdminModule::reboot(int32_t seconds) +{ + DEBUG_MSG("Rebooting in %d seconds\n", seconds); + screen->startRebootScreen(); + rebootAtMsec = (seconds < 0) ? 0 : (millis() + seconds * 1000); +} + AdminModule::AdminModule() : ProtobufModule("Admin", PortNum_ADMIN_APP, AdminMessage_fields) { // restrict to the admin channel for rx diff --git a/src/modules/AdminModule.h b/src/modules/AdminModule.h index 9a87c7f9e..dd81c3218 100644 --- a/src/modules/AdminModule.h +++ b/src/modules/AdminModule.h @@ -37,6 +37,7 @@ class AdminModule : public ProtobufModule void handleSetConfig(const Config &c); void handleSetModuleConfig(const ModuleConfig &c); void handleSetChannel(); + void reboot(int32_t seconds); }; extern AdminModule *adminModule;