diff --git a/client/package-lock.json b/client/package-lock.json index 4dd040a..26b404d 100644 --- a/client/package-lock.json +++ b/client/package-lock.json @@ -19,7 +19,6 @@ "overlayscrollbars-svelte": "^0.5.3", "socket.io-client": "^4.7.4", "svelte-french-toast": "^1.2.0", - "svelte-tweakpane-ui": "^1.2.1", "three": "^0.161.0" }, "devDependencies": { @@ -1052,11 +1051,6 @@ "integrity": "sha512-BRbo1fOtyVbhfLyuCWw6wAWp+U8UQle+ZXu84MYYWzYSEB28dyfnRBIE99eoG+qdAC0po6L2ScIEivcT07UaMA==", "dev": true }, - "node_modules/@tweakpane/core": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/@tweakpane/core/-/core-2.0.3.tgz", - "integrity": "sha512-qHci4XA1Wngpwy8IzsLh5JEdscz8aDti/9YhyOaq01si+cgNDaZfwzTtXdn1+xTxSnCM+pW4Zb2/4eqn+K1ATw==" - }, "node_modules/@types/cookie": { "version": "0.6.0", "resolved": "https://registry.npmjs.org/@types/cookie/-/cookie-0.6.0.tgz", @@ -1622,7 +1616,9 @@ "node_modules/esm-env": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/esm-env/-/esm-env-1.0.0.tgz", - "integrity": "sha512-Cf6VksWPsTuW01vU9Mk/3vRue91Zevka5SjyNf3nEpokFRuqt/KjUQoGAwq9qMmhpLTHmXzSIrFRw8zxWzmFBA==" + "integrity": "sha512-Cf6VksWPsTuW01vU9Mk/3vRue91Zevka5SjyNf3nEpokFRuqt/KjUQoGAwq9qMmhpLTHmXzSIrFRw8zxWzmFBA==", + "dev": true, + "peer": true }, "node_modules/estree-walker": { "version": "3.0.3", @@ -1632,19 +1628,6 @@ "@types/estree": "^1.0.0" } }, - "node_modules/fast-copy": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/fast-copy/-/fast-copy-3.0.1.tgz", - "integrity": "sha512-Knr7NOtK3HWRYGtHoJrjkaWepqT8thIVGAwt0p0aUs1zqkAzXZV4vo9fFNwyb5fcqK1GKYFYxldQdIDVKhUAfA==" - }, - "node_modules/fast-equals": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/fast-equals/-/fast-equals-5.0.1.tgz", - "integrity": "sha512-WF1Wi8PwwSY7/6Kx0vKXtw8RwuSGoM1bvDaJbu7MxDlR1vovZjIAKrnzyrThgAjm6JDTu0fVgWXDlMGspodfoQ==", - "engines": { - "node": ">=6.0.0" - } - }, "node_modules/fast-glob": { "version": "3.3.2", "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.2.tgz", @@ -3013,17 +2996,6 @@ "svelte": "^3.19.0 || ^4.0.0" } }, - "node_modules/svelte-local-storage-store": { - "version": "0.6.4", - "resolved": "https://registry.npmjs.org/svelte-local-storage-store/-/svelte-local-storage-store-0.6.4.tgz", - "integrity": "sha512-45WoY2vSGPQM1sIQJ9jTkPPj20hYeqm+af6mUGRFSPP5WglZf36YYoZqwmZZ8Dt/2SU8lem+BTA8/Z/8TkqNLg==", - "engines": { - "node": ">=0.14" - }, - "peerDependencies": { - "svelte": "^3.48.0 || >4.0.0" - } - }, "node_modules/svelte-preprocess": { "version": "5.1.3", "resolved": "https://registry.npmjs.org/svelte-preprocess/-/svelte-preprocess-5.1.3.tgz", @@ -3087,115 +3059,6 @@ } } }, - "node_modules/svelte-tweakpane-ui": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/svelte-tweakpane-ui/-/svelte-tweakpane-ui-1.2.1.tgz", - "integrity": "sha512-F62AFvZiqhXa0E3HMpUdmdWWyus/C+nTBFrFd/vEhHP6dYOQ4EN9qwvjdybL90DZFTIwkZe3w4oSbEGn1muKkQ==", - "dependencies": { - "@0b5vr/tweakpane-plugin-profiler": "^0.4.1", - "@0b5vr/tweakpane-plugin-rotation": "^0.2.0", - "@kitschpatrol/tweakpane-image-plugin": "^2.0.0", - "@pangenerator/tweakpane-textarea-plugin": "^2.0.0", - "@tweakpane/core": "^2.0.3", - "@tweakpane/plugin-camerakit": "^0.3.0", - "@tweakpane/plugin-essentials": "^0.2.1", - "esm-env": "^1.0.0", - "fast-copy": "^3.0.1", - "fast-equals": "^5.0.1", - "nanoid": "^5.0.6", - "svelte-local-storage-store": "^0.6.4", - "tweakpane": "^4.0.3", - "tweakpane-plugin-waveform": "^1.0.0" - }, - "engines": { - "node": ">=18.0.0", - "pnpm": ">=8.0.0" - }, - "peerDependencies": { - "svelte": "^4.0.0" - } - }, - "node_modules/svelte-tweakpane-ui/node_modules/@0b5vr/tweakpane-plugin-profiler": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/@0b5vr/tweakpane-plugin-profiler/-/tweakpane-plugin-profiler-0.4.1.tgz", - "integrity": "sha512-jgkPbT24eQ7isj8F7/IsbdqrwvBoWBmwjqxdP35smD2D6xsx+9viR57SKBxi9PxTZDEayicmCzBk++0PTqRnBg==", - "peerDependencies": { - "tweakpane": "^4.0.0" - } - }, - "node_modules/svelte-tweakpane-ui/node_modules/@0b5vr/tweakpane-plugin-rotation": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/@0b5vr/tweakpane-plugin-rotation/-/tweakpane-plugin-rotation-0.2.0.tgz", - "integrity": "sha512-LK+84kNTusEepVwiKH6ib/Pd+5RxI3UC4rHxn5c14GO58QS49Hh0ft3hFXt/NDzYEST17Q9qg96BcpclhCzYYQ==", - "peerDependencies": { - "tweakpane": "^4.0.0" - } - }, - "node_modules/svelte-tweakpane-ui/node_modules/@kitschpatrol/tweakpane-image-plugin": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@kitschpatrol/tweakpane-image-plugin/-/tweakpane-image-plugin-2.0.0.tgz", - "integrity": "sha512-BzEZqIhD/dM7AW0Ebv+309L4k8ZZJ5fC9Zks4sozVK3FwJooviE6JzaFAuB7k0M5oX45Wyn59tQXdHafgsP3YA==", - "peerDependencies": { - "tweakpane": "^4.0.0" - } - }, - "node_modules/svelte-tweakpane-ui/node_modules/@pangenerator/tweakpane-textarea-plugin": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@pangenerator/tweakpane-textarea-plugin/-/tweakpane-textarea-plugin-2.0.0.tgz", - "integrity": "sha512-BERPuuyJYWvtJzXh4wtgYspza0ihigE2m4qs57ERKtWG59+lI2t/2TOXlwz7Xyx/QEIH25uO1g732YCljgKaUw==", - "peerDependencies": { - "tweakpane": "^4.0.0" - } - }, - "node_modules/svelte-tweakpane-ui/node_modules/@tweakpane/plugin-camerakit": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/@tweakpane/plugin-camerakit/-/plugin-camerakit-0.3.0.tgz", - "integrity": "sha512-6UwgwDKU+oaAgXJ2D/pOoIpEAZts0RyeLmVzBJGs+VVNqSfkiHzL0i5XD+XnmSL2PaLXBne0dlz0bYOrjmeELw==", - "peerDependencies": { - "tweakpane": "^4.0.0-beta.2" - } - }, - "node_modules/svelte-tweakpane-ui/node_modules/@tweakpane/plugin-essentials": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/@tweakpane/plugin-essentials/-/plugin-essentials-0.2.1.tgz", - "integrity": "sha512-VbFU1/uD+CJNFQdfLXUOLjeG5HyUZH97Ox9CxmyVetg1hqjVun3C83HAGFULyhKzl8tSgii8jr304r8QpdHwzQ==", - "peerDependencies": { - "tweakpane": "^4.0.0" - } - }, - "node_modules/svelte-tweakpane-ui/node_modules/nanoid": { - "version": "5.0.6", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-5.0.6.tgz", - "integrity": "sha512-rRq0eMHoGZxlvaFOUdK1Ev83Bd1IgzzR+WJ3IbDJ7QOSdAxYjlurSPqFs9s4lJg29RT6nPwizFtJhQS6V5xgiA==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "bin": { - "nanoid": "bin/nanoid.js" - }, - "engines": { - "node": "^18 || >=20" - } - }, - "node_modules/svelte-tweakpane-ui/node_modules/tweakpane": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/tweakpane/-/tweakpane-4.0.3.tgz", - "integrity": "sha512-BlcWOAe8oe4c+k9pmLBARGdWB6MVZMszayekkixQXTgkxTaYoTUpHpwVEp+3HkoamZkomodpbBf0CkguIHTgLg==", - "funding": { - "url": "https://github.com/sponsors/cocopon" - } - }, - "node_modules/svelte-tweakpane-ui/node_modules/tweakpane-plugin-waveform": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/tweakpane-plugin-waveform/-/tweakpane-plugin-waveform-1.0.0.tgz", - "integrity": "sha512-fyTRe6Emt7YpgHC5iiTZgk6RHflNm5VIOAsl2+l3mm96+KE8I+7sNPeyADxKcfcQF23c7/R3La5WNhaHNyeJag==", - "peerDependencies": { - "tweakpane": "^4.0.0" - } - }, "node_modules/svelte-writable-derived": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/svelte-writable-derived/-/svelte-writable-derived-3.1.0.tgz", diff --git a/client/package.json b/client/package.json index 35f83e5..4b054fa 100644 --- a/client/package.json +++ b/client/package.json @@ -39,7 +39,6 @@ "overlayscrollbars-svelte": "^0.5.3", "socket.io-client": "^4.7.4", "svelte-french-toast": "^1.2.0", - "svelte-tweakpane-ui": "^1.2.1", "three": "^0.161.0" } } diff --git a/client/src-tauri/src/telemetry.rs b/client/src-tauri/src/telemetry.rs index e38c9d3..3be2175 100644 --- a/client/src-tauri/src/telemetry.rs +++ b/client/src-tauri/src/telemetry.rs @@ -9,64 +9,67 @@ const NTABLE_IP: (u8, u8, u8, u8) = (10, 12, 80, 2); const NTABLE_PORT: u16 = 5810; pub async fn subscribe_topics(app_handle: AppHandle) { - let client = loop { - match Client::try_new_w_config( - SocketAddrV4::new( - Ipv4Addr::new(NTABLE_IP.0, NTABLE_IP.1, NTABLE_IP.2, NTABLE_IP.3), - NTABLE_PORT, - ), - Config { - ..Default::default() - }, - ) - .await - { - Ok(client) => { - println!("Client created"); - app_handle - .emit_all("telemetry_connected", "connected") - .expect("Failed to emit telemetry_status connected event"); - break client; // Exit the loop if the client is successfully created - } - Err(e) => { - println!("Failed to create client: {}. Retrying in 3 seconds...", e); - app_handle - .emit_all("telemetry_status", "disconnected") - .expect("Failed to emit telemetry_status disconnected event"); + loop { + // I hope this doesn't lead to a catastrophic infinite loop failure + let client = loop { + match Client::try_new_w_config( + SocketAddrV4::new( + Ipv4Addr::new(NTABLE_IP.0, NTABLE_IP.1, NTABLE_IP.2, NTABLE_IP.3), + NTABLE_PORT, + ), + Config { + ..Default::default() + }, + ) + .await + { + Ok(client) => { + println!("Client created"); + app_handle + .emit_all("telemetry_connected", "connected") + .expect("Failed to emit telemetry_status connected event"); + break client; // Exit the loop if the client is successfully created + } + Err(e) => { + println!("Failed to create client: {}. Retrying in 3 seconds...", e); + app_handle + .emit_all("telemetry_status", "disconnected") + .expect("Failed to emit telemetry_status disconnected event"); - sleep(Duration::from_secs(3)).await; // Wait for 3 seconds before retrying - continue; // Continue the loop to retry - } + sleep(Duration::from_secs(3)).await; // Wait for 3 seconds before retrying + continue; // Continue the loop to retry + } + }; }; - }; - let mut subscription = client - .subscribe_w_options( - &["/SmartDashboard"], - Some(SubscriptionOptions { - all: Some(true), - prefix: Some(true), - ..Default::default() - }), - ) - .await - .expect("Failed to subscribe"); - while let Some(message) = subscription.next().await { - let mut modified_message = message.clone(); + let mut subscription = client + .subscribe_w_options( + &["/SmartDashboard"], + Some(SubscriptionOptions { + all: Some(true), + prefix: Some(true), + ..Default::default() + }), + ) + .await + .expect("Failed to subscribe"); + while let Some(message) = subscription.next().await { + let mut modified_message = message.clone(); - if let Some(stripped) = modified_message.topic_name.strip_prefix("/SmartDashboard/") { - modified_message.topic_name = stripped.to_string(); + if let Some(stripped) = modified_message.topic_name.strip_prefix("/SmartDashboard/") { + modified_message.topic_name = stripped.to_string(); + } + + let json_message = to_string(&modified_message).expect("Failed to serialize message"); + app_handle + .emit_all("telemetry_data", json_message.clone()) + .expect("Failed to send telemetry message"); + + println!("{}", json_message); } - - let json_message = to_string(&modified_message).expect("Failed to serialize message"); + println!("disconnected"); app_handle - .emit_all("telemetry_data", json_message.clone()) - .expect("Failed to send telemetry message"); - - println!("{}", json_message); + .emit_all("telemetry_status", "disconnected") + .expect("Failed to emit telemetry_disconnected event"); } - println!("disconnected"); - app_handle - .emit_all("telemetry_status", "disconnected") - .expect("Failed to emit telemetry_disconnected event"); } diff --git a/client/src/lib/Apps/DevTools/DevTools.svelte b/client/src/lib/Apps/DevTools/DevTools.svelte index 916b6df..6ee8aec 100644 --- a/client/src/lib/Apps/DevTools/DevTools.svelte +++ b/client/src/lib/Apps/DevTools/DevTools.svelte @@ -1,4 +1,5 @@ Simulate random motion - +