From cd31ce424dfe1096c00bd9a1e28c8a1f99c268a1 Mon Sep 17 00:00:00 2001 From: FliegendeWurst <2012gdwu+github@posteo.de> Date: Mon, 2 Dec 2024 22:42:46 +0100 Subject: [PATCH] Tweaks --- src/bin/schedule/github_notifications.rs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/bin/schedule/github_notifications.rs b/src/bin/schedule/github_notifications.rs index 4b88f58..21d3436 100644 --- a/src/bin/schedule/github_notifications.rs +++ b/src/bin/schedule/github_notifications.rs @@ -95,7 +95,7 @@ impl> Draw for GithubNotificationsDraw { .draw_all_colored(disp, Rgb565::new(0xff >> 3, 0xff >> 2, 0xff >> 3))?; } if calls < 70 { - let hue = calls as f64 / 40.0 * 360.0; + let hue = (rng.next_u32() % 360) as f64; let hsv = Hsv::new(hue, 1.0, 1.0); let rgb = hsv.to_rgb(); let r = rgb.r as u8 >> 3; @@ -116,6 +116,9 @@ impl> Draw for GithubNotificationsDraw { let mut circles = self.circles.borrow_mut(); for ((ox, oy), radius, color, points) in &mut *circles { *radius += 1; + if *radius >= 20 { + continue; + } let mut seen = HashSet::new(); let mut next_points = vec![]; loop { @@ -157,6 +160,7 @@ impl> Draw for GithubNotificationsDraw { )?; *points = next_points; } + circles.retain(|x| x.1 < 10); circles.push(((x, y), 0, rgb, vec![(x, y)])); } else { let idx = calls - 70; @@ -168,8 +172,12 @@ impl> Draw for GithubNotificationsDraw { .text_color(Rgb565::WHITE) .build(); for (y, line) in self.lines.iter().enumerate() { - let mut line = if calls >= 139 { - format!(" {line}") + let mut line = if calls >= 119 { + if y % 2 == 0 { + line.clone() + } else { + format!(" {line}") + } } else if line.len() > max_line_length { let line = format!(" {line} "); line[line.ceil_char_boundary(idx % line.len())..].to_string() @@ -181,7 +189,7 @@ impl> Draw for GithubNotificationsDraw { } } *self.calls.borrow_mut() += 1; - Ok(calls < 140) + Ok(calls < 120) } fn expired(&self) -> bool {