Skip to content
Snippets Groups Projects
Commit 27758ebb authored by Stephen D's avatar Stephen D
Browse files

bug fixes around dimming logic

parent 700cb228
No related branches found
No related tags found
No related merge requests found
......@@ -298,7 +298,9 @@ mod app {
}
// lcd backlight logic
let sleeping =
// sleepy = screen is turning off or is fully off
// sleeping = screen is fully off
let (sleepy, sleeping) =
if let Some(fade_delta) = delta.checked_sub(LCD_DELAY_TIME_SECS.secs::<1, 1>()) {
let fade_delta = fade_delta.to_millis();
let fade_time_ms = LCD_FADE_TIME_SECS * 1000;
......@@ -307,20 +309,20 @@ mod app {
/ fade_time_ms;
display_bl.set_duty(frac.try_into().unwrap());
true
(true, frac == 0)
} else {
display_bl.set_duty(keyboard_bl.get_max_duty());
false
(false, false)
};
let state = keyboard.read_state();
if state > 0 {
*last_key_press = monotonics::now();
if let Some(k) = keyboard.pushed_key() {
*last_key_press = monotonics::now();
// if the screen is off, ignore the key press that turns us back on
if !sleeping {
if let Some(k) = keyboard.pushed_key() {
// if the screen is off, ignore the key press that turns us back on
if !sleeping {
ctx.shared.controller.lock(|g| g.key_push(k));
}
}
......@@ -328,9 +330,11 @@ mod app {
if let Ok((x, y)) = touchpad.get_delta_motion() {
if x != 0 || y != 0 {
*last_key_press = monotonics::now();
if !sleeping {
*last_key_press = monotonics::now();
}
if !sleepy {
ctx.shared.controller.lock(|g| g.touchpad_scroll(x, y));
}
}
......
......@@ -236,7 +236,7 @@ impl<
// At that point, the SI4463 is ready to dump the bytes we care about
// If we get back something other than 0xFF, toggle the CS line
// and try again
const MAX_ATTEMPTS: i32 = 1024;
const MAX_ATTEMPTS: i32 = 100_000;
let mut attempts = 0;
while attempts < MAX_ATTEMPTS {
if let Some(out) = self.with_cs(|s| {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment