Compare commits
16 Commits
078683b5b2
...
main
Author | SHA1 | Date | |
---|---|---|---|
17a3b82d5c | |||
8c087f452e | |||
23431457b7 | |||
3f6ea3a2f1 | |||
ef0c80d099 | |||
6af55a17bf | |||
1a760adcfd | |||
ff7f0f2e96 | |||
b13e97ba6a | |||
3c2053dc85 | |||
13b669ce22 | |||
5ed82d0fca | |||
d713becd68 | |||
9670bed8e8 | |||
ce09220708 | |||
422f4c68c6 |
@@ -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
|
|
@@ -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"
|
||||||
|
@@ -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());
|
||||||
}
|
}
|
||||||
|
@@ -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");
|
||||||
}
|
}
|
||||||
|
@@ -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": {
|
||||||
|
Reference in New Issue
Block a user