Move sheet selector to submenu.

This commit is contained in:
Marek Bel 2019-06-21 15:44:56 +02:00
parent 19a474eaa5
commit e6fbac08ed
4 changed files with 35 additions and 10 deletions

View File

@ -100,7 +100,7 @@ extern uint8_t menu_item_text_P(const char* str);
#define MENU_ITEM_SUBMENU_P(str, submenu) do { if (menu_item_submenu_P(str, submenu)) return; } while (0)
extern uint8_t menu_item_submenu_P(const char* str, menu_func_t submenu);
#define MENU_ITEM_SUBMENU_P_E(str_P, eeprom_address_7b, submenu) do { if (menu_item_submenu_P(str_P, eeprom_address_7b, submenu)) return; } while (0)
#define MENU_ITEM_SUBMENU_P_E(str_P, sheet, submenu) do { if (menu_item_submenu_P(str_P, sheet, submenu)) return; } while (0)
extern uint8_t menu_item_submenu_P(const char *str_P, const Sheet &sheet, menu_func_t submenu);

View File

@ -55,6 +55,7 @@ const char MSG_CUT_FILAMENT[] PROGMEM_I1 = ISTR("Cut filament"); //// Number 1 t
const char MSG_M117_V2_CALIBRATION[] PROGMEM_I1 = ISTR("M117 First layer cal."); ////c=25 r=1
const char MSG_MAIN[] PROGMEM_I1 = ISTR("Main"); ////
const char MSG_BACK[] PROGMEM_I1 = ISTR("Back"); ////
const char MSG_SHEET[] PROGMEM_I1 = ISTR("Sheet"); ////c=10
const char MSG_MEASURE_BED_REFERENCE_HEIGHT_LINE1[] PROGMEM_I1 = ISTR("Measuring reference height of calibration point"); ////c=60
const char MSG_MEASURE_BED_REFERENCE_HEIGHT_LINE2[] PROGMEM_I1 = ISTR(" of 9"); ////c=14
const char MSG_MENU_CALIBRATION[] PROGMEM_I1 = ISTR("Calibration"); ////

View File

@ -54,6 +54,7 @@ extern const char MSG_LOADING_FILAMENT[];
extern const char MSG_M117_V2_CALIBRATION[];
extern const char MSG_MAIN[];
extern const char MSG_BACK[];
extern const char MSG_SHEET[];
extern const char MSG_MEASURE_BED_REFERENCE_HEIGHT_LINE1[];
extern const char MSG_MEASURE_BED_REFERENCE_HEIGHT_LINE2[];
extern const char MSG_MENU_CALIBRATION[];

View File

@ -6300,13 +6300,39 @@ void lcd_resume_print()
isPrintPaused = false;
}
static void lcd_select_sheet_0_menu()
{
eeprom_update_byte(&(EEPROM_Sheets_base->active_sheet), 0);
menu_back(3);
}
static void lcd_select_sheet_1_menu()
{
eeprom_update_byte(&(EEPROM_Sheets_base->active_sheet), 1);
menu_back(3);
}
static void lcd_select_sheet_2_menu()
{
eeprom_update_byte(&(EEPROM_Sheets_base->active_sheet), 2);
menu_back(3);
}
static void lcd_select_sheet_menu()
{
MENU_BEGIN();
MENU_ITEM_BACK_P(_T(MSG_SHEET));
MENU_ITEM_SUBMENU_P_E(_T(MSG_SHEET), EEPROM_Sheets_base->s[0], lcd_select_sheet_0_menu);
MENU_ITEM_SUBMENU_P_E(_T(MSG_SHEET), EEPROM_Sheets_base->s[1], lcd_select_sheet_1_menu);
MENU_ITEM_SUBMENU_P_E(_T(MSG_SHEET), EEPROM_Sheets_base->s[2], lcd_select_sheet_2_menu);
MENU_END();
}
static void lcd_sheet_menu()
{
uint_least8_t sheet_index = eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet));
sheet_index++;
if (sheet_index >= (sizeof(Sheets::s)/sizeof(Sheets::s[0]))) sheet_index = 0;
eeprom_update_byte(&(EEPROM_Sheets_base->active_sheet), sheet_index);
menu_back();
MENU_BEGIN();
MENU_ITEM_BACK_P(_T(MSG_MAIN));
MENU_ITEM_SUBMENU_P(_i("Select"), lcd_select_sheet_menu);
MENU_END();
}
static void lcd_main_menu()
@ -6343,10 +6369,7 @@ static void lcd_main_menu()
} else
{
MENU_ITEM_SUBMENU_P(_i("Preheat"), lcd_preheat_menu);////MSG_PREHEAT
do
{
if (menu_item_submenu_P(_i("Sheet"), EEPROM_Sheets_base->s[(eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)))], lcd_sheet_menu)) return;
} while (0);
MENU_ITEM_SUBMENU_P_E(_T(MSG_SHEET), EEPROM_Sheets_base->s[(eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)))], lcd_sheet_menu);
}