chore: rm TaskGreenLed+comment out TaskEffect call
This commit is contained in:
parent
a3f97c603e
commit
3fe79c2e4b
53
main.cpp
53
main.cpp
@ -54,12 +54,10 @@ void LED_control(bool d1, bool d2, bool d3);
|
||||
bool SW1_pressed;
|
||||
/* we'll do blinking, but not by default, values are -1/1 */
|
||||
int blinkingpls = -1;
|
||||
// Promenna state je nove lokalni uvnitr tasku (funkce) pro blikani
|
||||
|
||||
// Prototypy funkci
|
||||
void TaskSwitches(void);
|
||||
void TaskEffect(void);
|
||||
void TaskGreenLed(void);
|
||||
void TaskL1(void);
|
||||
void TaskL2(void);
|
||||
void TaskL3(void);
|
||||
@ -71,15 +69,13 @@ int main(void) {
|
||||
while (1) {
|
||||
|
||||
TaskSwitches();
|
||||
TaskEffect();
|
||||
TaskGreenLed();
|
||||
//TaskEffect();
|
||||
TaskL1();
|
||||
TaskL2();
|
||||
TaskL3();
|
||||
|
||||
} // while
|
||||
}
|
||||
|
||||
/* Never leave main */
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -305,51 +301,6 @@ void TaskL3() {
|
||||
}
|
||||
|
||||
|
||||
// Ukazka dalsiho tasku - blika pri stisknutem tlacitku RGB LED
|
||||
void TaskGreenLed() {
|
||||
static enum {
|
||||
ST_LED_ON,
|
||||
ST_ON_WAIT,
|
||||
ST_LED_OFF,
|
||||
ST_OFF_WAIT
|
||||
|
||||
} stav = ST_LED_ON;
|
||||
|
||||
static uint32_t startTime;
|
||||
|
||||
// uloha se provadi jen pri stisknutem tlacitku
|
||||
if (SW1_pressed) {
|
||||
|
||||
switch (stav) {
|
||||
|
||||
case ST_LED_ON:
|
||||
pinWrite(LED_GREEN, LOW);
|
||||
startTime = SYSTICK_millis();
|
||||
stav = ST_ON_WAIT;
|
||||
break;
|
||||
|
||||
case ST_ON_WAIT:
|
||||
if (SYSTICK_millis() - startTime >= GREEN_ON_DELAY)
|
||||
stav = ST_LED_OFF;
|
||||
break;
|
||||
|
||||
case ST_LED_OFF:
|
||||
pinWrite(LED_GREEN, HIGH);
|
||||
startTime = SYSTICK_millis();
|
||||
stav = ST_OFF_WAIT;
|
||||
break;
|
||||
|
||||
case ST_OFF_WAIT:
|
||||
if (SYSTICK_millis() - startTime >= GREEN_OFF_DELAY)
|
||||
stav = ST_LED_ON;
|
||||
break;
|
||||
} // switch
|
||||
} else {
|
||||
pinWrite(LED_GREEN, HIGH); // zhasni LED
|
||||
stav = ST_LED_ON; // resetuj stav LED
|
||||
}
|
||||
}
|
||||
|
||||
// Pomocne funkce
|
||||
|
||||
// inicializace
|
||||
|
Loading…
Reference in New Issue
Block a user