Merge pull request #391 from pybricks/dlech

beta 11
This commit is contained in:
David Lechner
2021-04-07 11:37:59 -05:00
committed by GitHub
2 changed files with 9 additions and 6 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@pybricks/pybricks-code",
"version": "1.0.0-beta.10",
"version": "1.0.0-beta.11",
"license": "MIT",
"author": "The Pybricks Authors",
"repository": {
+8 -5
View File
@@ -62,12 +62,15 @@ const runtime: Reducer<HubRuntimeState, Action> = (
return state;
}
case BlePybricksServiceEventActionType.StatusReport:
if (action.statusFlags & statusToFlag(Status.UserProgramRunning)) {
return HubRuntimeState.Running;
}
// TODO: Status report flags should probably separated from hub runtime state.
// TODO: Status report flags need to be separated from hub runtime state.
// For now, we have this hack to ensure status updates don't interfere with
// download and run
// download and run. Loading state should really be actions like didStartLoading,
// didLoad and didFailToLoad.
if (state !== HubRuntimeState.Loading) {
if (action.statusFlags & statusToFlag(Status.UserProgramRunning)) {
return HubRuntimeState.Running;
}
}
if (state !== HubRuntimeState.Loading && state !== HubRuntimeState.Loaded) {
return HubRuntimeState.Idle;
}