Skip to content

Commit

Permalink
Update Indexeddb
Browse files Browse the repository at this point in the history
  • Loading branch information
Amanmahe committed Dec 9, 2024
1 parent 067b1f7 commit 4effee7
Show file tree
Hide file tree
Showing 3 changed files with 587 additions and 534 deletions.
8 changes: 4 additions & 4 deletions src/components/Canvas.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,14 @@ const Canvas = forwardRef(
if (previousCounter !== null) {
// If there was a previous counter value
const expectedCounter: number = (previousCounter + 1) % 256; // Calculate the expected counter value
if (data[6] !== expectedCounter) {
if (data[0] !== expectedCounter) {
// Check for data loss by comparing the current counter with the expected counter
console.warn(
`Data loss detected in canvas! Previous counter: ${previousCounter}, Current counter: ${data[6]}`
`Data loss detected in canvas! Previous counter: ${previousCounter}, Current counter: ${data[0]}`
);
}
}
previousCounter = data[6]; // Update the previous counter with the current counter
previousCounter = data[0]; // Update the previous counter with the current counter
},
}),
[Zoom, numChannels]
Expand Down Expand Up @@ -240,7 +240,7 @@ const Canvas = forwardRef(
linesRef.current.forEach((line, i) => {
const bitsPoints = Math.pow(2, getValue(selectedBits)); // Adjust according to your ADC resolution
const yScale = 2 / bitsPoints;
const chData = (data[i] - bitsPoints / 2) * yScale;
const chData = (data[i+1] - bitsPoints / 2) * yScale;

// Use a separate sweep position for each line
currentSweepPos.current[i] = sweepPositions.current[i];
Expand Down
Loading

0 comments on commit 4effee7

Please sign in to comment.