Skip to content

Commit

Permalink
Changed port numbers to support FW 2.0.00.0017
Browse files Browse the repository at this point in the history
  • Loading branch information
ttu committed Aug 11, 2019
1 parent 29b6ece commit eedddd8
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 16 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

### [Unreleased]

* CHANGED: Port numbers to support FW 2.0.00.0017
* ADDED: Simple tester web site
* ADDED: Configure Boost motors
* ADDED: Boost basic functionality
Expand Down
2 changes: 1 addition & 1 deletion dist/hub/hub.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 12 additions & 7 deletions dist/hub/hub.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/hub/hub.js.map

Large diffs are not rendered by default.

19 changes: 12 additions & 7 deletions src/hub/hub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ export class Hub {
40: 'TILT',
};
this.port2num = {
C: 0x01,
D: 0x02,
A: 0x00,
B: 0x01,
C: 0x02,
D: 0x03,
AB: 0x10,
LED: 0x32,
A: 0x37,
B: 0x38,
AB: 0x39,
TILT: 0x3a,
};
this.num2port = {};
Expand Down Expand Up @@ -122,6 +122,11 @@ export class Hub {
}
break;
}
case 0x05: {
this.log('Malformed message');
this.log('<', data);
break;
}
case 0x45: {
this.parseSensor(data);
break;
Expand Down Expand Up @@ -254,7 +259,7 @@ export class Hub {
* @param {function} callback
*/
motorTimeMulti(seconds, dutyCycleA, dutyCycleB, callback?) {
this.write(this.encodeMotorTimeMulti(0x39, seconds, dutyCycleA, dutyCycleB), callback);
this.write(this.encodeMotorTimeMulti(this.port2num['AB'], seconds, dutyCycleA, dutyCycleB), callback);
}

/**
Expand Down Expand Up @@ -286,7 +291,7 @@ export class Hub {
* @param {function} callback
*/
motorAngleMulti(angle, dutyCycleA, dutyCycleB, callback?) {
this.write(this.encodeMotorAngleMulti(0x39, angle, dutyCycleA, dutyCycleB), callback);
this.write(this.encodeMotorAngleMulti(this.port2num['AB'], angle, dutyCycleA, dutyCycleB), callback);
}

motorPowerCommand(port, power) {
Expand Down

0 comments on commit eedddd8

Please sign in to comment.