Commit 4b2d16d3 authored by Philippe Kalaf's avatar Philippe Kalaf

- Added some comments to menu drawing functions

- optimized some variable types
- increased default pump power to 75%
- lowered default pre-infuse time to 1 second
parent ea2cd3fc
Pipeline #34546632 passed with stages
in 56 seconds
......@@ -147,7 +147,7 @@ const char* ITEM_STRINGS[7]= {
};
uint8_t brew_params[NUM_BREW_MENUS][3][3]= {
{ {92, 3, 9}, {0, 0, 0}, {0, 0, 0} },
{ {92, 1, 9}, {0, 0, 0}, {0, 0, 0} },
{ {28, 0, 0}, {0, 0, 0}, {0, 0, 0} },
{ {55, 0, 0}, {0, 0, 0}, {0, 0, 0} },
{ {55, 28, 0}, {55, 28, 0}, {55, 28, 0} },
......@@ -159,7 +159,7 @@ uint8_t active_menu = 0;
uint8_t menu_level = L_STANDBY;
// 0 means not in edit mode - 1 to 9 are positions on a 3x3 square
int edit_mode = 0;
uint8_t edit_mode = 0;
const uint8_t conversion_table[9][2] = {
{0, 0}, {1, 0}, {2, 0},
{0, 1}, {1, 1}, {2, 1},
......@@ -206,7 +206,7 @@ void set_params(uint8_t menu_id)
// Draw menu
void draw_menu()
{
uint16_t i, j;
uint8_t i, j;
uint8_t state;
string out_s;
lcd_mutex.lock();
......@@ -214,9 +214,11 @@ void draw_menu()
LCD.cls();
LCD.invert(0);
// Standby screen -> Temperature, Pressure, Yield, Shot Clock, Flow Rate
// Draw standby and brew specific info
if (menu_level == L_STANDBY || menu_level == L_BREW) {
state = brew_control.get_state();
// Draw brew screen
LCD.set_font((unsigned char*) Small_6);
if (menu_level == L_BREW)
{
......@@ -269,17 +271,20 @@ void draw_menu()
LCD.printf("SOFT-STOP");
}
}
else
{
if (power_save_state)
// Draw standby screen
else
{
LCD.locate(5,16);
LCD.printf("COLD");
if (power_save_state)
{
LCD.locate(5,16);
LCD.printf("POWER");
}
LCD.locate(5,20);
LCD.printf("STANDBY");
}
LCD.locate(5,20);
LCD.printf("STANDBY");
}
LCD.locate(4,4);
// Draw common area (metrics)
LCD.locate(4,4);
LCD.set_font((unsigned char*) Arial12x12);
if (state == SOFT_STOPPING)
LCD.printf("Av, pressure: %.1f bar",
......@@ -294,13 +299,15 @@ void draw_menu()
brew_control.get_current_volume(),
brew_control.get_current_time());
}
// Show first level menu items (brew modes)
// Draw first level menu (brew modes)
else if (menu_level == L_MENU) {
LCD.locate(0,12);
LCD.set_font((unsigned char*) Arial12x12);
LCD.printf("%s ", MENU_TITLES[active_menu]);
}
// Show second level menu items (brew parameters)
// Draw second level menu (brew parameters)
else if (menu_level == L_MENU_SUB) {
out_s.clear();
// Display all menu items
......@@ -324,6 +331,7 @@ void draw_menu()
}
out_s += '\n';
}
// Set position and font size based on number of parameters
if (MENU_ITEMS[active_menu][1] == 1)
{
LCD.set_font((unsigned char*) Arial12x12);
......@@ -429,14 +437,10 @@ void menu_handler()
switch (menu_level)
{
case L_STANDBY: menu_level = L_MENU; break;
case L_MENU: if(active_menu == M_BREW_MANUAL)
case L_MENU: if(active_menu == M_BREW_MANUAL
|| active_menu == M_BREW_STEAM)
// skip sub-menu for manual mode
menu_level = L_BREW;
else if(active_menu == M_BREW_STEAM)
{
// skip sub-menu for steam mode
menu_level = L_BREW;
}
else
menu_level = L_MENU_SUB;
break;
......@@ -496,7 +500,7 @@ void enter_power_save()
{
// let's set ambient temp to keep things cool
brew_control.set_shot_temperature(23);
// turn on power saving
// turn on LCD power saving
//LCD.power_save(1);
power_save_state = 1;
......@@ -509,7 +513,7 @@ void exit_power_save()
power_save_timer.reset();
// go back to previously set temperature
set_params(M_BREW_SETTINGS);
// turn off power saving
// turn off LCD power saving
//LCD.power_save(0);
}
......
......@@ -53,7 +53,7 @@ PhaseControl::PhaseControl(PinName pin, PinName pin2) : _zcd(pin), _control_sign
_zcd.mode(PullUp);
_zcd.fall(callback(this, &PhaseControl::delayed_start));
_zcd.rise(callback(this, &PhaseControl::delayed_stop));
_level = 50;
_level = 75;
_control_signal = 0;
// This is a workaround until timeouts for 50Hz are calculated
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment