Compare commits

...

16 Commits

Author SHA1 Message Date
17a3b82d5c Update toos-dashboard/src-tauri/src/animation.rs
All checks were successful
publish / publish-tauri (ubuntu-20.04) (push) Successful in 4m18s
2023-10-28 08:43:55 +02:00
8c087f452e Update toos-dashboard/src-tauri/src/animation.rs
All checks were successful
publish / publish-tauri (ubuntu-20.04) (push) Successful in 4m16s
2023-10-27 20:49:37 +02:00
23431457b7 Update toos-dashboard/src-tauri/src/animation.rs
All checks were successful
publish / publish-tauri (ubuntu-20.04) (push) Successful in 4m16s
2023-10-27 20:39:31 +02:00
3f6ea3a2f1 Changed localhost to 127.0.0.1
All checks were successful
publish / publish-tauri (ubuntu-20.04) (push) Successful in 4m29s
2023-10-27 15:11:20 +02:00
ef0c80d099 merge
All checks were successful
publish / publish-tauri (ubuntu-20.04) (push) Successful in 4m21s
2023-10-27 15:03:38 +02:00
6af55a17bf Merge branch 'main' of https://gitea.xeovalyte.dev/xeovalyte/toos-halloween 2023-10-27 15:03:04 +02:00
1a760adcfd Update .gitea/workflows/workflow.yml
All checks were successful
publish / publish-tauri (ubuntu-20.04) (push) Successful in 4m37s
2023-10-27 14:22:38 +02:00
ff7f0f2e96 Update .gitea/workflows/workflow.yml
All checks were successful
publish / publish-tauri (ubuntu-20.04) (push) Successful in 4m17s
2023-10-27 14:04:28 +02:00
b13e97ba6a Update .gitea/workflows/workflow.yml
All checks were successful
publish / publish-tauri (ubuntu-20.04) (push) Successful in 3m59s
2023-10-27 13:22:23 +02:00
3c2053dc85 Update .gitea/workflows/workflow.yml
All checks were successful
publish / publish-tauri (ubuntu-20.04) (push) Successful in 4m6s
2023-10-27 13:16:43 +02:00
13b669ce22 Update .gitea/workflows/workflow.yml
Some checks failed
publish / publish-tauri (ubuntu-20.04) (push) Failing after 4m18s
2023-10-27 13:02:08 +02:00
5ed82d0fca Update .gitea/workflows/workflow.yml
Some checks failed
publish / publish-tauri (ubuntu-20.04) (push) Failing after 3m55s
2023-10-27 12:52:02 +02:00
d713becd68 Update .gitea/workflows/workflow.yml 2023-10-27 12:51:45 +02:00
9670bed8e8 Update .gitea/workflows/workflow.yml
All checks were successful
publish / publish-tauri (ubuntu-20.04) (push) Successful in 4m3s
2023-10-27 12:45:30 +02:00
ce09220708 Update .gitea/workflows/workflow.yml
Some checks failed
publish / publish-tauri (ubuntu-20.04) (push) Failing after 1m36s
2023-10-27 10:40:29 +02:00
422f4c68c6 feat: Added relative audio path 2023-10-27 10:34:47 +02:00
5 changed files with 30 additions and 12 deletions

View File

@@ -28,13 +28,10 @@ jobs:
- name: install frontend dependencies - name: install frontend dependencies
run: npm install # change this to npm or pnpm depending on which one you use run: npm install # change this to npm or pnpm depending on which one you use
working-directory: ./toos-dashboard working-directory: ./toos-dashboard
- uses: tauri-apps/tauri-action@v0 - run: npm run tauri build
working-directory: ./toos-dashboard working-directory: ./toos-dashboard
env: - uses: actions/upload-artifact@v3
GITHUB_TOKEN: ${{ secrets.TOKEN }}
with: with:
tagName: app-v__VERSION__ # the action automatically replaces \_\_VERSION\_\_ with the app version name: toos-dashboard.AppImage
releaseName: 'App v__VERSION__' path: toos-dashboard/src-tauri/target/release/bundle/appimage/*.AppImage
releaseBody: 'See the assets to download this version and install.'
releaseDraft: true
prerelease: false

View File

@@ -13,7 +13,7 @@ edition = "2021"
tauri-build = { version = "1.5", features = [] } tauri-build = { version = "1.5", features = [] }
[dependencies] [dependencies]
tauri = { version = "1.5", features = [ "dialog-all", "shell-open"] } tauri = { version = "1.5", features = ["dialog-all", "shell-open"] }
serde = { version = "1.0", features = ["derive"] } serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0" serde_json = "1.0"
serialport = "4.2.2" serialport = "4.2.2"

View File

@@ -5,6 +5,7 @@ use std::io::BufReader;
use rodio::{Decoder, OutputStream, Sink}; use rodio::{Decoder, OutputStream, Sink};
use std::sync::Mutex; use std::sync::Mutex;
use once_cell::sync::Lazy; use once_cell::sync::Lazy;
use std::path::{Path, PathBuf};
use crate::serial; use crate::serial;
@@ -16,6 +17,7 @@ struct Timings {
static TIMINGS: Mutex<Lazy<Timings>> = Mutex::new(Lazy::new(|| Timings { charging_start_delay: 1600, charging_delay: 450, charging_end_delay: 400 } )); static TIMINGS: Mutex<Lazy<Timings>> = Mutex::new(Lazy::new(|| Timings { charging_start_delay: 1600, charging_delay: 450, charging_end_delay: 400 } ));
static PLAYING: Mutex<bool> = Mutex::new(false); static PLAYING: Mutex<bool> = Mutex::new(false);
pub static AUDIO_PATH: Mutex<Lazy<PathBuf>> = Mutex::new(Lazy::new(|| Path::new("assets/audio.mp3").to_path_buf()));
#[tauri::command] #[tauri::command]
pub fn start() { pub fn start() {
@@ -31,7 +33,7 @@ pub fn start() {
play_sound(); play_sound();
thread::sleep(Duration::from_millis(500)); thread::sleep(Duration::from_millis(800));
let _ = serial::write_serial(format!("SET_LIGHT:0;").as_str()); let _ = serial::write_serial(format!("SET_LIGHT:0;").as_str());
stage_one(); stage_one();
@@ -47,7 +49,9 @@ fn play_sound() {
let (_stream, stream_handle) = OutputStream::try_default().unwrap(); let (_stream, stream_handle) = OutputStream::try_default().unwrap();
let sink = Sink::try_new(&stream_handle).unwrap(); let sink = Sink::try_new(&stream_handle).unwrap();
let file = BufReader::new(File::open("assets/audio.mp3").unwrap()); let path = AUDIO_PATH.lock().unwrap();
let file = BufReader::new(File::open(&**path).unwrap());
let source = Decoder::new(file).unwrap(); let source = Decoder::new(file).unwrap();
sink.append(source); sink.append(source);
@@ -118,4 +122,7 @@ fn stage_two() {
thread::sleep(Duration::from_millis(200)); thread::sleep(Duration::from_millis(200));
let _ = serial::write_serial(format!("SET_LED_OFF;").as_str()); let _ = serial::write_serial(format!("SET_LED_OFF;").as_str());
let _ = serial::write_serial(format!("SET_STRIP_COLOR:0,0,0;").as_str()); let _ = serial::write_serial(format!("SET_STRIP_COLOR:0,0,0;").as_str());
thread::sleep(Duration::from_millis(1000));
let _ = serial::write_serial(format!("SET_LIGHT:255;").as_str());
} }

View File

@@ -7,6 +7,17 @@ mod animation;
fn main() { fn main() {
tauri::Builder::default() tauri::Builder::default()
.invoke_handler(tauri::generate_handler![serial::get_serial_ports, serial::write_serial, serial::open_port, serial::close_port, animation::start]) .invoke_handler(tauri::generate_handler![serial::get_serial_ports, serial::write_serial, serial::open_port, serial::close_port, animation::start])
.setup(|app| {
let resource_path = app.path_resolver()
.resolve_resource("assets/audio.mp3")
.expect("failed to resolve resource");
let mut audio_path = animation::AUDIO_PATH.lock().unwrap();
**audio_path = resource_path;
Ok(())
})
.run(tauri::generate_context!()) .run(tauri::generate_context!())
.expect("error while running tauri application"); .expect("error while running tauri application");
} }

View File

@@ -2,7 +2,7 @@
"build": { "build": {
"beforeDevCommand": "npm run dev", "beforeDevCommand": "npm run dev",
"beforeBuildCommand": "npm run build", "beforeBuildCommand": "npm run build",
"devPath": "http://localhost:1420", "devPath": "http://127.0.0.1:1420",
"distDir": "../dist", "distDir": "../dist",
"withGlobalTauri": false "withGlobalTauri": false
}, },
@@ -31,6 +31,9 @@
"icons/128x128@2x.png", "icons/128x128@2x.png",
"icons/icon.icns", "icons/icon.icns",
"icons/icon.ico" "icons/icon.ico"
],
"resources": [
"assets/audio.mp3"
] ]
}, },
"security": { "security": {