diff --git a/package.json b/package.json index 3e9660c..50c6430 100644 --- a/package.json +++ b/package.json @@ -1,26 +1,26 @@ { - "name": "tauri-eval", - "private": true, - "version": "0.1.0", - "type": "module", - "scripts": { - "dev": "vite", - "build": "vue-tsc --noEmit && vite build", - "preview": "vite preview", - "tauri": "tauri" - }, - "dependencies": { - "@tauri-apps/api": "^2.1.1", - "@tauri-apps/plugin-shell": "^2.0.1", - "chart.js": "^4.4.4", - "vue": "^3.3.4", - "vue-chartjs": "^5.3.1" - }, - "devDependencies": { - "@tauri-apps/cli": "^2.1.0", - "@vitejs/plugin-vue": "^5.0.5", - "typescript": "^5.2.2", - "vite": "^5.3.1", - "vue-tsc": "^2.0.22" - } + "name": "IELET3109 Heart Rate Monitor", + "private": true, + "version": "0.1.0", + "type": "module", + "scripts": { + "dev": "vite", + "build": "vue-tsc --noEmit && vite build", + "preview": "vite preview", + "tauri": "tauri" + }, + "dependencies": { + "@tauri-apps/api": "^2.1.1", + "@tauri-apps/plugin-shell": "^2.0.1", + "chart.js": "^4.4.4", + "vue": "^3.3.4", + "vue-chartjs": "^5.3.1" + }, + "devDependencies": { + "@tauri-apps/cli": "^2.1.0", + "@vitejs/plugin-vue": "^5.0.5", + "typescript": "^5.2.2", + "vite": "^5.3.1", + "vue-tsc": "^2.0.22" + } } diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index 37f8d5e..ee865a5 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -92,7 +92,7 @@ fn create_data_listener(websockets_uri: String, data: Arc>>) .collect(); ecg_data.push(ECGData { - value: -voltage, + value: voltage, timestamp: Utc::now(), }); @@ -114,7 +114,8 @@ fn calculate_heartrate(data: State<'_, Arc>>>) -> Result = data.into_iter().map(|entry| entry.value).collect(); 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.); Ok(peak_finder.find_peaks().len()) @@ -139,8 +140,8 @@ async fn main() { let ecg_data: Arc>> = Arc::new(Mutex::new(Vec::with_capacity(2 ^ 13))); // Create the websockets listener - //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.128.50:81".to_string(), ecg_data.clone()); + //create_data_listener("ws://192.168.66.210:81".to_string(), ecg_data.clone()); tauri::Builder::default() .plugin(tauri_plugin_shell::init()) diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 87d892c..7b842f1 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -1,37 +1,37 @@ { - "build": { - "beforeDevCommand": "npm run dev", - "beforeBuildCommand": "npm run build", - "frontendDist": "../dist", - "devUrl": "http://localhost:1420" - }, - "bundle": { - "active": true, - "targets": "all", - "icon": [ - "icons/32x32.png", - "icons/128x128.png", - "icons/128x128@2x.png", - "icons/icon.icns", - "icons/icon.ico" - ] - }, - "productName": "tauri-eval", - "mainBinaryName": "tauri-eval", - "version": "0.1.0", - "identifier": "com.tauri-eval.app", - "plugins": {}, - "app": { - "security": { - "csp": null - }, - "windows": [ - { - "title": "tauri-eval", - "width": 800, - "height": 600, - "useHttpsScheme": true - } - ] - } -} \ No newline at end of file + "build": { + "beforeDevCommand": "npm run dev", + "beforeBuildCommand": "npm run build", + "frontendDist": "../dist", + "devUrl": "http://localhost:1420" + }, + "bundle": { + "active": true, + "targets": "all", + "icon": [ + "icons/32x32.png", + "icons/128x128.png", + "icons/128x128@2x.png", + "icons/icon.icns", + "icons/icon.ico" + ] + }, + "productName": "tauri-eval", + "mainBinaryName": "tauri-eval", + "version": "0.1.0", + "identifier": "com.tauri-eval.app", + "plugins": {}, + "app": { + "security": { + "csp": null + }, + "windows": [ + { + "title": "IELET3109 Heart Rate Monitor", + "width": 800, + "height": 600, + "useHttpsScheme": true + } + ] + } +}