|
@@ -11,9 +11,14 @@ static btn_t Button[BTN_NUM] = {
|
|
|
static volatile uint8_t dispWDT = 0;
|
|
|
|
|
|
/* function prototypes */
|
|
|
-static void Color_RGB(const uint8_t r, const uint8_t g, const uint8_t b);
|
|
|
+//static void Color_RGB(const uint8_t r, const uint8_t g, const uint8_t b);
|
|
|
static void MinusFadeIn(void);
|
|
|
static void MinusFadeOut(void);
|
|
|
+static void PlusFadeIn(void);
|
|
|
+static void PercentFadeIn(void);
|
|
|
+static void PressureFadeIn(void);
|
|
|
+//static void IN15_FadeIn(in15_pin_t pin);
|
|
|
+//static void IN15_FadeOut(in15_pin_t pin);
|
|
|
|
|
|
/* funcions */
|
|
|
/**
|
|
@@ -108,49 +113,161 @@ void in15P(void) {
|
|
|
|
|
|
/** 'Faded' funcions */
|
|
|
static void MinusFadeIn(void) {
|
|
|
- static uint8_t on = 0;
|
|
|
- static uint8_t off = 20;
|
|
|
+ static uint8_t on = FADE_START;
|
|
|
+ static uint8_t off = FADE_STOP;
|
|
|
static uint8_t st = 0;
|
|
|
|
|
|
if (st == 0) {
|
|
|
st = 1;
|
|
|
IN15_Minus;
|
|
|
- on += 2;
|
|
|
- if (on < 20) {
|
|
|
+ on += FADE_STEP;
|
|
|
+ if (on < FADE_STOP) {
|
|
|
RTOS_SetTask(MinusFadeIn, on, 0);
|
|
|
} else {
|
|
|
- on = 0; off = 20; st = 0;
|
|
|
+ on = FADE_START; off = FADE_STOP; st = 0;
|
|
|
}
|
|
|
} else {
|
|
|
st = 0;
|
|
|
IN15_OFF;
|
|
|
- off -= 2;
|
|
|
+ off -= FADE_STEP;
|
|
|
RTOS_SetTask(MinusFadeIn, off, 0);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
static void MinusFadeOut(void) {
|
|
|
- static uint8_t off = 0;
|
|
|
- static uint8_t on = 20;
|
|
|
+ static uint8_t off = FADE_START;
|
|
|
+ static uint8_t on = FADE_STOP;
|
|
|
static uint8_t st = 0;
|
|
|
|
|
|
if (st == 0) {
|
|
|
st = 1;
|
|
|
IN15_OFF;
|
|
|
- off += 2;
|
|
|
- if (off < 20) {
|
|
|
+ off += FADE_STEP;
|
|
|
+ if (off < FADE_STOP) {
|
|
|
RTOS_SetTask(MinusFadeOut, off, 0);
|
|
|
} else {
|
|
|
- off = 0; on = 20; st = 0;
|
|
|
+ off = FADE_START; on = FADE_STOP; st = 0;
|
|
|
}
|
|
|
} else {
|
|
|
st = 0;
|
|
|
IN15_Minus;
|
|
|
- on -= 2;
|
|
|
+ on -= FADE_STEP;
|
|
|
RTOS_SetTask(MinusFadeOut, on, 0);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+static void PlusFadeIn(void) {
|
|
|
+ static uint8_t on = FADE_START;
|
|
|
+ static uint8_t off = FADE_STOP;
|
|
|
+ static uint8_t st = 0;
|
|
|
+
|
|
|
+ if (st == 0) {
|
|
|
+ st = 1;
|
|
|
+ IN15_Plus;
|
|
|
+ on += FADE_STEP;
|
|
|
+ if (on < FADE_STOP) {
|
|
|
+ RTOS_SetTask(PlusFadeIn, on, 0);
|
|
|
+ } else {
|
|
|
+ on = FADE_START; off = FADE_STOP; st = 0;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ st = 0;
|
|
|
+ IN15_OFF;
|
|
|
+ off -= FADE_STEP;
|
|
|
+ RTOS_SetTask(PlusFadeIn, off, 0);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+static void PercentFadeIn(void) {
|
|
|
+ static uint8_t on = FADE_START;
|
|
|
+ static uint8_t off = FADE_STOP;
|
|
|
+ static uint8_t st = 0;
|
|
|
+
|
|
|
+ if (st == 0) {
|
|
|
+ st = 1;
|
|
|
+ IN15_Percent;
|
|
|
+ on += FADE_STEP;
|
|
|
+ if (on < FADE_STOP) {
|
|
|
+ RTOS_SetTask(PercentFadeIn, on, 0);
|
|
|
+ } else {
|
|
|
+ on = FADE_START; off = FADE_STOP; st = 0;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ st = 0;
|
|
|
+ IN15_OFF;
|
|
|
+ off -= FADE_STEP;
|
|
|
+ RTOS_SetTask(PercentFadeIn, off, 0);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+static void PressureFadeIn(void) {
|
|
|
+ static uint8_t on = FADE_START;
|
|
|
+ static uint8_t off = FADE_STOP;
|
|
|
+ static uint8_t st = 0;
|
|
|
+
|
|
|
+ if (st == 0) {
|
|
|
+ st = 1;
|
|
|
+ IN15_P;
|
|
|
+ on += FADE_STEP;
|
|
|
+ if (on < FADE_STOP) {
|
|
|
+ RTOS_SetTask(PressureFadeIn, on, 0);
|
|
|
+ } else {
|
|
|
+ on = FADE_START; off = FADE_STOP; st = 0;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ st = 0;
|
|
|
+ IN15_OFF;
|
|
|
+ off -= FADE_STEP;
|
|
|
+ RTOS_SetTask(PressureFadeIn, off, 0);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+#ifdef NEW_SHED
|
|
|
+static void IN15_FadeIn(in15_pin_t pin) {
|
|
|
+ static uint8_t on = FADE_START;
|
|
|
+ static uint8_t off = FADE_STOP;
|
|
|
+ static uint8_t st = 0;
|
|
|
+
|
|
|
+ if (st == 0) {
|
|
|
+ st = 1;
|
|
|
+ GPIOA->BSRR = pin;
|
|
|
+ on += FADE_STEP;
|
|
|
+ if (on < FADE_STOP) {
|
|
|
+ RTOS_SetTask(IN15_FadeIn, on, 0);
|
|
|
+ } else {
|
|
|
+ on = FADE_START; off = FADE_STOP; st = 0;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ st = 0;
|
|
|
+ IN15_OFF;
|
|
|
+ off -= FADE_STEP;
|
|
|
+ RTOS_SetTask(IN15_FadeIn, off, 0);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+static void IN15_FadeOut(in15_pin_t pin) {
|
|
|
+ static uint8_t off = FADE_START;
|
|
|
+ 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;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ st = 0;
|
|
|
+ GPIOA->BSRR = pin;
|
|
|
+ on -= FADE_STEP;
|
|
|
+ RTOS_SetTask(IN15_FadeOut, on, 0);
|
|
|
+ }
|
|
|
+}
|
|
|
+#endif /* NewShed */
|
|
|
+
|
|
|
/**
|
|
|
* Show info on tubes.
|
|
|
*/
|
|
@@ -237,7 +354,9 @@ void showYear(void) {
|
|
|
|
|
|
void showHumidity(void) {
|
|
|
dispWDT = DISP_WDT_TIME;
|
|
|
- in15Percent();
|
|
|
+ //in15Percent();
|
|
|
+ //IN15_FadeIn(sym_Percent);
|
|
|
+ PercentFadeIn();
|
|
|
|
|
|
tube4_t buf;
|
|
|
buf.s8.tA = Humidity / 10;
|
|
@@ -249,7 +368,9 @@ void showHumidity(void) {
|
|
|
|
|
|
void showTemperature(void) {
|
|
|
dispWDT = DISP_WDT_TIME;
|
|
|
- in15Plus();
|
|
|
+ //in15Plus();
|
|
|
+ //IN15_FadeIn(sym_Plus);
|
|
|
+ PlusFadeIn();
|
|
|
|
|
|
tube4_t buf;
|
|
|
buf.s8.tA = 0xf;
|
|
@@ -261,7 +382,9 @@ void showTemperature(void) {
|
|
|
|
|
|
void showPressure(void) {
|
|
|
dispWDT = DISP_WDT_TIME;
|
|
|
- in15P();
|
|
|
+ //in15P();
|
|
|
+ //IN15_FadeIn(sym_Pressure);
|
|
|
+ PressureFadeIn();
|
|
|
|
|
|
tube4_t buf;
|
|
|
int tmp;
|
|
@@ -277,16 +400,19 @@ void showPressure(void) {
|
|
|
void showSensorData(void) {
|
|
|
ES_SetState(stShowSensorData);
|
|
|
RTOS_DeleteTask(MinusFadeOut);
|
|
|
- HSV2LED(1, 255, cie[Lvl_Mdl]); // Nixie color
|
|
|
+ //HSV2LED(1, 255, cie[Lvl_Mdl]); // Nixie color
|
|
|
|
|
|
+ HSV2LED(0, 255, cie[Lvl_Mdl]); // RED
|
|
|
showTemperature();
|
|
|
tdelay_ms(3000);
|
|
|
|
|
|
+ HSV2LED(40, 255, cie[Lvl_Mdl]); // BLUE
|
|
|
showHumidity();
|
|
|
tdelay_ms(3000);
|
|
|
|
|
|
+ HSV2LED(20, 255, cie[Lvl_Mdl]); // GREEN
|
|
|
showPressure();
|
|
|
- tdelay_ms(2500);
|
|
|
+ tdelay_ms(2700);
|
|
|
|
|
|
ES_SetState(stShowTime);
|
|
|
// showTime();
|