Fix some build issues
All checks were successful
Build project / Build (push) Successful in 4m7s

Signed-off-by: Slendi <slendi@socopon.com>
This commit is contained in:
2026-03-28 15:43:04 +02:00
parent 54538dcd2a
commit 728fc08c70
5 changed files with 33 additions and 140 deletions

BIN
src/assets/Ubuntu-B.ttf Normal file

Binary file not shown.

View File

@@ -170,18 +170,23 @@ struct SingerApp {
tx: Sender<SerialCommand>,
rx: Receiver<SerialStatus>,
connected: Option<String>,
font: Font,
}
impl SingerApp {
pub fn new() -> Self {
pub fn new(gfx: &mut Graphics) -> Self {
let (tx_cmd, rx_cmd) = mpsc::channel();
let (tx_status, rx_status) = mpsc::channel();
Self::spawn_serial_worker(rx_cmd, tx_status);
let font = gfx
.create_font(include_bytes!("assets/Ubuntu-B.ttf"))
.expect("failed to load embedded font");
Self {
song_state: None,
tx: tx_cmd,
rx: rx_status,
connected: None,
font,
}
}
@@ -261,12 +266,21 @@ impl SingerApp {
};
draw.rect((14.0, 14.0), (20.0, 20.0)).color(status_color);
let status_text = match &self.connected {
Some(name) => format!("Serial connected: {name}"),
None => "Serial disconnected".to_string(),
};
draw.text(&self.font, &status_text)
.position(44.0, 30.0)
.size(22.0)
.color(Color::BLACK);
gfx.render(&draw);
}
}
fn setup(_gfx: &mut Graphics) -> SingerApp {
SingerApp::new()
fn setup(gfx: &mut Graphics) -> SingerApp {
SingerApp::new(gfx)
}
fn update(_app: &mut notan::app::App, state: &mut SingerApp) {