Ver Fonte

Fixe errors.

Vladimir N. Shilov há 2 anos atrás
pai
commit
d7f2ff4d2b
5 ficheiros alterados com 55 adições e 37 exclusões
  1. 2 2
      Inc/clock.h
  2. 5 1
      MDK-ARM/MNC-IN12x5.uvoptx
  3. 3 0
      ReadMe.txt
  4. 5 4
      Src/board.c
  5. 40 30
      Src/clock.c

+ 2 - 2
Inc/clock.h

@@ -26,8 +26,8 @@ typedef enum {
 // Day/Night mode
 #define MORNING_HOUR    0x06
 #define EVENING_HOUR    0x22
-#define DAY_BR_LVL      (brigh_level_t)2
-#define NIGHT_BR_LVL    (brigh_level_t)5
+#define DAY_BR_LVL      (brigh_level_t)5
+#define NIGHT_BR_LVL    (brigh_level_t)2
 
 // Color HUE angle
 #define COLOUR_RED      0

+ 5 - 1
MDK-ARM/MNC-IN12x5.uvoptx

@@ -140,7 +140,7 @@
         <SetRegEntry>
           <Number>0</Number>
           <Key>DLGUARM</Key>
-          <Name>ИЪЭw</Name>
+          <Name></Name>
         </SetRegEntry>
         <SetRegEntry>
           <Number>0</Number>
@@ -246,6 +246,10 @@
           <Name>System Viewer\SPI1</Name>
           <WinId>35898</WinId>
         </Entry>
+        <Entry>
+          <Name>System Viewer\TIM14</Name>
+          <WinId>35894</WinId>
+        </Entry>
       </SystemViewers>
       <DebugDescription>
         <Enable>1</Enable>

+ 3 - 0
ReadMe.txt

@@ -98,3 +98,6 @@ Segger убрал, в хардфаулт падает только он.
 Вчерашняя версия опять перестала работать под GCC...
 
 Есть мысль повесить опрос кнопок на 16 или 17-ый таймер.
+
+Получается, под GCC какая-то лажа с I2C - при инициализации получается 
+частота прерываний 4096 Гц.

+ 5 - 4
Src/board.c

@@ -108,9 +108,10 @@ void showDigits(tube4_t dig)
   static uint32_t old_dig = 0;
   uint8_t st = 0, ov = FADE_START;
 
-  if (old_dig == dig.u32) {
-    _show_digits(dig.u32);
-  } else {
+//  if (old_dig == dig.u32) {
+//    _show_digits(dig.u32);
+//  } else {
+  if (old_dig != dig.u32) {
     while (ov < FADE_STOP) {
       if (st == 0) {
         // new tube value
@@ -598,7 +599,7 @@ static void TIM14_Init(void)
 void Blink_Start(void)
 {
   /* enable all channels */
-  TUBE_ALL_ON;
+  //TUBE_ALL_ON;
 
   /* clear IRQ flags */
   TIM14->SR |= TIM_SR_UIF;

+ 40 - 30
Src/clock.c

@@ -106,6 +106,12 @@ void new_Second(void) {
   if (dispWDT != 0) {
     dispWDT--;
     if (dispWDT == 0) {
+			Flag.Blink_1 = 0;
+			Flag.Blink_2 = 0;
+			Flag.Blink_3 = 0;
+			Flag.Blink_4 = 0;
+			Flag.Blink_5 = 0;
+			Blink_Stop();
       ES_PlaceEvent(evDisplayWDT);
     }
   }
@@ -259,21 +265,23 @@ static void IN15_FadeIn(void) {
   static uint8_t off = FADE_STOP;
   static uint8_t st = 0;
 
-  if (st == 0) {
-    st = 1;
-    GPIOA->BSRR = symToFade;
-    on += FADE_STEP;
-    if (on < FADE_STOP) {
-      RTOS_SetTask(IN15_FadeIn, on, 0);
-    } else {
-      on = FADE_START; off = FADE_STOP; st = 0; symToFade = 0;
-    }
-  } else {
-    st = 0;
-    IN15_OFF;
-    off -= FADE_STEP;
-    RTOS_SetTask(IN15_FadeIn, off, 0);
-  }
+	if (symToFade != 0) {
+		if (st == 0) {
+			st = 1;
+			GPIOA->BSRR = symToFade;
+			on += FADE_STEP;
+			if (on < FADE_STOP) {
+				RTOS_SetTask(IN15_FadeIn, on, 0);
+			} else {
+				on = FADE_START; off = FADE_STOP; st = 0; symToFade = 0;
+			}
+		} else {
+			st = 0;
+			IN15_OFF;
+			off -= FADE_STEP;
+			RTOS_SetTask(IN15_FadeIn, off, 0);
+		}
+	}
 }
 
 static void IN15_FadeOut(void) {
@@ -281,21 +289,23 @@ static void IN15_FadeOut(void) {
   static uint8_t on = FADE_STOP;
   static uint8_t st = 0;
 
-  if (st == 0) {
-    st = 1;
-    IN15_OFF;
-    off += FADE_STEP;
-    if (off < FADE_STOP) {
-      RTOS_SetTask(IN15_FadeOut, off, 0);
-    } else {
-      off = FADE_START; on = FADE_STOP; st = 0; symToFade = 0;
-    }
-  } else {
-    st = 0;
-    GPIOA->BSRR = symToFade;
-    on -= FADE_STEP;
-    RTOS_SetTask(IN15_FadeOut, on, 0);
-  }
+	if (symToFade != 0) {
+		if (st == 0) {
+			st = 1;
+			IN15_OFF;
+			off += FADE_STEP;
+			if (off < FADE_STOP) {
+				RTOS_SetTask(IN15_FadeOut, off, 0);
+			} else {
+				off = FADE_START; on = FADE_STOP; st = 0; symToFade = 0;
+			}
+		} else {
+			st = 0;
+			GPIOA->BSRR = symToFade;
+			on -= FADE_STEP;
+			RTOS_SetTask(IN15_FadeOut, on, 0);
+		}
+	}
 }
 
 /**