mirror of
https://github.com/pybricks/pybricks-code.git
synced 2026-09-12 17:45:22 +00:00
wire up firmware flash progress
Also turn off logging and longer checksum interval to improve performance 94K movehub fw flashes in about 1:45
This commit is contained in:
committed by
David Lechner
parent
7ba99d62bb
commit
3ae2fb2eef
@@ -4,6 +4,7 @@ import bootloader, { BootloaderState } from './bootloader';
|
||||
import editor, { EditorState } from './editor';
|
||||
import hub, { HubState } from './hub';
|
||||
import notification, { NotificationState } from './notification';
|
||||
import status, { StatusState } from './status';
|
||||
|
||||
/**
|
||||
* Root state for redux store.
|
||||
@@ -14,6 +15,7 @@ export interface RootState {
|
||||
readonly editor: EditorState;
|
||||
readonly hub: HubState;
|
||||
readonly notification: NotificationState;
|
||||
readonly status: StatusState;
|
||||
}
|
||||
|
||||
export default combineReducers({ bootloader, ble, editor, hub, notification });
|
||||
export default combineReducers({ bootloader, ble, editor, hub, notification, status });
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
import { Reducer } from 'react';
|
||||
import { combineReducers } from 'redux';
|
||||
import { BootloaderAction, BootloaderActionType } from '../actions/bootloader';
|
||||
|
||||
const progress: Reducer<number, BootloaderAction> = (state = -1, action) => {
|
||||
switch (action.type) {
|
||||
case BootloaderActionType.FlashProgress:
|
||||
return (action.complete / action.total) * 100;
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
};
|
||||
|
||||
export interface StatusState {
|
||||
readonly progress: number;
|
||||
}
|
||||
|
||||
export default combineReducers({ progress });
|
||||
Reference in New Issue
Block a user