Skip to content

Commit

Permalink
fix ordering within each pair
Browse files Browse the repository at this point in the history
  • Loading branch information
noahm committed Apr 1, 2024
1 parent dee6ed6 commit 2972b66
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
16 changes: 8 additions & 8 deletions sdk/commands/enabled-sensors.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { twoEnabledSensors_t, EnabledSensors } from "./enabled-sensors";

describe("twoEnabledSensors_t", () => {
test("encode", () => {
expect(twoEnabledSensors_t.decode(sbytes("0F"))).toEqual({
expect(twoEnabledSensors_t.decode(sbytes("F0"), false)).toEqual({
up0: true,
right0: true,
down0: true,
Expand All @@ -14,7 +14,7 @@ describe("twoEnabledSensors_t", () => {
down1: false,
left1: false,
});
expect(twoEnabledSensors_t.decode(sbytes("F0"))).toEqual({
expect(twoEnabledSensors_t.decode(sbytes("0F"))).toEqual({
up0: false,
right0: false,
down0: false,
Expand All @@ -30,12 +30,6 @@ describe("twoEnabledSensors_t", () => {
const enabledSensors = new EnabledSensors();

const decodedData = [
{
down: true,
left: true,
right: true,
up: true,
},
{
down: false,
left: false,
Expand Down Expand Up @@ -78,6 +72,12 @@ const decodedData = [
right: false,
up: false,
},
{
down: true,
left: true,
right: true,
up: true,
},
{
down: false,
left: false,
Expand Down
16 changes: 8 additions & 8 deletions sdk/commands/enabled-sensors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ interface EnabeledSensorSet {

/** sensors enabled, with two panels packed into a single byte */
export const twoEnabledSensors_t = bits(uint8_t, {
up0: 0,
right0: 1,
down0: 2,
left0: 3,
up1: 4,
right1: 5,
down1: 6,
left1: 7,
up0: 7,
right0: 6,
down0: 5,
left0: 4,
up1: 3,
right1: 2,
down1: 1,
left1: 0,
});

/** splits packed */
Expand Down

0 comments on commit 2972b66

Please sign in to comment.