Defined constant flags for LED colors
This commit is contained in:
parent
ef396e5454
commit
a3f23d489a
12
main.c
12
main.c
@ -61,7 +61,7 @@ int main (void)
|
||||
&& button_2_cup_counter >= BUTTON_CLEAN_THR) // both coffee buttons pushed: clean mode:
|
||||
{
|
||||
make_clean = true; // clean flag true
|
||||
led = 0b00010000; // set blue LED
|
||||
led = BLUE; // set blue LED
|
||||
while (button_1_cup_counter > 0 && button_2_cup_counter > 0)
|
||||
; // debounce buttons
|
||||
}
|
||||
@ -134,14 +134,14 @@ int main (void)
|
||||
{
|
||||
set_bit(TRIAC_BOILER_w, TRIAC_BOILER_pin); // boiler off
|
||||
|
||||
led = 0b00000100; // set green LED
|
||||
led = GREEN; // set green LED
|
||||
|
||||
if (make_coffee > 0) // if coffee flag is set:
|
||||
{
|
||||
if (make_coffee < 3)
|
||||
led = 0b00001010; // set orange LED blink
|
||||
led = ORANGE_BLINK; // set orange LED blink
|
||||
else
|
||||
led = 0b00001000; // set green LED blink
|
||||
led = GREEN_BLINK; // set green LED blink
|
||||
|
||||
if (make_coffee == 1)
|
||||
pump_time = TIME_1_ESPRESSO; // 1 cup of espresso (2s preinfusion included)
|
||||
@ -186,7 +186,7 @@ int main (void)
|
||||
else // temperature too low:
|
||||
{
|
||||
clear_bit(TRIAC_BOILER_w, TRIAC_BOILER_pin); // boiler on
|
||||
led = 0b00000010; // set red LED blink
|
||||
led = RED_BLINK; // set red LED blink
|
||||
}
|
||||
}
|
||||
else // water too low:
|
||||
@ -194,7 +194,7 @@ int main (void)
|
||||
set_bit(TRIAC_BOILER_w, TRIAC_BOILER_pin); // boiler off
|
||||
set_bit(TRIAC_PUMP_w, TRIAC_PUMP_pin); // pump off
|
||||
|
||||
led = 0b00100000; // set blue LED blink
|
||||
led = BLUE_BLINK; // set blue LED blink
|
||||
}
|
||||
|
||||
}
|
||||
|
9
main.h
9
main.h
@ -95,6 +95,15 @@
|
||||
#define BUTTON_THRESHOLD 100 // button threshold (ms)
|
||||
#define BUTTON_LONG_THR 1500 // button threshold for long time push (ms)
|
||||
|
||||
#define RED 0b00000001
|
||||
#define RED_BLINK 0b00000010
|
||||
#define GREEN 0b00000100
|
||||
#define GREEN_BLINK 0b00001000
|
||||
#define BLUE 0b00010000
|
||||
#define BLUE_BLINK 0b00100000
|
||||
#define ORANGE 0b00000101
|
||||
#define ORANGE_BLINK 0b00001010
|
||||
|
||||
// prototypes:
|
||||
void init (); // initialization
|
||||
void power_off (); // power off to sleep mode
|
||||
|
Loading…
x
Reference in New Issue
Block a user