mirror of
https://github.com/pybricks/pybricks-code.git
synced 2026-09-12 09:36:27 +00:00
split firmware flashing from lwp3-bootloader
BLE won't always be the only way to flash firmware
This commit is contained in:
committed by
David Lechner
parent
6d81da0df0
commit
07d0b5ef39
@@ -463,60 +463,3 @@ export type BootloaderResponseAction =
|
||||
| BootloaderChecksumResponseAction
|
||||
| BootloaderStateResponseAction
|
||||
| BootloaderErrorResponseAction;
|
||||
|
||||
/**
|
||||
* High-level bootloader actions.
|
||||
*/
|
||||
export enum BootloaderActionType {
|
||||
/**
|
||||
* Flash new firmware to the device.
|
||||
*/
|
||||
FlashFirmware = 'bootloader.action.flash',
|
||||
/**
|
||||
* Firmware flash progress.
|
||||
*/
|
||||
FlashProgress = 'bootloader.action.flash.progress',
|
||||
}
|
||||
|
||||
/**
|
||||
* Action that flashes firmware to a hub.
|
||||
*/
|
||||
export interface BootloaderFlashFirmwareAction
|
||||
extends Action<BootloaderActionType.FlashFirmware> {
|
||||
/** The firmware zip file data or undefined to get firmware later. */
|
||||
data?: ArrayBuffer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new action to flash firmware to a hub.
|
||||
* @param data The firmware zip file data or undefined to get firmware later.
|
||||
*/
|
||||
export function flashFirmware(data?: ArrayBuffer): BootloaderFlashFirmwareAction {
|
||||
return { type: BootloaderActionType.FlashFirmware, data };
|
||||
}
|
||||
|
||||
export interface BootloaderFlashProgressAction
|
||||
extends Action<BootloaderActionType.FlashProgress> {
|
||||
/**
|
||||
* The number of bytes that have been flashed so far.
|
||||
*/
|
||||
complete: number;
|
||||
/**
|
||||
* The total number of bytes to be flashed.
|
||||
*/
|
||||
total: number;
|
||||
}
|
||||
|
||||
export function progress(
|
||||
complete: number,
|
||||
total: number,
|
||||
): BootloaderFlashProgressAction {
|
||||
return { type: BootloaderActionType.FlashProgress, complete, total };
|
||||
}
|
||||
|
||||
/**
|
||||
* Common type for all high-level bootloader actions.
|
||||
*/
|
||||
export type BootloaderAction =
|
||||
| BootloaderFlashFirmwareAction
|
||||
| BootloaderFlashProgressAction;
|
||||
|
||||
Reference in New Issue
Block a user