I can haz Lua?
This commit is contained in:
@@ -28,7 +28,8 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
|
||||
let mut _g13 = g13.clone();
|
||||
tokio::spawn(async move {
|
||||
let character_style = MonoTextStyle::new(&FONT_10X20, BinaryColor::On);
|
||||
let character_style_time = MonoTextStyle::new(&FONT_10X20, BinaryColor::On);
|
||||
let character_style_date = MonoTextStyle::new(&FONT_6X10, BinaryColor::On);
|
||||
let textstyle = TextStyleBuilder::new()
|
||||
.alignment(Alignment::Center)
|
||||
.baseline(embedded_graphics::text::Baseline::Middle)
|
||||
@@ -39,21 +40,35 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let now = OffsetDateTime::now_utc().to_offset(offset!(+1)); // GMT+1
|
||||
|
||||
// Render
|
||||
let string = format!(
|
||||
let time = format!(
|
||||
"{:0>2}:{:0>2}:{:0>2}",
|
||||
now.hour(),
|
||||
now.minute(),
|
||||
now.second()
|
||||
);
|
||||
|
||||
let date = format!("{}, {} {}", now.weekday(), now.day(), now.month());
|
||||
|
||||
_g13.clear(BinaryColor::Off).unwrap();
|
||||
Text::with_text_style(
|
||||
&string,
|
||||
&time,
|
||||
Point::new(
|
||||
(G13_LCD_COLUMNS as f64 / 2.0) as i32,
|
||||
(G13_LCD_ROWS as f64 / 2.0) as i32,
|
||||
(G13_LCD_ROWS as f64 / 2.0) as i32 - 8,
|
||||
),
|
||||
character_style,
|
||||
character_style_time,
|
||||
textstyle,
|
||||
)
|
||||
.draw(&mut _g13)
|
||||
.unwrap();
|
||||
|
||||
Text::with_text_style(
|
||||
&date,
|
||||
Point::new(
|
||||
(G13_LCD_COLUMNS as f64 / 2.0) as i32,
|
||||
(G13_LCD_ROWS as f64 / 2.0) as i32 + 8,
|
||||
),
|
||||
character_style_date,
|
||||
textstyle,
|
||||
)
|
||||
.draw(&mut _g13)
|
||||
|
||||
Reference in New Issue
Block a user