Skip to content

Commit ad8b1f1

Browse files
committed
Resolved filter problem
1 parent 6a08d2d commit ad8b1f1

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/components/Connection.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@ const Connection: React.FC<ConnectionProps> = ({
114114
const existingRecordRef = useRef<any | undefined>(undefined);
115115
const devicenameref = useRef<string>("");
116116
const [deviceReady, setDeviceReady] = useState(false);
117+
const sampingrateref = useRef<number>(0);
118+
117119

118120
// UI Themes & Modes
119121
const { theme } = useTheme(); // Current theme of the app
@@ -540,6 +542,7 @@ const Connection: React.FC<ConnectionProps> = ({
540542

541543
if (sampling_rate) {
542544
setCurrentSamplingRate(sampling_rate);
545+
sampingrateref.current=sampling_rate;
543546
}
544547

545548
return {
@@ -891,10 +894,10 @@ const Connection: React.FC<ConnectionProps> = ({
891894
const notchFilters = Array.from({ length: maxCanvasElementCountRef.current }, () => new Notch());
892895
const EXGFilters = Array.from({ length: maxCanvasElementCountRef.current }, () => new EXGFilter());
893896
notchFilters.forEach((filter) => {
894-
filter.setbits(currentSamplingRate); // Set the bits value for all instances
897+
filter.setbits(sampingrateref.current); // Set the bits value for all instances
895898
});
896899
EXGFilters.forEach((filter) => {
897-
filter.setbits(detectedBitsRef.current.toString(),currentSamplingRate); // Set the bits value for all instances
900+
filter.setbits(detectedBitsRef.current.toString(),sampingrateref.current); // Set the bits value for all instances
898901
});
899902
try {
900903
while (isDeviceConnectedRef.current) {

0 commit comments

Comments
 (0)