Skip to content

Commit

Permalink
makes vac sensor test properly handle inverted bit
Browse files Browse the repository at this point in the history
  • Loading branch information
sphawes committed May 20, 2024
1 parent 0e3b0be commit c5c7345
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions serialManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,11 @@ export class serialManager {
}

let leftVal = parseInt(msb+csb+lsb, 16);

if(leftVal & (1 << 23)){
leftVal = leftVal - 2**24
}

testDataBuffer = testDataBuffer.concat("Left Val - " + leftVal + "\n");

// NOW RIGHT SENSOR
Expand Down Expand Up @@ -590,6 +595,11 @@ export class serialManager {
}

let rightVal = parseInt(msb+csb+lsb, 16);

if(rightVal & (1 << 23)){
rightVal = rightVal - 2**24
}

testDataBuffer = testDataBuffer.concat("Right Val - " + rightVal + "\n");

console.log(leftVal, rightVal)
Expand Down

0 comments on commit c5c7345

Please sign in to comment.