mirror of
https://github.com/pybricks/pybricks-code.git
synced 2026-09-12 01:23:52 +00:00
Fix failing download and run
The firmware was changed to send status updates at a regular interval which caused the hub state to change back to idle prematurely during download and run. This caused any program more than one or two lines long to fail. Issue: https://github.com/pybricks/support/issues/290
This commit is contained in:
+10
-3
@@ -62,9 +62,16 @@ const runtime: Reducer<HubRuntimeState, Action> = (
|
||||
return state;
|
||||
}
|
||||
case BlePybricksServiceEventActionType.StatusReport:
|
||||
return action.statusFlags & statusToFlag(Status.UserProgramRunning)
|
||||
? HubRuntimeState.Running
|
||||
: HubRuntimeState.Idle;
|
||||
if (action.statusFlags & statusToFlag(Status.UserProgramRunning)) {
|
||||
return HubRuntimeState.Running;
|
||||
}
|
||||
// TODO: Status report flags should probably separated from hub runtime state.
|
||||
// For now, we have this hack to ensure status updates don't interfere with
|
||||
// download and run
|
||||
if (state !== HubRuntimeState.Loading && state !== HubRuntimeState.Loaded) {
|
||||
return HubRuntimeState.Idle;
|
||||
}
|
||||
return state;
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user