|
@@ -22,10 +22,10 @@ pub const PCA9685_SUB_CALL_1: u8 = 0x71; // Default disabled
|
|
|
pub const PCA9685_SUB_CALL_2: u8 = 0x72; // Default disabled
|
|
|
pub const PCA9685_SUB_CALL_3: u8 = 0x73; // Default disabled
|
|
|
|
|
|
-pub const REFRESH_RATE_HZ: u32 = 1000;
|
|
|
+pub const DISPLAY_REFRESH_FPS: u32 = 1000;
|
|
|
|
|
|
-pub const DIGIT_FADE_DURATION_MS: u32 = 1_000_000;
|
|
|
-pub const CYCLE_FADE_DURATION_MS: u32 = 200_000;
|
|
|
+pub const DIGIT_FADE_DURATION_MS: u32 = 1000;
|
|
|
+pub const CYCLE_FADE_DURATION_MS: u32 = 200;
|
|
|
pub const CYCLE_ITERATIONS: usize = 20;
|
|
|
pub const CYCLE_REFRESH_INTERVAL: u32 = 60;
|
|
|
pub const CYCLE_REFRESH_VARIANCE: u32 = 30;
|
|
@@ -455,7 +455,7 @@ impl Clock {
|
|
|
tube.digits.iter_mut().for_each(|digit| {
|
|
|
|
|
|
if let Some(fade_duration) = digit.fade_duration {
|
|
|
- let ticks = fade_duration / REFRESH_RATE_HZ;
|
|
|
+ let ticks = fade_duration * 1000 / DISPLAY_REFRESH_FPS;
|
|
|
let steps = ((DIGIT_MAX_BRIGHTNESS - DIGIT_MIN_BRIGHTNESS) + ticks - 1) / ticks;
|
|
|
update_fn(digit, DIGIT_MIN_BRIGHTNESS, DIGIT_MAX_BRIGHTNESS, steps);
|
|
|
}
|
|
@@ -467,7 +467,7 @@ impl Clock {
|
|
|
for (d, digit) in tube.digits.iter_mut().enumerate() {
|
|
|
|
|
|
if let Some(fade_duration) = digit.fade_duration {
|
|
|
- let ticks = fade_duration / REFRESH_RATE_HZ;
|
|
|
+ let ticks = fade_duration * 1000 / DISPLAY_REFRESH_FPS;
|
|
|
let steps = ((DIGIT_MAX_BRIGHTNESS - DIGIT_MIN_BRIGHTNESS) + ticks - 1) / ticks;
|
|
|
update_fn(digit, DIGIT_MIN_BRIGHTNESS, DIGIT_MAX_BRIGHTNESS, steps);
|
|
|
}
|
|
@@ -483,7 +483,7 @@ impl Clock {
|
|
|
|
|
|
// Handle dot
|
|
|
if let Some(fade_duration) = self.dot.fade_duration {
|
|
|
- let ticks = fade_duration / REFRESH_RATE_HZ;
|
|
|
+ let ticks = fade_duration * 1000 / DISPLAY_REFRESH_FPS;
|
|
|
let steps = ((DOT_MAX_BRIGHTNESS - DOT_MIN_BRIGHTNESS) + ticks - 1) / ticks;
|
|
|
update_fn(&mut self.dot, DOT_MIN_BRIGHTNESS, DOT_MAX_BRIGHTNESS, steps);
|
|
|
}
|
|
@@ -523,12 +523,6 @@ impl Clock {
|
|
|
}
|
|
|
});
|
|
|
|
|
|
- // self.tubes.iter_mut().for_each(|tube| {
|
|
|
- // tube.fade_in_out_digit(Some(0), CYCLE_FADE_DURATION_US, true);
|
|
|
- // });
|
|
|
-
|
|
|
- // self.tubes[3].fade_in_out_digit(Some(0), CYCLE_FADE_DURATION_US, true);
|
|
|
-
|
|
|
#[cfg(not(test))]
|
|
|
free(|cs| {
|
|
|
let mut timer_ref = super::FPS_TIMER.borrow(cs).borrow_mut();
|
|
@@ -672,7 +666,7 @@ where
|
|
|
}
|
|
|
|
|
|
// This function is called by an interrupt that is triggered every
|
|
|
-// REFRESH_RATE_HZ to update the display with a new brightness value.
|
|
|
+// DISPLAY_REFRESH_FPS to update the display with a new brightness value.
|
|
|
pub fn fps_interrupt<T>(i2c: &mut T)
|
|
|
where
|
|
|
T: _embedded_hal_blocking_i2c_WriteRead
|