Defined constant flags for LED colors
This commit is contained in:
parent
db8dbb52e0
commit
b9049713e0
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:
|
&& button_2_cup_counter >= BUTTON_CLEAN_THR) // both coffee buttons pushed: clean mode:
|
||||||
{
|
{
|
||||||
make_clean = true; // clean flag true
|
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)
|
while (button_1_cup_counter > 0 && button_2_cup_counter > 0)
|
||||||
; // debounce buttons
|
; // debounce buttons
|
||||||
}
|
}
|
||||||
@ -134,14 +134,14 @@ int main (void)
|
|||||||
{
|
{
|
||||||
set_bit(TRIAC_BOILER_w, TRIAC_BOILER_pin); // boiler off
|
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 > 0) // if coffee flag is set:
|
||||||
{
|
{
|
||||||
if (make_coffee < 3)
|
if (make_coffee < 3)
|
||||||
led = 0b00001010; // set orange LED blink
|
led = ORANGE_BLINK; // set orange LED blink
|
||||||
else
|
else
|
||||||
led = 0b00001000; // set green LED blink
|
led = GREEN_BLINK; // set green LED blink
|
||||||
|
|
||||||
if (make_coffee == 1)
|
if (make_coffee == 1)
|
||||||
pump_time = TIME_1_ESPRESSO; // 1 cup of espresso (2s preinfusion included)
|
pump_time = TIME_1_ESPRESSO; // 1 cup of espresso (2s preinfusion included)
|
||||||
@ -186,7 +186,7 @@ int main (void)
|
|||||||
else // temperature too low:
|
else // temperature too low:
|
||||||
{
|
{
|
||||||
clear_bit(TRIAC_BOILER_w, TRIAC_BOILER_pin); // boiler on
|
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:
|
else // water too low:
|
||||||
@ -194,7 +194,7 @@ int main (void)
|
|||||||
set_bit(TRIAC_BOILER_w, TRIAC_BOILER_pin); // boiler off
|
set_bit(TRIAC_BOILER_w, TRIAC_BOILER_pin); // boiler off
|
||||||
set_bit(TRIAC_PUMP_w, TRIAC_PUMP_pin); // pump 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_THRESHOLD 100 // button threshold (ms)
|
||||||
#define BUTTON_LONG_THR 1500 // button threshold for long time push (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:
|
// prototypes:
|
||||||
void init (); // initialization
|
void init (); // initialization
|
||||||
void power_off (); // power off to sleep mode
|
void power_off (); // power off to sleep mode
|
||||||
|
Loading…
x
Reference in New Issue
Block a user