Skip to content

Commit

Permalink
systemcmd/reboot support bl continue boot
Browse files Browse the repository at this point in the history
  • Loading branch information
jnippula committed Nov 6, 2023
1 parent 4865d4e commit 869e864
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/systemcmds/reboot/reboot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ static void print_usage()

PRINT_MODULE_USAGE_NAME_SIMPLE("reboot", "command");
PRINT_MODULE_USAGE_PARAM_FLAG('b', "Reboot into bootloader", true);
PRINT_MODULE_USAGE_PARAM_FLAG('c', "Bootloader continue boot", true);

PRINT_MODULE_USAGE_ARG("lock|unlock", "Take/release the shutdown lock (for testing)", true);
}
Expand All @@ -59,16 +60,21 @@ extern "C" __EXPORT int reboot_main(int argc, char *argv[])
{
int ch;
bool to_bootloader = false;
bool bl_continue_boot = false;

int myoptind = 1;
const char *myoptarg = nullptr;

while ((ch = px4_getopt(argc, argv, "b", &myoptind, &myoptarg)) != -1) {
while ((ch = px4_getopt(argc, argv, "bc", &myoptind, &myoptarg)) != -1) {
switch (ch) {
case 'b':
to_bootloader = true;
break;

case 'c':
bl_continue_boot = true;
break;

default:
print_usage();
return 1;
Expand Down Expand Up @@ -98,7 +104,7 @@ extern "C" __EXPORT int reboot_main(int argc, char *argv[])
return ret;
}

int ret = px4_reboot_request(to_bootloader);
int ret = px4_reboot_request(to_bootloader, 0, bl_continue_boot);

if (ret < 0) {
PX4_ERR("reboot failed (%i)", ret);
Expand Down

0 comments on commit 869e864

Please sign in to comment.