basic ports view (#115)

* basic ports view

* slight adjustement of rendering
This commit is contained in:
Peli de Halleux
2017-12-19 14:26:57 -08:00
committed by GitHub
parent eac3e183c3
commit d78d9c8686
7 changed files with 43 additions and 6 deletions

View File

@@ -548,7 +548,7 @@ namespace motors {
return 0
}
interface MotorData {
export interface MotorData {
actualSpeed: number; // -100..+100
tachoCount: number;
count: number;
@@ -557,7 +557,7 @@ namespace motors {
// only a single output at a time
function getMotorData(out: Output): MotorData {
init()
let buf = motorMM.slice(outOffset(out), MotorDataOff.Size)
const buf = motorMM.slice(outOffset(out), MotorDataOff.Size)
return {
actualSpeed: buf.getNumber(NumberFormat.Int8LE, MotorDataOff.Speed),
tachoCount: buf.getNumber(NumberFormat.Int32LE, MotorDataOff.TachoCounts),
@@ -565,6 +565,11 @@ namespace motors {
}
}
export function getAllMotorData(): MotorData[] {
init();
return [Output.A, Output.B, Output.C, Output.D].map(out => getMotorData(out));
}
interface SyncOptions {
useSteps?: boolean;
speed: number;