-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: proper servo center position calculation for servo ranges > 360deg
* fix port value read in servo binding * remove angle snapping logic from servo binding * sequentialize servo calibration tasks * minor naming fixes *
- Loading branch information
1 parent
a5f9b61
commit f8ed903
Showing
10 changed files
with
109 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
.../lib/effects/tasks-processing/scheme-pre-run/create-pre-run-motor-position-query-tasks.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { EMPTY, Observable, first, switchMap, tap } from 'rxjs'; | ||
import { Store } from '@ngrx/store'; | ||
import { PortModeName, ValueTransformers } from 'rxpoweredup'; | ||
|
||
import { ControlSchemeModel } from '../../../models'; | ||
import { HubStorageService } from '../../../hub-storage.service'; | ||
import { attachedIosIdFn } from '../../../reducers'; | ||
import { ATTACHED_IO_PROPS_ACTIONS } from '../../../actions'; | ||
import { ATTACHED_IO_PORT_MODE_INFO_SELECTORS } from '../../../selectors'; | ||
|
||
export function createPreRunMotorPositionQueryTasks( | ||
scheme: ControlSchemeModel, | ||
hubStorage: HubStorageService, | ||
store: Store | ||
): Array<Observable<unknown>> { | ||
const uniqueIosMap = new Map<string, { hubId: string; portId: number }>(); | ||
scheme.bindings.forEach((binding) => { | ||
uniqueIosMap.set(attachedIosIdFn(binding), { hubId: binding.hubId, portId: binding.portId }); | ||
}); | ||
const uniqueIos = Array.from(uniqueIosMap.values()); | ||
|
||
return uniqueIos.map(({ hubId, portId }) => { | ||
return store.select( | ||
ATTACHED_IO_PORT_MODE_INFO_SELECTORS.selectHubPortInputModeForPortModeName({ hubId, portId, portModeName: PortModeName.position }) | ||
).pipe( | ||
first(), | ||
switchMap((portModeData) => { | ||
if (portModeData === null) { | ||
return EMPTY; | ||
} | ||
return hubStorage.get(hubId).ports.getPortValue(portId, portModeData.modeId, ValueTransformers.position); | ||
}), | ||
tap((position) => { | ||
store.dispatch(ATTACHED_IO_PROPS_ACTIONS.startupMotorPositionReceived({ hubId, portId, position })); | ||
}), | ||
first() | ||
); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters