Vladimir N. Shilov пре 4 година
родитељ
комит
1dda235d91
1 измењених фајлова са 16 додато и 14 уклоњено
  1. 16 14
      src/main.c

+ 16 - 14
src/main.c

@@ -131,7 +131,8 @@ void main(void) {
 
   /* Initialize Scheduler */
   RTOS_Init();
-  tdelay_ms(2000);
+  tdelay_ms(5000);
+
   lampTest();
   tdelay_ms(5000);
 
@@ -740,15 +741,16 @@ void usart_puts (const char *send) {
  */
 static void lampValInc(uint8_t n)
 {
-  if (n < LAMP_NUM) {
-    if (Digit[n] != DIGIT_BLANK) {
-      Digit[n] ++;
-    } else {
-      Digit[n] = 1;
-    }
-    if (Digit[n] > 9) {
-      Digit[n] = 0;
-      lampValInc(n+1);
+  if (Digit[n] != DIGIT_BLANK) {
+    Digit[n] ++;
+  } else {
+    Digit[n] = 1;
+  }
+
+  if (Digit[n] > 9) {
+    Digit[n] = 0;
+    if (n > 0) {
+      lampValInc(n-1);
     }
   }
 }
@@ -765,14 +767,14 @@ static void lampTest(void)
 
   while (true) {
 
-    Digit[0] = i;
+    Digit[LAMP_NUM-1] = i;
     i ++;
     if (i > 9) {
-      Digit[0] = 0;
       dotOn();
-      lampValInc(1);
+      i = 0;
+      lampValInc(LAMP_NUM-2);
     }
-    tdelay_ms(200);
+    tdelay_ms(10);
 
     if (i == 5) {
         dotOff();