Delete main.rs
This commit is contained in:
45
src/main.rs
45
src/main.rs
@@ -1,45 +0,0 @@
|
|||||||
use anyhow::Result;
|
|
||||||
use m::vfd::VfdConfig;
|
|
||||||
use m::worker::VfdWorker;
|
|
||||||
use std::time::Duration;
|
|
||||||
|
|
||||||
fn main() -> Result<()> {
|
|
||||||
let port_name = std::env::args()
|
|
||||||
.nth(1)
|
|
||||||
.unwrap_or("/dev/cu.usbmodem101".into());
|
|
||||||
let width: usize = std::env::args()
|
|
||||||
.nth(2)
|
|
||||||
.as_deref()
|
|
||||||
.unwrap_or("20")
|
|
||||||
.parse()
|
|
||||||
.unwrap_or(20);
|
|
||||||
|
|
||||||
let cfg = VfdConfig::new(port_name).with_width(width);
|
|
||||||
let worker = VfdWorker::start(cfg)?;
|
|
||||||
let vfd = worker.handle();
|
|
||||||
|
|
||||||
// === бизнес-логика (демо) ===
|
|
||||||
vfd.clear();
|
|
||||||
vfd.set_brightness(0);
|
|
||||||
|
|
||||||
vfd.set_marquee_text(" Вставай самурай, у нас город в огне! Пора на работу!");
|
|
||||||
vfd.start_marquee(1, 8, Duration::from_millis(1500));
|
|
||||||
|
|
||||||
{
|
|
||||||
std::thread::sleep(Duration::from_millis(800));
|
|
||||||
vfd.set_brightness(1);
|
|
||||||
std::thread::sleep(Duration::from_millis(800));
|
|
||||||
vfd.set_brightness(2);
|
|
||||||
std::thread::sleep(Duration::from_millis(800));
|
|
||||||
vfd.set_brightness(3);
|
|
||||||
std::thread::sleep(Duration::from_millis(800));
|
|
||||||
vfd.set_brightness(4);
|
|
||||||
}
|
|
||||||
// останавливаем
|
|
||||||
std::thread::sleep(Duration::from_secs(30));
|
|
||||||
vfd.stop_marquee();
|
|
||||||
|
|
||||||
// graceful shutdown (или просто выйти — Drop у VfdWorker сделает shutdown+join)
|
|
||||||
vfd.shutdown();
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user