mirror of https://github.com/ArduPilot/ardupilot
AP_Periph: support updating bootloader with FLASH_BOOTLOADER option
This commit is contained in:
parent
c6a372bfdd
commit
0c00bb935a
|
@ -29,6 +29,11 @@ const AP_Param::Info AP_Periph_FW::var_info[] = {
|
|||
|
||||
// can node baudrate
|
||||
GSCALAR(can_baudrate, "CAN_BAUDRATE", 1000000),
|
||||
|
||||
#if !defined(HAL_NO_FLASH_SUPPORT) && !defined(HAL_NO_ROMFS_SUPPORT)
|
||||
// trigger bootloader flash
|
||||
GSCALAR(flash_bootloader, "FLASH_BOOTLOADER", 0),
|
||||
#endif
|
||||
|
||||
#ifdef HAL_PERIPH_ENABLE_BUZZER
|
||||
GSCALAR(buzz_volume, "BUZZER_VOLUME", 100),
|
||||
|
|
|
@ -21,6 +21,7 @@ public:
|
|||
k_param_led_brightness,
|
||||
k_param_airspeed,
|
||||
k_param_rangefinder,
|
||||
k_param_flash_bootloader,
|
||||
};
|
||||
|
||||
AP_Int16 format_version;
|
||||
|
@ -33,6 +34,10 @@ public:
|
|||
AP_Int8 led_brightness;
|
||||
#endif
|
||||
|
||||
#if !defined(HAL_NO_FLASH_SUPPORT) && !defined(HAL_NO_ROMFS_SUPPORT)
|
||||
AP_Int8 flash_bootloader;
|
||||
#endif
|
||||
|
||||
Parameters() {}
|
||||
};
|
||||
|
||||
|
|
|
@ -828,6 +828,17 @@ static void process1HzTasks(uint64_t timestamp_usec)
|
|||
}
|
||||
}
|
||||
|
||||
#if !defined(HAL_NO_FLASH_SUPPORT) && !defined(HAL_NO_ROMFS_SUPPORT)
|
||||
if (periph.g.flash_bootloader.get()) {
|
||||
periph.g.flash_bootloader.set_and_save_ifchanged(0);
|
||||
if (hal.util->flash_bootloader()) {
|
||||
can_printf("Flash bootloader OK\n");
|
||||
} else {
|
||||
can_printf("Flash bootloader FAILED\n");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
node_status.mode = UAVCAN_PROTOCOL_NODESTATUS_MODE_OPERATIONAL;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue