Update peak detection
This commit is contained in:
parent
898c11a67b
commit
c205f1f827
48
package.json
48
package.json
@ -1,26 +1,26 @@
|
|||||||
{
|
{
|
||||||
"name": "tauri-eval",
|
"name": "IELET3109 Heart Rate Monitor",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
"build": "vue-tsc --noEmit && vite build",
|
"build": "vue-tsc --noEmit && vite build",
|
||||||
"preview": "vite preview",
|
"preview": "vite preview",
|
||||||
"tauri": "tauri"
|
"tauri": "tauri"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@tauri-apps/api": "^2.1.1",
|
"@tauri-apps/api": "^2.1.1",
|
||||||
"@tauri-apps/plugin-shell": "^2.0.1",
|
"@tauri-apps/plugin-shell": "^2.0.1",
|
||||||
"chart.js": "^4.4.4",
|
"chart.js": "^4.4.4",
|
||||||
"vue": "^3.3.4",
|
"vue": "^3.3.4",
|
||||||
"vue-chartjs": "^5.3.1"
|
"vue-chartjs": "^5.3.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@tauri-apps/cli": "^2.1.0",
|
"@tauri-apps/cli": "^2.1.0",
|
||||||
"@vitejs/plugin-vue": "^5.0.5",
|
"@vitejs/plugin-vue": "^5.0.5",
|
||||||
"typescript": "^5.2.2",
|
"typescript": "^5.2.2",
|
||||||
"vite": "^5.3.1",
|
"vite": "^5.3.1",
|
||||||
"vue-tsc": "^2.0.22"
|
"vue-tsc": "^2.0.22"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -92,7 +92,7 @@ fn create_data_listener(websockets_uri: String, data: Arc<Mutex<Vec<ECGData>>>)
|
|||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
ecg_data.push(ECGData {
|
ecg_data.push(ECGData {
|
||||||
value: -voltage,
|
value: voltage,
|
||||||
timestamp: Utc::now(),
|
timestamp: Utc::now(),
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -114,7 +114,8 @@ fn calculate_heartrate(data: State<'_, Arc<Mutex<Vec<ECGData>>>>) -> Result<usiz
|
|||||||
let filtered_data: Vec<f32> = data.into_iter().map(|entry| entry.value).collect();
|
let filtered_data: Vec<f32> = data.into_iter().map(|entry| entry.value).collect();
|
||||||
|
|
||||||
let mut peak_finder = find_peaks::PeakFinder::new(&filtered_data);
|
let mut peak_finder = find_peaks::PeakFinder::new(&filtered_data);
|
||||||
peak_finder.with_min_prominence(1.);
|
peak_finder.with_min_prominence(0.5);
|
||||||
|
peak_finder.with_max_prominence(1.5);
|
||||||
//peak_finder.with_min_height(0.);
|
//peak_finder.with_min_height(0.);
|
||||||
|
|
||||||
Ok(peak_finder.find_peaks().len())
|
Ok(peak_finder.find_peaks().len())
|
||||||
@ -139,8 +140,8 @@ async fn main() {
|
|||||||
let ecg_data: Arc<Mutex<Vec<ECGData>>> = Arc::new(Mutex::new(Vec::with_capacity(2 ^ 13)));
|
let ecg_data: Arc<Mutex<Vec<ECGData>>> = Arc::new(Mutex::new(Vec::with_capacity(2 ^ 13)));
|
||||||
|
|
||||||
// Create the websockets listener
|
// Create the websockets listener
|
||||||
//create_data_listener("ws://192.168.128.50:81".to_string(), ecg_data.clone());
|
create_data_listener("ws://192.168.128.50:81".to_string(), ecg_data.clone());
|
||||||
create_data_listener("ws://192.168.66.210:81".to_string(), ecg_data.clone());
|
//create_data_listener("ws://192.168.66.210:81".to_string(), ecg_data.clone());
|
||||||
|
|
||||||
tauri::Builder::default()
|
tauri::Builder::default()
|
||||||
.plugin(tauri_plugin_shell::init())
|
.plugin(tauri_plugin_shell::init())
|
||||||
|
|||||||
@ -1,37 +1,37 @@
|
|||||||
{
|
{
|
||||||
"build": {
|
"build": {
|
||||||
"beforeDevCommand": "npm run dev",
|
"beforeDevCommand": "npm run dev",
|
||||||
"beforeBuildCommand": "npm run build",
|
"beforeBuildCommand": "npm run build",
|
||||||
"frontendDist": "../dist",
|
"frontendDist": "../dist",
|
||||||
"devUrl": "http://localhost:1420"
|
"devUrl": "http://localhost:1420"
|
||||||
},
|
},
|
||||||
"bundle": {
|
"bundle": {
|
||||||
"active": true,
|
"active": true,
|
||||||
"targets": "all",
|
"targets": "all",
|
||||||
"icon": [
|
"icon": [
|
||||||
"icons/32x32.png",
|
"icons/32x32.png",
|
||||||
"icons/128x128.png",
|
"icons/128x128.png",
|
||||||
"icons/128x128@2x.png",
|
"icons/128x128@2x.png",
|
||||||
"icons/icon.icns",
|
"icons/icon.icns",
|
||||||
"icons/icon.ico"
|
"icons/icon.ico"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"productName": "tauri-eval",
|
"productName": "tauri-eval",
|
||||||
"mainBinaryName": "tauri-eval",
|
"mainBinaryName": "tauri-eval",
|
||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"identifier": "com.tauri-eval.app",
|
"identifier": "com.tauri-eval.app",
|
||||||
"plugins": {},
|
"plugins": {},
|
||||||
"app": {
|
"app": {
|
||||||
"security": {
|
"security": {
|
||||||
"csp": null
|
"csp": null
|
||||||
},
|
},
|
||||||
"windows": [
|
"windows": [
|
||||||
{
|
{
|
||||||
"title": "tauri-eval",
|
"title": "IELET3109 Heart Rate Monitor",
|
||||||
"width": 800,
|
"width": 800,
|
||||||
"height": 600,
|
"height": 600,
|
||||||
"useHttpsScheme": true
|
"useHttpsScheme": true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user