Skip to content

Commit

Permalink
fix method names and remove call to removed method
Browse files Browse the repository at this point in the history
  • Loading branch information
LandryNorris committed Aug 3, 2023
1 parent 0f2451c commit 6176c3b
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 19 deletions.
6 changes: 3 additions & 3 deletions packages/control-hub/src/internal/ControlHub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ export class ControlHubInternal implements ControlHub {
}

async getDigitalAllInputs(): Promise<number> {
return this.embedded.getDigitalAllInputs();
return this.embedded.getAllDigitalInputs();
}

async getDigitalDirection(dioPin: number): Promise<DigitalChannelDirection> {
Expand Down Expand Up @@ -409,15 +409,15 @@ export class ControlHubInternal implements ControlHub {
}

async setDigitalAllOutputs(bitPackedField: number): Promise<void> {
return this.embedded.setDigitalAllOutputs(bitPackedField);
return this.embedded.setAllDigitalOutputs(bitPackedField);
}

async setDigitalDirection(dioPin: number, direction: DigitalChannelDirection): Promise<void> {
return this.embedded.setDigitalDirection(dioPin, direction);
}

async setDigitalSingleOutput(dioPin: number, value: DigitalState): Promise<void> {
return this.embedded.setDigitalSingleOutput(dioPin, value);
return this.embedded.setDigitalOutput(dioPin, value);
}

async setFTDIResetControl(ftdiResetControl: boolean): Promise<void> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import {
I2CWriteStatus,
LedPattern,
ModuleInterface,
ModuleStatus,
ModuleStatus, MotorMode,
ParentExpansionHub,
ParentRevHub,
PidCoefficients,
PidCoefficients, PidfCoefficients,
RevHub,
RevHubType,
Rgb,
Expand Down Expand Up @@ -142,7 +142,7 @@ export class ControlHubConnectedExpansionHub implements ParentExpansionHub {
};
}

async getDigitalAllInputs(): Promise<number> {
async getAllDigitalInputs(): Promise<number> {
return await this.sendCommand("getAllDigitalInputs", {
hId: this.id,
});
Expand Down Expand Up @@ -449,7 +449,7 @@ export class ControlHubConnectedExpansionHub implements ParentExpansionHub {
});
}

async setDigitalAllOutputs(bitPackedField: number): Promise<void> {
async setAllDigitalOutputs(bitPackedField: number): Promise<void> {
await this.sendCommand("readVersionString", {
hId: this.id,
bf: bitPackedField,
Expand All @@ -464,7 +464,7 @@ export class ControlHubConnectedExpansionHub implements ParentExpansionHub {
});
}

async setDigitalSingleOutput(dioPin: number, value: DigitalState): Promise<void> {
async setDigitalOutput(dioPin: number, value: DigitalState): Promise<void> {
await this.sendCommand("readVersionString", {
hId: this.id,
c: dioPin,
Expand Down Expand Up @@ -680,4 +680,19 @@ export class ControlHubConnectedExpansionHub implements ParentExpansionHub {

return newHub;
}

getMotorClosedLoopControlCoefficients(motorChannel: number, motorMode: MotorMode): Promise<PidfCoefficients | PidCoefficients> {
return this.getMotorPIDCoefficients(motorChannel, motorMode);
}


async setMotorClosedLoopControlCoefficients(
motorChannel: number,
motorMode: MotorMode,
algorithm: ClosedLoopControlAlgorithm,
pid: PidCoefficients | PidfCoefficients,
): Promise<void> {
//Todo(landry): handle pidf
await this.setMotorPIDCoefficients(motorChannel, motorMode, pid as PidCoefficients);
}
}
14 changes: 3 additions & 11 deletions packages/sample/src/command/list.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,16 @@
import { openConnectedExpansionHubs } from "@rev-robotics/expansion-hub";
import { controlHubHierarchyToString } from "../HubStringify.js";
import {
openConnectedControlHub, openUsbControlHubsAndChildren,
} from "@rev-robotics/control-hub";
import { ExpansionHub } from "@rev-robotics/rev-hub-core";
import {ControlHub, ExpansionHub} from "@rev-robotics/rev-hub-core";
import {openUsbControlHubs} from "../adb-setup.js";

export async function list() {
let usbControlHubs = await openUsbControlHubsAndChildren();
let usbControlHubs = await openUsbControlHubs();
for (const hub of usbControlHubs) {
let hierarchy = controlHubHierarchyToString(hub);
console.log(hierarchy);
hub.close();
}

const controlHub = await openConnectedControlHub();
if (controlHub) {
console.log(`WiFi Control Hub: ${controlHub.moduleAddress}\n\n`);
controlHub.close();
}

const hubs: ExpansionHub[] = await openConnectedExpansionHubs();
for (const hub of hubs) {
hub.on("error", (e: any) => {
Expand Down

0 comments on commit 6176c3b

Please sign in to comment.