-
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.
feat(control schemes): read servo values from port during edit
- Loading branch information
1 parent
1784872
commit 0067e5d
Showing
10 changed files
with
194 additions
and
27 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
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,33 @@ | ||
import { Injectable } from '@angular/core'; | ||
import { Observable, last, switchMap, take, throwError } from 'rxjs'; | ||
import { Store } from '@ngrx/store'; | ||
import { PortModeName } from '@nvsukhanov/rxpoweredup'; | ||
|
||
import { ATTACHED_IO_PORT_MODE_INFO_SELECTORS } from './selectors'; | ||
import { HubStorageService } from './hub-storage.service'; | ||
|
||
@Injectable() | ||
export class HubFacadeService { | ||
constructor( | ||
private readonly hubStorage: HubStorageService, | ||
private readonly store: Store | ||
) { | ||
} | ||
|
||
public getMotorAbsolutePosition( | ||
hubId: string, | ||
portId: number | ||
): Observable<number> { | ||
return this.store.select(ATTACHED_IO_PORT_MODE_INFO_SELECTORS.selectHubPortInputModeForPortModeName({ | ||
hubId, | ||
portId, | ||
portModeName: PortModeName.absolutePosition | ||
})).pipe( | ||
take(1), | ||
switchMap((modeInfo) => modeInfo !== null | ||
? this.hubStorage.get(hubId).motors.getAbsolutePosition(portId, modeInfo.modeId) | ||
: throwError(() => new Error('Required absolute position mode not found'))), | ||
last() | ||
); | ||
} | ||
} |
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