Merge branch 'master' into oem-proto

This commit is contained in:
Ben Meadors 2022-10-19 19:22:35 -05:00 committed by GitHub
commit ddc1928bbb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 33 additions and 37 deletions

View File

@ -57,7 +57,7 @@ jobs:
sudo apt-get install -y cppcheck sudo apt-get install -y cppcheck
- name: Setup Python - name: Setup Python
uses: actions/setup-python@v2 uses: actions/setup-python@v4
with: with:
python-version: 3.x python-version: 3.x
@ -112,7 +112,7 @@ jobs:
repository: ${{github.event.pull_request.head.repo.full_name}} repository: ${{github.event.pull_request.head.repo.full_name}}
- name: Setup Python - name: Setup Python
uses: actions/setup-python@v2 uses: actions/setup-python@v4
with: with:
python-version: 3.x python-version: 3.x
@ -157,7 +157,7 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
- name: Get release version string - 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 id: version
- name: Store binaries as an artifact - name: Store binaries as an artifact
@ -190,7 +190,7 @@ jobs:
repository: ${{github.event.pull_request.head.repo.full_name}} repository: ${{github.event.pull_request.head.repo.full_name}}
- name: Setup Python - name: Setup Python
uses: actions/setup-python@v2 uses: actions/setup-python@v4
with: with:
python-version: 3.x python-version: 3.x
@ -214,7 +214,7 @@ jobs:
run: bin/build-nrf52.sh ${{ matrix.board }} run: bin/build-nrf52.sh ${{ matrix.board }}
- name: Get release version string - 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 id: version
- name: Store binaries as an artifact - name: Store binaries as an artifact
@ -245,7 +245,7 @@ jobs:
repository: ${{github.event.pull_request.head.repo.full_name}} repository: ${{github.event.pull_request.head.repo.full_name}}
- name: Setup Python - name: Setup Python
uses: actions/setup-python@v2 uses: actions/setup-python@v4
with: with:
python-version: 3.x python-version: 3.x
@ -269,7 +269,7 @@ jobs:
run: ./bin/build-rpi2040.sh ${{ matrix.board }} run: ./bin/build-rpi2040.sh ${{ matrix.board }}
- name: Get release version string - 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 id: version
- name: Store binaries as an artifact - name: Store binaries as an artifact
@ -292,7 +292,7 @@ jobs:
repository: ${{github.event.pull_request.head.repo.full_name}} repository: ${{github.event.pull_request.head.repo.full_name}}
- name: Setup Python - name: Setup Python
uses: actions/setup-python@v2 uses: actions/setup-python@v4
with: with:
python-version: 3.x python-version: 3.x
@ -327,7 +327,7 @@ jobs:
run: bin/build-native.sh run: bin/build-native.sh
- name: Get release version string - 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 id: version
- name: Store binaries as an artifact - name: Store binaries as an artifact
@ -360,12 +360,12 @@ jobs:
ref: ${{github.event.pull_request.head.ref}} ref: ${{github.event.pull_request.head.ref}}
repository: ${{github.event.pull_request.head.repo.full_name}} repository: ${{github.event.pull_request.head.repo.full_name}}
- uses: actions/download-artifact@v2 - uses: actions/download-artifact@v3
with: with:
path: ./ path: ./
- name: Get release version string - 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 id: version
- name: Move files up - name: Move files up
@ -384,7 +384,7 @@ jobs:
./device-*.bat ./device-*.bat
retention-days: 90 retention-days: 90
- uses: actions/download-artifact@v2 - uses: actions/download-artifact@v3
with: with:
name: firmware-${{ steps.version.outputs.version }} name: firmware-${{ steps.version.outputs.version }}
path: ./output path: ./output
@ -426,18 +426,18 @@ jobs:
needs: [gather-artifacts, after-checks] needs: [gather-artifacts, after-checks]
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v3
- name: Setup Python - name: Setup Python
uses: actions/setup-python@v2 uses: actions/setup-python@v4
with: with:
python-version: 3.x python-version: 3.x
- name: Get release version string - 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 id: version
- uses: actions/download-artifact@v2 - uses: actions/download-artifact@v3
with: with:
name: firmware-${{ steps.version.outputs.version }} name: firmware-${{ steps.version.outputs.version }}
path: ./output path: ./output
@ -450,7 +450,7 @@ jobs:
- name: Zip firmware - name: Zip firmware
run: zip -j -r ./firmware-${{ steps.version.outputs.version }}.zip ./output run: zip -j -r ./firmware-${{ steps.version.outputs.version }}.zip ./output
- uses: actions/download-artifact@v2 - uses: actions/download-artifact@v3
with: with:
name: debug-elfs-${{ steps.version.outputs.version }}.zip name: debug-elfs-${{ steps.version.outputs.version }}.zip
path: ./elfs path: ./elfs
@ -468,7 +468,7 @@ jobs:
with: with:
draft: true draft: true
prerelease: 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 }} tag_name: v${{ steps.version.outputs.version }}
body: | body: |
Autogenerated by github action, developer should edit as required before publishing... Autogenerated by github action, developer should edit as required before publishing...

View File

@ -101,9 +101,7 @@ bool AdminModule::handleReceivedProtobuf(const MeshPacket &mp, AdminMessage *r)
* Other * Other
*/ */
case AdminMessage_reboot_seconds_tag: { case AdminMessage_reboot_seconds_tag: {
int32_t s = r->reboot_seconds; reboot(r->reboot_seconds);
DEBUG_MSG("Rebooting in %d seconds\n", s);
rebootAtMsec = (s < 0) ? 0 : (millis() + s * 1000);
break; break;
} }
case AdminMessage_reboot_ota_seconds_tag: { case AdminMessage_reboot_ota_seconds_tag: {
@ -135,13 +133,13 @@ bool AdminModule::handleReceivedProtobuf(const MeshPacket &mp, AdminMessage *r)
case AdminMessage_factory_reset_tag: { case AdminMessage_factory_reset_tag: {
DEBUG_MSG("Initiating factory reset\n"); DEBUG_MSG("Initiating factory reset\n");
nodeDB.factoryReset(); nodeDB.factoryReset();
rebootAtMsec = millis() + (5 * 1000); reboot(5);
break; break;
} }
case AdminMessage_nodedb_reset_tag: { case AdminMessage_nodedb_reset_tag: {
DEBUG_MSG("Initiating node-db reset\n"); DEBUG_MSG("Initiating node-db reset\n");
nodeDB.resetNodes(); nodeDB.resetNodes();
rebootAtMsec = millis() + (5 * 1000); reboot(5);
break; break;
} }
#ifdef ARCH_PORTDUINO #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 if (changed) { // If nothing really changed, don't broadcast on the network or write to flash
service.reloadOwner(); service.reloadOwner();
DEBUG_MSG("Rebooting due to owner changes\n"); DEBUG_MSG("Rebooting due to owner changes\n");
screen->startRebootScreen(); reboot(5);
rebootAtMsec = millis() + (5 * 1000);
} }
} }
void AdminModule::handleSetConfig(const Config &c) void AdminModule::handleSetConfig(const Config &c)
{ {
bool requiresReboot = false;
bool isRouter = (config.device.role == Config_DeviceConfig_Role_ROUTER); bool isRouter = (config.device.role == Config_DeviceConfig_Role_ROUTER);
bool isRegionUnset = (config.lora.region == Config_LoRaConfig_RegionCode_UNSET); bool isRegionUnset = (config.lora.region == Config_LoRaConfig_RegionCode_UNSET);
@ -218,7 +214,6 @@ void AdminModule::handleSetConfig(const Config &c)
nodeDB.initConfigIntervals(); nodeDB.initConfigIntervals();
nodeDB.initModuleConfigIntervals(); nodeDB.initModuleConfigIntervals();
} }
requiresReboot = true;
break; break;
case Config_position_tag: case Config_position_tag:
DEBUG_MSG("Setting config: Position\n"); DEBUG_MSG("Setting config: Position\n");
@ -234,7 +229,6 @@ void AdminModule::handleSetConfig(const Config &c)
DEBUG_MSG("Setting config: WiFi\n"); DEBUG_MSG("Setting config: WiFi\n");
config.has_network = true; config.has_network = true;
config.network = c.payload_variant.network; config.network = c.payload_variant.network;
requiresReboot = true;
break; break;
case Config_display_tag: case Config_display_tag:
DEBUG_MSG("Setting config: Display\n"); 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.region > Config_LoRaConfig_RegionCode_UNSET) {
config.lora.tx_enabled = true; config.lora.tx_enabled = true;
} }
requiresReboot = true;
break; break;
case Config_bluetooth_tag: case Config_bluetooth_tag:
DEBUG_MSG("Setting config: Bluetooth\n"); DEBUG_MSG("Setting config: Bluetooth\n");
config.has_bluetooth = true; config.has_bluetooth = true;
config.bluetooth = c.payload_variant.bluetooth; config.bluetooth = c.payload_variant.bluetooth;
requiresReboot = true;
break; break;
} }
service.reloadConfig(SEGMENT_CONFIG); service.reloadConfig(SEGMENT_CONFIG);
// Reboot 5 seconds after a config that requires rebooting is set reboot(5);
if (requiresReboot) {
DEBUG_MSG("Rebooting due to config changes\n");
screen->startRebootScreen();
rebootAtMsec = millis() + (5 * 1000);
}
} }
void AdminModule::handleSetModuleConfig(const ModuleConfig &c) void AdminModule::handleSetModuleConfig(const ModuleConfig &c)
@ -309,6 +296,7 @@ void AdminModule::handleSetModuleConfig(const ModuleConfig &c)
} }
service.reloadConfig(SEGMENT_MODULECONFIG); service.reloadConfig(SEGMENT_MODULECONFIG);
reboot(5);
} }
void AdminModule::handleSetChannel(const Channel &cc) 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) AdminModule::AdminModule() : ProtobufModule("Admin", PortNum_ADMIN_APP, AdminMessage_fields)
{ {
// restrict to the admin channel for rx // restrict to the admin channel for rx

View File

@ -37,6 +37,7 @@ class AdminModule : public ProtobufModule<AdminMessage>
void handleSetConfig(const Config &c); void handleSetConfig(const Config &c);
void handleSetModuleConfig(const ModuleConfig &c); void handleSetModuleConfig(const ModuleConfig &c);
void handleSetChannel(); void handleSetChannel();
void reboot(int32_t seconds);
}; };
extern AdminModule *adminModule; extern AdminModule *adminModule;