Browse Source

Bugfix for digits not displaying after cycle

Kevin Lee 2 years ago
parent
commit
69b159e658
1 changed files with 6 additions and 10 deletions
  1. 6 10
      Nixie_Firmware_Rust/src/nixie.rs

+ 6 - 10
Nixie_Firmware_Rust/src/nixie.rs

@@ -193,18 +193,14 @@ impl Tube {
         if (self.cycle.is_none() && !cycle_cmd) || cycle_cmd {
             // Fade out all digits
             for digit in 0..NUM_DIGITS {
-                if self.digits[digit].value != DIGIT_MIN_BRIGHTNESS {
-                    self.digits[digit].state = State::Decrementing;
-                    self.digits[digit].fade_duration = Some(fade_duration);
-                }
+                self.digits[digit].state = State::Decrementing;
+                self.digits[digit].fade_duration = Some(fade_duration);
             }
 
             // Fade in the specified digit
             if let Some(digit) = digit {
-                if self.digits[digit as usize].value != DIGIT_MAX_BRIGHTNESS {
-                    self.digits[digit as usize].state = State::Incrementing;
-                    self.digits[digit as usize].fade_duration = Some(fade_duration);
-                }
+                self.digits[digit as usize].state = State::Incrementing;
+                self.digits[digit as usize].fade_duration = Some(fade_duration);
             }
 
             self.last_digit = digit;
@@ -636,7 +632,7 @@ mod test {
         let mut clock: Clock = Clock::default();
 
         // Initialize clock to arbitrary time
-        clock.rtc_tick(10, 23, 12);
+        clock.rtc_tick(10, 8, 12);
 
         // Iterate and print output values for each display refresh tick
         for tick in 0..1000 {
@@ -661,7 +657,7 @@ mod test {
         let mut clock: Clock = Clock::default();
 
         // Initialize clock to arbitrary time
-        clock.rtc_tick(10, 23, 12);
+        clock.rtc_tick(00, 27, 8);
 
         // Simulate a cycle refresh sequence on tube 0
         clock.tubes[0].cycle = Some(CycleSettings {