Split settings menu into separate functions.
This commit is contained in:
parent
f25cad4ba5
commit
95e7536955
1 changed files with 109 additions and 94 deletions
|
@ -4546,6 +4546,106 @@ void lcd_settings_linearity_correction_menu(void)
|
|||
MENU_END();
|
||||
}
|
||||
#endif //LINEARITY_CORRECTION
|
||||
|
||||
static void settings_silent_mode()
|
||||
{
|
||||
if(!farm_mode)
|
||||
{
|
||||
#ifdef TMC2130
|
||||
|
||||
if (SilentModeMenu == SILENT_MODE_NORMAL) { MENU_ITEM_FUNCTION_P(_T(MSG_STEALTH_MODE_OFF), lcd_silent_mode_set); }
|
||||
else MENU_ITEM_FUNCTION_P(_T(MSG_STEALTH_MODE_ON), lcd_silent_mode_set);
|
||||
if (SilentModeMenu == SILENT_MODE_NORMAL)
|
||||
{
|
||||
if (CrashDetectMenu == 0) { MENU_ITEM_FUNCTION_P(_T(MSG_CRASHDETECT_OFF), lcd_crash_mode_set); }
|
||||
else MENU_ITEM_FUNCTION_P(_T(MSG_CRASHDETECT_ON), lcd_crash_mode_set);
|
||||
}
|
||||
else MENU_ITEM_SUBMENU_P(_T(MSG_CRASHDETECT_NA), lcd_crash_mode_info);
|
||||
#else //TMC2130
|
||||
|
||||
switch (SilentModeMenu)
|
||||
{
|
||||
case SILENT_MODE_POWER: MENU_ITEM_FUNCTION_P(_T(MSG_SILENT_MODE_OFF), lcd_silent_mode_set); break;
|
||||
case SILENT_MODE_SILENT: MENU_ITEM_FUNCTION_P(_T(MSG_SILENT_MODE_ON), lcd_silent_mode_set); break;
|
||||
case SILENT_MODE_AUTO: MENU_ITEM_FUNCTION_P(_T(MSG_AUTO_MODE_ON), lcd_silent_mode_set); break;
|
||||
default: MENU_ITEM_FUNCTION_P(_T(MSG_SILENT_MODE_OFF), lcd_silent_mode_set); break; // (probably) not needed
|
||||
}
|
||||
#endif //TMC2130
|
||||
}
|
||||
}
|
||||
|
||||
static void settings_filament_sensor()
|
||||
{
|
||||
#ifdef FILAMENT_SENSOR
|
||||
if (FSensorStateMenu == 0)
|
||||
{
|
||||
if (fsensor_not_responding)
|
||||
{
|
||||
// Filament sensor not working
|
||||
MENU_ITEM_FUNCTION_P(_i("Fil. sensor [N/A]"), lcd_fsensor_state_set);////MSG_FSENSOR_NA c=0 r=0
|
||||
MENU_ITEM_SUBMENU_P(_T(MSG_FSENS_AUTOLOAD_NA), lcd_fsensor_fail);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Filament sensor turned off, working, no problems
|
||||
MENU_ITEM_FUNCTION_P(_T(MSG_FSENSOR_OFF), lcd_fsensor_state_set);
|
||||
MENU_ITEM_SUBMENU_P(_T(MSG_FSENS_AUTOLOAD_NA), lcd_filament_autoload_info);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Filament sensor turned on, working, no problems
|
||||
MENU_ITEM_FUNCTION_P(_T(MSG_FSENSOR_ON), lcd_fsensor_state_set);
|
||||
if (fsensor_autoload_enabled)
|
||||
MENU_ITEM_FUNCTION_P(_i("F. autoload [on]"), lcd_set_filament_autoload);////MSG_FSENS_AUTOLOAD_ON c=17 r=1
|
||||
else
|
||||
MENU_ITEM_FUNCTION_P(_i("F. autoload [off]"), lcd_set_filament_autoload);////MSG_FSENS_AUTOLOAD_OFF c=17 r=1
|
||||
}
|
||||
#endif //FILAMENT_SENSOR
|
||||
}
|
||||
|
||||
static void settings_sd()
|
||||
{
|
||||
if (card.ToshibaFlashAir_isEnabled())
|
||||
MENU_ITEM_FUNCTION_P(_i("SD card [flshAir]"), lcd_toshiba_flash_air_compatibility_toggle);////MSG_TOSHIBA_FLASH_AIR_COMPATIBILITY_ON c=19 r=1
|
||||
else
|
||||
MENU_ITEM_FUNCTION_P(_i("SD card [normal]"), lcd_toshiba_flash_air_compatibility_toggle);////MSG_TOSHIBA_FLASH_AIR_COMPATIBILITY_OFF c=19 r=1
|
||||
#ifdef SDCARD_SORT_ALPHA
|
||||
if (!farm_mode)
|
||||
{
|
||||
uint8_t sdSort;
|
||||
EEPROM_read(EEPROM_SD_SORT, (uint8_t*)&sdSort, sizeof(sdSort));
|
||||
switch (sdSort)
|
||||
{
|
||||
case SD_SORT_TIME: MENU_ITEM_FUNCTION_P(_i("Sort: [time]"), lcd_sort_type_set); break;////MSG_SORT_TIME c=17 r=1
|
||||
case SD_SORT_ALPHA: MENU_ITEM_FUNCTION_P(_i("Sort: [alphabet]"), lcd_sort_type_set); break;////MSG_SORT_ALPHA c=17 r=1
|
||||
default: MENU_ITEM_FUNCTION_P(_i("Sort: [none]"), lcd_sort_type_set);////MSG_SORT_NONE c=17 r=1
|
||||
}
|
||||
}
|
||||
#endif // SDCARD_SORT_ALPHA
|
||||
}
|
||||
|
||||
static void settings_sound()
|
||||
{
|
||||
switch(eSoundMode)
|
||||
{
|
||||
case e_SOUND_MODE_LOUD:
|
||||
MENU_ITEM_FUNCTION_P(_i(MSG_SOUND_MODE_LOUD),lcd_sound_state_set);
|
||||
break;
|
||||
case e_SOUND_MODE_ONCE:
|
||||
MENU_ITEM_FUNCTION_P(_i(MSG_SOUND_MODE_ONCE),lcd_sound_state_set);
|
||||
break;
|
||||
case e_SOUND_MODE_SILENT:
|
||||
MENU_ITEM_FUNCTION_P(_i(MSG_SOUND_MODE_SILENT),lcd_sound_state_set);
|
||||
break;
|
||||
case e_SOUND_MODE_MUTE:
|
||||
MENU_ITEM_FUNCTION_P(_i(MSG_SOUND_MODE_MUTE),lcd_sound_state_set);
|
||||
break;
|
||||
default:
|
||||
MENU_ITEM_FUNCTION_P(_i(MSG_SOUND_MODE_LOUD),lcd_sound_state_set);
|
||||
}
|
||||
}
|
||||
|
||||
static void lcd_settings_menu()
|
||||
{
|
||||
EEPROM_read(EEPROM_SILENT, (uint8_t*)&SilentModeMenu, sizeof(SilentModeMenu));
|
||||
|
@ -4554,71 +4654,22 @@ static void lcd_settings_menu()
|
|||
|
||||
MENU_ITEM_SUBMENU_P(_i("Temperature"), lcd_control_temperature_menu);////MSG_TEMPERATURE c=0 r=0
|
||||
if (!homing_flag)
|
||||
MENU_ITEM_SUBMENU_P(_i("Move axis"), lcd_move_menu_1mm);////MSG_MOVE_AXIS c=0 r=0
|
||||
MENU_ITEM_SUBMENU_P(_i("Move axis"), lcd_move_menu_1mm);////MSG_MOVE_AXIS c=0 r=0
|
||||
if (!isPrintPaused)
|
||||
MENU_ITEM_GCODE_P(_i("Disable steppers"), PSTR("M84"));////MSG_DISABLE_STEPPERS c=0 r=0
|
||||
MENU_ITEM_GCODE_P(_i("Disable steppers"), PSTR("M84"));////MSG_DISABLE_STEPPERS c=0 r=0
|
||||
|
||||
#ifndef TMC2130
|
||||
if (!farm_mode)
|
||||
{ //dont show in menu if we are in farm mode
|
||||
switch (SilentModeMenu)
|
||||
{
|
||||
case SILENT_MODE_POWER: MENU_ITEM_FUNCTION_P(_T(MSG_SILENT_MODE_OFF), lcd_silent_mode_set); break;
|
||||
case SILENT_MODE_SILENT: MENU_ITEM_FUNCTION_P(_T(MSG_SILENT_MODE_ON), lcd_silent_mode_set); break;
|
||||
case SILENT_MODE_AUTO: MENU_ITEM_FUNCTION_P(_T(MSG_AUTO_MODE_ON), lcd_silent_mode_set); break;
|
||||
default: MENU_ITEM_FUNCTION_P(_T(MSG_SILENT_MODE_OFF), lcd_silent_mode_set); break; // (probably) not needed
|
||||
}
|
||||
}
|
||||
#endif //TMC2130
|
||||
|
||||
#ifdef FILAMENT_SENSOR
|
||||
if (FSensorStateMenu == 0)
|
||||
{
|
||||
if (fsensor_not_responding)
|
||||
{
|
||||
// Filament sensor not working
|
||||
MENU_ITEM_FUNCTION_P(_i("Fil. sensor [N/A]"), lcd_fsensor_state_set);////MSG_FSENSOR_NA c=0 r=0
|
||||
MENU_ITEM_SUBMENU_P(_T(MSG_FSENS_AUTOLOAD_NA), lcd_fsensor_fail);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Filament sensor turned off, working, no problems
|
||||
MENU_ITEM_FUNCTION_P(_T(MSG_FSENSOR_OFF), lcd_fsensor_state_set);
|
||||
MENU_ITEM_SUBMENU_P(_T(MSG_FSENS_AUTOLOAD_NA), lcd_filament_autoload_info);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Filament sensor turned on, working, no problems
|
||||
MENU_ITEM_FUNCTION_P(_T(MSG_FSENSOR_ON), lcd_fsensor_state_set);
|
||||
if (fsensor_autoload_enabled)
|
||||
MENU_ITEM_FUNCTION_P(_i("F. autoload [on]"), lcd_set_filament_autoload);////MSG_FSENS_AUTOLOAD_ON c=17 r=1
|
||||
else
|
||||
MENU_ITEM_FUNCTION_P(_i("F. autoload [off]"), lcd_set_filament_autoload);////MSG_FSENS_AUTOLOAD_OFF c=17 r=1
|
||||
}
|
||||
#endif //FILAMENT_SENSOR
|
||||
settings_filament_sensor();
|
||||
|
||||
if (fans_check_enabled == true)
|
||||
MENU_ITEM_FUNCTION_P(_i("Fans check [on]"), lcd_set_fan_check);////MSG_FANS_CHECK_ON c=17 r=1
|
||||
else
|
||||
MENU_ITEM_FUNCTION_P(_i("Fans check [off]"), lcd_set_fan_check);////MSG_FANS_CHECK_OFF c=17 r=1
|
||||
|
||||
#ifdef TMC2130
|
||||
if(!farm_mode)
|
||||
{
|
||||
if (SilentModeMenu == SILENT_MODE_NORMAL) { MENU_ITEM_FUNCTION_P(_T(MSG_STEALTH_MODE_OFF), lcd_silent_mode_set); }
|
||||
else MENU_ITEM_FUNCTION_P(_T(MSG_STEALTH_MODE_ON), lcd_silent_mode_set);
|
||||
if (SilentModeMenu == SILENT_MODE_NORMAL)
|
||||
{
|
||||
if (CrashDetectMenu == 0) { MENU_ITEM_FUNCTION_P(_T(MSG_CRASHDETECT_OFF), lcd_crash_mode_set); }
|
||||
else MENU_ITEM_FUNCTION_P(_T(MSG_CRASHDETECT_ON), lcd_crash_mode_set);
|
||||
}
|
||||
else MENU_ITEM_SUBMENU_P(_T(MSG_CRASHDETECT_NA), lcd_crash_mode_info);
|
||||
}
|
||||
#ifdef LINEARITY_CORRECTION
|
||||
settings_silent_mode();
|
||||
|
||||
#if defined (TMC2130) && defined (LINEARITY_CORRECTION)
|
||||
MENU_ITEM_SUBMENU_P(_i("Lin. correction"), lcd_settings_linearity_correction_menu);
|
||||
#endif //LINEARITY_CORRECTION
|
||||
#endif //TMC2130
|
||||
#endif //LINEARITY_CORRECTION && TMC2130
|
||||
|
||||
if (temp_cal_active == false)
|
||||
MENU_ITEM_FUNCTION_P(_i("Temp. cal. [off]"), lcd_temp_calibration_set);////MSG_TEMP_CALIBRATION_OFF c=20 r=1
|
||||
|
@ -4639,45 +4690,9 @@ static void lcd_settings_menu()
|
|||
MENU_ITEM_SUBMENU_P(_i("Select language"), lcd_language_menu);////MSG_LANGUAGE_SELECT c=0 r=0
|
||||
#endif //(LANG_MODE != 0)
|
||||
|
||||
if (card.ToshibaFlashAir_isEnabled())
|
||||
MENU_ITEM_FUNCTION_P(_i("SD card [flshAir]"), lcd_toshiba_flash_air_compatibility_toggle);////MSG_TOSHIBA_FLASH_AIR_COMPATIBILITY_ON c=19 r=1
|
||||
else
|
||||
MENU_ITEM_FUNCTION_P(_i("SD card [normal]"), lcd_toshiba_flash_air_compatibility_toggle);////MSG_TOSHIBA_FLASH_AIR_COMPATIBILITY_OFF c=19 r=1
|
||||
settings_sd();
|
||||
settings_sound();
|
||||
|
||||
#ifdef SDCARD_SORT_ALPHA
|
||||
if (!farm_mode)
|
||||
{
|
||||
uint8_t sdSort;
|
||||
EEPROM_read(EEPROM_SD_SORT, (uint8_t*)&sdSort, sizeof(sdSort));
|
||||
switch (sdSort)
|
||||
{
|
||||
case SD_SORT_TIME: MENU_ITEM_FUNCTION_P(_i("Sort: [time]"), lcd_sort_type_set); break;////MSG_SORT_TIME c=17 r=1
|
||||
case SD_SORT_ALPHA: MENU_ITEM_FUNCTION_P(_i("Sort: [alphabet]"), lcd_sort_type_set); break;////MSG_SORT_ALPHA c=17 r=1
|
||||
default: MENU_ITEM_FUNCTION_P(_i("Sort: [none]"), lcd_sort_type_set);////MSG_SORT_NONE c=17 r=1
|
||||
}
|
||||
}
|
||||
#endif // SDCARD_SORT_ALPHA
|
||||
|
||||
|
||||
//-//
|
||||
switch(eSoundMode)
|
||||
{
|
||||
case e_SOUND_MODE_LOUD:
|
||||
MENU_ITEM_FUNCTION_P(_i(MSG_SOUND_MODE_LOUD),lcd_sound_state_set);
|
||||
break;
|
||||
case e_SOUND_MODE_ONCE:
|
||||
MENU_ITEM_FUNCTION_P(_i(MSG_SOUND_MODE_ONCE),lcd_sound_state_set);
|
||||
break;
|
||||
case e_SOUND_MODE_SILENT:
|
||||
MENU_ITEM_FUNCTION_P(_i(MSG_SOUND_MODE_SILENT),lcd_sound_state_set);
|
||||
break;
|
||||
case e_SOUND_MODE_MUTE:
|
||||
MENU_ITEM_FUNCTION_P(_i(MSG_SOUND_MODE_MUTE),lcd_sound_state_set);
|
||||
break;
|
||||
default:
|
||||
MENU_ITEM_FUNCTION_P(_i(MSG_SOUND_MODE_LOUD),lcd_sound_state_set);
|
||||
}
|
||||
//-//
|
||||
if (farm_mode)
|
||||
{
|
||||
MENU_ITEM_SUBMENU_P(PSTR("Farm number"), lcd_farm_no);
|
||||
|
|
Loading…
Reference in a new issue