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
- 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@v4
with:
python-version: 3.x
@ -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
@ -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
@ -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
@ -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
@ -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
@ -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
@ -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
@ -360,12 +360,12 @@ 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: ./
- 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
@ -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
@ -426,18 +426,18 @@ jobs:
needs: [gather-artifacts, after-checks]
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
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
- 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
@ -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...

View File

@ -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

View File

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