Browse Source

new lShiftDigits().

Vladimir N. Shilov 2 years ago
parent
commit
627c598b8d
3 changed files with 20 additions and 8 deletions
  1. 1 0
      Inc/board.h
  2. 16 7
      Src/board.c
  3. 3 1
      Src/clock.c

+ 1 - 0
Inc/board.h

@@ -181,6 +181,7 @@ void Board_Init(void);
 void Blink_Start(void);
 void Blink_Stop(void);
 void showDigits(tube4_t dig);
+void lShiftDigits(const tube4_t old, const tube4_t dig);
 void slideDigits(tube4_t dig);
 void tube_PowerOn(tube_pos_t tube);
 void tube_PowerOff(tube_pos_t tube);

+ 16 - 7
Src/board.c

@@ -130,19 +130,28 @@ void showDigits(tube4_t dig)
   } // End of if-else
 }
 
-void lShiftDigits(tube4_t dig) {
+void lShiftDigits(const tube4_t old, const tube4_t dig) {
   uint32_t * buf;
-  uint8_t sbuf[12] = {0xf};
-  sbuf[4] = dig.ar[0];
-  sbuf[5] = dig.ar[1];
-  sbuf[6] = dig.ar[2];
-  sbuf[7] = dig.ar[3];
+  uint8_t sbuf[12];
+
+  sbuf[0] = old.ar[0];
+  sbuf[1] = old.ar[1];
+  sbuf[2] = old.ar[2];
+  sbuf[3] = old.ar[3];
+  sbuf[4] = TUBE_BLANK;
+  sbuf[5] = TUBE_BLANK;
+  sbuf[6] = TUBE_BLANK;
+  sbuf[7] = TUBE_BLANK;
+  sbuf[8] = dig.ar[0];
+  sbuf[9] = dig.ar[1];
+  sbuf[10] = dig.ar[2];
+  sbuf[11] = dig.ar[3];
 
   int i;
   for (i=0; i<9; i++) {
     buf = (uint32_t *)&sbuf[i];
     _show_digits(* buf);
-    tdelay_ms(100);
+    tdelay_ms(200);
   }
 }
 

+ 3 - 1
Src/clock.c

@@ -377,6 +377,7 @@ static void HSV2LED(const uint8_t hue, const uint8_t val) {
   * Show info on tubes.
   */
 void showTime(void) {
+  static tube4_t old_buf;
   uint8_t hue;
   MinusFadeIn();
   RTOS_SetTask(MinusFadeOut, 500, 0);
@@ -402,7 +403,8 @@ void showTime(void) {
   buf.s8.tD = Clock.Min >> 4;
   buf.s8.tE = Clock.Min & 0xf;
   if (Clock.Min == 0) {
-    slideDigits(buf);
+    lShiftDigits(old_buf, buf);
+    old_buf = buf;
   } else {
     showDigits(buf);
   }