Switched to using ufmt for formatting

This commit is contained in:
Sebastian 2022-08-24 17:45:38 +02:00
parent 275dea77e9
commit 4fb98ee9c5
4 changed files with 41 additions and 10 deletions

View file

@ -17,8 +17,8 @@ use embedded_graphics::{
text::Text,
};
use core::fmt::Write;
use heapless::String;
use ufmt::uwrite;
use ssd1306::{prelude::*, I2CDisplayInterface, Ssd1306};
@ -61,13 +61,13 @@ pub async fn display_task(
.unwrap();
let mut tmp: String<16> = String::new();
write!(tmp, "AZ: {}", rotor_state.actual_pos.az).unwrap();
uwrite!(tmp, "AZ: {}", rotor_state.actual_pos.az).unwrap();
Text::new(&tmp, Point::new(1, 17), text_large)
.draw(&mut display)
.unwrap();
tmp.clear();
write!(tmp, "EL: {}", rotor_state.actual_pos.el).unwrap();
uwrite!(tmp, "EL: {}", rotor_state.actual_pos.el).unwrap();
Text::new(&tmp, Point::new(64, 17), text_large)
.draw(&mut display)
.unwrap();
@ -78,13 +78,13 @@ pub async fn display_task(
.unwrap();
tmp.clear();
write!(tmp, "AZ: {}", rotor_state.setpoint_pos.az).unwrap();
uwrite!(tmp, "AZ: {}", rotor_state.setpoint_pos.az).unwrap();
Text::new(&tmp, Point::new(1, 30), text_large_inv)
.draw(&mut display)
.unwrap();
tmp.clear();
write!(tmp, "EL: {}", rotor_state.setpoint_pos.el).unwrap();
uwrite!(tmp, "EL: {}", rotor_state.setpoint_pos.el).unwrap();
Text::new(&tmp, Point::new(64, 30), text_large_inv)
.draw(&mut display)
.unwrap();