Skip to content

Commit ab15bb6

Browse files
author
Ritika Mishra
committed
Merge branch 'main' of https://github.com/upsidedownlabs/Chords-Web into fft-plot
2 parents 079fd9e + ad0de19 commit ab15bb6

File tree

2 files changed

+10
-191
lines changed

2 files changed

+10
-191
lines changed

src/app/npg-lite/page.tsx

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ const NPG_Ble = () => {
412412
channelData = [];
413413
samplesReceived++;
414414
}, [
415-
canvasElementCountRef.current, selectedChannels,timeBase
415+
canvasElementCountRef.current, selectedChannels, timeBase
416416
]);
417417

418418
interface BluetoothRemoteGATTCharacteristicExtended extends EventTarget {
@@ -480,7 +480,7 @@ const NPG_Ble = () => {
480480

481481
async function disconnect(): Promise<void> {
482482
try {
483-
if (!connectedDeviceRef) {
483+
if (!connectedDeviceRef.current) {
484484
console.log("No connected device to disconnect.");
485485
return;
486486
}
@@ -521,7 +521,7 @@ const NPG_Ble = () => {
521521
}
522522
};
523523

524-
useEffect(() => {
524+
useEffect(() => {
525525
canvasElementCountRef.current = selectedChannels.length;
526526
}, [selectedChannels]);
527527

@@ -537,7 +537,10 @@ const NPG_Ble = () => {
537537
});
538538

539539
};
540-
setSelectedChannelsInWorker(selectedChannels)
540+
541+
useEffect(() => {
542+
setSelectedChannelsInWorker(selectedChannels);
543+
}, [selectedChannels]);
541544

542545
const processBuffer = async (bufferIndex: number, canvasCount: number, selectChannel: number[]) => {
543546
if (!workerRef.current) {
@@ -696,7 +699,7 @@ const NPG_Ble = () => {
696699
}
697700
};
698701
const stopRecording = async () => {
699-
if (!recordingStartTimeRef) {
702+
if (!recordingStartTimeRef.current) {
700703
toast.error("Recording start time was not captured.");
701704
return;
702705
}
@@ -867,7 +870,7 @@ const NPG_Ble = () => {
867870
sweepPositions.current[i] = (currentPos + 1) % line.numPoints;
868871
});
869872
},
870-
[linesRef, wglPlots, selectedChannelsRef, dataPointCountRef.current, sweepPositions, Zoom, zoomRef.current,timeBase]
873+
[linesRef, wglPlots, selectedChannelsRef, dataPointCountRef.current, sweepPositions, Zoom, zoomRef.current, timeBase]
871874
);
872875

873876
useEffect(() => {
@@ -886,7 +889,7 @@ const NPG_Ble = () => {
886889
wglPlots.forEach((wglp) => wglp.update());
887890
requestAnimationFrame(animate); // Continue the animation loop
888891
}
889-
}, [dataPointCountRef.current, wglPlots, Zoom, pauseRef.current,timeBase]);
892+
}, [wglPlots, pauseRef.current]);
890893

891894

892895
useEffect(() => {

src/components/serialConnection.tsx

Lines changed: 0 additions & 184 deletions
This file was deleted.

0 commit comments

Comments
 (0)