Conditionalize functions that rely on SDSUPPORT
This commit is contained in:
parent
fabf3ae4a0
commit
e27dd5c22d
|
@ -504,27 +504,31 @@ void lcd_implementation_drawedit(const char* pstr, char* value) {
|
|||
lcd_print(value);
|
||||
}
|
||||
|
||||
static void _drawmenu_sd(bool isSelected, uint8_t row, const char* pstr, const char* filename, char * const longFilename, bool isDir) {
|
||||
char c;
|
||||
uint8_t n = LCD_WIDTH - 1;
|
||||
#if ENABLED(SDSUPPORT)
|
||||
|
||||
if (longFilename[0]) {
|
||||
filename = longFilename;
|
||||
longFilename[n] = '\0';
|
||||
static void _drawmenu_sd(bool isSelected, uint8_t row, const char* pstr, const char* filename, char * const longFilename, bool isDir) {
|
||||
char c;
|
||||
uint8_t n = LCD_WIDTH - 1;
|
||||
|
||||
if (longFilename[0]) {
|
||||
filename = longFilename;
|
||||
longFilename[n] = '\0';
|
||||
}
|
||||
|
||||
lcd_implementation_mark_as_selected(row, isSelected);
|
||||
|
||||
if (isDir) lcd_print(LCD_STR_FOLDER[0]);
|
||||
while ((c = *filename)) {
|
||||
n -= lcd_print(c);
|
||||
filename++;
|
||||
}
|
||||
while (n--) lcd_print(' ');
|
||||
}
|
||||
|
||||
lcd_implementation_mark_as_selected(row, isSelected);
|
||||
#define lcd_implementation_drawmenu_sdfile(sel, row, pstr, filename, longFilename) _drawmenu_sd(sel, row, pstr, filename, longFilename, false)
|
||||
#define lcd_implementation_drawmenu_sddirectory(sel, row, pstr, filename, longFilename) _drawmenu_sd(sel, row, pstr, filename, longFilename, true)
|
||||
|
||||
if (isDir) lcd_print(LCD_STR_FOLDER[0]);
|
||||
while ((c = *filename)) {
|
||||
n -= lcd_print(c);
|
||||
filename++;
|
||||
}
|
||||
while (n--) lcd_print(' ');
|
||||
}
|
||||
|
||||
#define lcd_implementation_drawmenu_sdfile(sel, row, pstr, filename, longFilename) _drawmenu_sd(sel, row, pstr, filename, longFilename, false)
|
||||
#define lcd_implementation_drawmenu_sddirectory(sel, row, pstr, filename, longFilename) _drawmenu_sd(sel, row, pstr, filename, longFilename, true)
|
||||
#endif //SDSUPPORT
|
||||
|
||||
#define lcd_implementation_drawmenu_back(sel, row, pstr, data) lcd_implementation_drawmenu_generic(sel, row, pstr, LCD_STR_UPLEVEL[0], LCD_STR_UPLEVEL[0])
|
||||
#define lcd_implementation_drawmenu_submenu(sel, row, pstr, data) lcd_implementation_drawmenu_generic(sel, row, pstr, '>', LCD_STR_ARROW_RIGHT[0])
|
||||
|
|
|
@ -55,13 +55,14 @@ static void lcd_status_screen();
|
|||
static void lcd_control_temperature_preheat_abs_settings_menu();
|
||||
static void lcd_control_motion_menu();
|
||||
static void lcd_control_volumetric_menu();
|
||||
|
||||
#if ENABLED(HAS_LCD_CONTRAST)
|
||||
static void lcd_set_contrast();
|
||||
#endif
|
||||
|
||||
#if ENABLED(FWRETRACT)
|
||||
static void lcd_control_retract_menu();
|
||||
#endif
|
||||
static void lcd_sdcard_menu();
|
||||
|
||||
#if ENABLED(DELTA_CALIBRATION_MENU)
|
||||
static void lcd_delta_calibrate_menu();
|
||||
|
@ -79,8 +80,6 @@ static void lcd_status_screen();
|
|||
static void menu_action_submenu(menuFunc_t data);
|
||||
static void menu_action_gcode(const char* pgcode);
|
||||
static void menu_action_function(menuFunc_t data);
|
||||
static void menu_action_sdfile(const char* filename, char* longFilename);
|
||||
static void menu_action_sddirectory(const char* filename, char* longFilename);
|
||||
static void menu_action_setting_edit_bool(const char* pstr, bool* ptr);
|
||||
static void menu_action_setting_edit_int3(const char* pstr, int* ptr, int minValue, int maxValue);
|
||||
static void menu_action_setting_edit_float3(const char* pstr, float* ptr, float minValue, float maxValue);
|
||||
|
@ -100,6 +99,12 @@ static void lcd_status_screen();
|
|||
static void menu_action_setting_edit_callback_float52(const char* pstr, float* ptr, float minValue, float maxValue, menuFunc_t callbackFunc);
|
||||
static void menu_action_setting_edit_callback_long5(const char* pstr, unsigned long* ptr, unsigned long minValue, unsigned long maxValue, menuFunc_t callbackFunc);
|
||||
|
||||
#if ENABLED(SDSUPPORT)
|
||||
static void lcd_sdcard_menu();
|
||||
static void menu_action_sdfile(const char* filename, char* longFilename);
|
||||
static void menu_action_sddirectory(const char* filename, char* longFilename);
|
||||
#endif
|
||||
|
||||
#define ENCODER_FEEDRATE_DEADZONE 10
|
||||
|
||||
#if DISABLED(LCD_I2C_VIKI)
|
||||
|
@ -578,8 +583,11 @@ void _lcd_preheat(int endnum, const float temph, const float tempb, const int fa
|
|||
fanSpeed = fan;
|
||||
lcd_return_to_status();
|
||||
}
|
||||
void lcd_preheat_pla0() { _lcd_preheat(0, plaPreheatHotendTemp, plaPreheatHPBTemp, plaPreheatFanSpeed); }
|
||||
void lcd_preheat_abs0() { _lcd_preheat(0, absPreheatHotendTemp, absPreheatHPBTemp, absPreheatFanSpeed); }
|
||||
|
||||
#if TEMP_SENSOR_0 != 0
|
||||
void lcd_preheat_pla0() { _lcd_preheat(0, plaPreheatHotendTemp, plaPreheatHPBTemp, plaPreheatFanSpeed); }
|
||||
void lcd_preheat_abs0() { _lcd_preheat(0, absPreheatHotendTemp, absPreheatHPBTemp, absPreheatFanSpeed); }
|
||||
#endif
|
||||
|
||||
#if EXTRUDERS > 1
|
||||
void lcd_preheat_pla1() { _lcd_preheat(1, plaPreheatHotendTemp, plaPreheatHPBTemp, plaPreheatFanSpeed); }
|
||||
|
@ -613,14 +621,15 @@ void lcd_preheat_abs0() { _lcd_preheat(0, absPreheatHotendTemp, absPreheatHPBTem
|
|||
void lcd_preheat_abs_bedonly() { _lcd_preheat(0, 0, absPreheatHPBTemp, absPreheatFanSpeed); }
|
||||
#endif
|
||||
|
||||
static void lcd_preheat_pla_menu() {
|
||||
START_MENU();
|
||||
MENU_ITEM(back, MSG_PREPARE, lcd_prepare_menu);
|
||||
#if EXTRUDERS == 1
|
||||
MENU_ITEM(function, MSG_PREHEAT_PLA, lcd_preheat_pla0);
|
||||
#else
|
||||
MENU_ITEM(function, MSG_PREHEAT_PLA_N MSG_H1, lcd_preheat_pla0);
|
||||
#if EXTRUDERS > 1
|
||||
#if TEMP_SENSOR_0 != 0 && (TEMP_SENSOR_1 != 0 || TEMP_SENSOR_2 != 0 || TEMP_SENSOR_3 != 0 || TEMP_SENSOR_BED != 0)
|
||||
|
||||
static void lcd_preheat_pla_menu() {
|
||||
START_MENU();
|
||||
MENU_ITEM(back, MSG_PREPARE, lcd_prepare_menu);
|
||||
#if EXTRUDERS == 1
|
||||
MENU_ITEM(function, MSG_PREHEAT_PLA, lcd_preheat_pla0);
|
||||
#else
|
||||
MENU_ITEM(function, MSG_PREHEAT_PLA_N MSG_H1, lcd_preheat_pla0);
|
||||
MENU_ITEM(function, MSG_PREHEAT_PLA_N MSG_H2, lcd_preheat_pla1);
|
||||
#if EXTRUDERS > 2
|
||||
MENU_ITEM(function, MSG_PREHEAT_PLA_N MSG_H3, lcd_preheat_pla2);
|
||||
|
@ -628,23 +637,21 @@ static void lcd_preheat_pla_menu() {
|
|||
MENU_ITEM(function, MSG_PREHEAT_PLA_N MSG_H4, lcd_preheat_pla3);
|
||||
#endif
|
||||
#endif
|
||||
MENU_ITEM(function, MSG_PREHEAT_PLA_ALL, lcd_preheat_pla0123);
|
||||
#endif
|
||||
MENU_ITEM(function, MSG_PREHEAT_PLA_ALL, lcd_preheat_pla0123);
|
||||
#endif
|
||||
#if TEMP_SENSOR_BED != 0
|
||||
MENU_ITEM(function, MSG_PREHEAT_PLA_BEDONLY, lcd_preheat_pla_bedonly);
|
||||
#endif
|
||||
END_MENU();
|
||||
}
|
||||
#if TEMP_SENSOR_BED != 0
|
||||
MENU_ITEM(function, MSG_PREHEAT_PLA_BEDONLY, lcd_preheat_pla_bedonly);
|
||||
#endif
|
||||
END_MENU();
|
||||
}
|
||||
|
||||
static void lcd_preheat_abs_menu() {
|
||||
START_MENU();
|
||||
MENU_ITEM(back, MSG_PREPARE, lcd_prepare_menu);
|
||||
#if EXTRUDERS == 1
|
||||
MENU_ITEM(function, MSG_PREHEAT_ABS, lcd_preheat_abs0);
|
||||
#else
|
||||
MENU_ITEM(function, MSG_PREHEAT_ABS_N MSG_H1, lcd_preheat_abs0);
|
||||
#if EXTRUDERS > 1
|
||||
static void lcd_preheat_abs_menu() {
|
||||
START_MENU();
|
||||
MENU_ITEM(back, MSG_PREPARE, lcd_prepare_menu);
|
||||
#if EXTRUDERS == 1
|
||||
MENU_ITEM(function, MSG_PREHEAT_ABS, lcd_preheat_abs0);
|
||||
#else
|
||||
MENU_ITEM(function, MSG_PREHEAT_ABS_N MSG_H1, lcd_preheat_abs0);
|
||||
MENU_ITEM(function, MSG_PREHEAT_ABS_N MSG_H2, lcd_preheat_abs1);
|
||||
#if EXTRUDERS > 2
|
||||
MENU_ITEM(function, MSG_PREHEAT_ABS_N MSG_H3, lcd_preheat_abs2);
|
||||
|
@ -652,14 +659,15 @@ static void lcd_preheat_abs_menu() {
|
|||
MENU_ITEM(function, MSG_PREHEAT_ABS_N MSG_H4, lcd_preheat_abs3);
|
||||
#endif
|
||||
#endif
|
||||
MENU_ITEM(function, MSG_PREHEAT_ABS_ALL, lcd_preheat_abs0123);
|
||||
#endif
|
||||
MENU_ITEM(function, MSG_PREHEAT_ABS_ALL, lcd_preheat_abs0123);
|
||||
#endif
|
||||
#if TEMP_SENSOR_BED != 0
|
||||
MENU_ITEM(function, MSG_PREHEAT_ABS_BEDONLY, lcd_preheat_abs_bedonly);
|
||||
#endif
|
||||
END_MENU();
|
||||
}
|
||||
#if TEMP_SENSOR_BED != 0
|
||||
MENU_ITEM(function, MSG_PREHEAT_ABS_BEDONLY, lcd_preheat_abs_bedonly);
|
||||
#endif
|
||||
END_MENU();
|
||||
}
|
||||
|
||||
#endif // TEMP_SENSOR_0 && (TEMP_SENSOR_1 || TEMP_SENSOR_2 || TEMP_SENSOR_3 || TEMP_SENSOR_BED)
|
||||
|
||||
void lcd_cooldown() {
|
||||
disable_all_heaters();
|
||||
|
@ -1441,24 +1449,25 @@ static void menu_action_back(menuFunc_t func) { lcd_goto_menu(func); }
|
|||
static void menu_action_submenu(menuFunc_t func) { lcd_goto_menu(func); }
|
||||
static void menu_action_gcode(const char* pgcode) { enqueuecommands_P(pgcode); }
|
||||
static void menu_action_function(menuFunc_t func) { (*func)(); }
|
||||
static void menu_action_sdfile(const char* filename, char* longFilename) {
|
||||
char cmd[30];
|
||||
char* c;
|
||||
sprintf_P(cmd, PSTR("M23 %s"), filename);
|
||||
for(c = &cmd[4]; *c; c++) *c = tolower(*c);
|
||||
enqueuecommand(cmd);
|
||||
enqueuecommands_P(PSTR("M24"));
|
||||
lcd_return_to_status();
|
||||
}
|
||||
|
||||
#if ENABLED(SDSUPPORT)
|
||||
|
||||
static void menu_action_sdfile(const char* filename, char* longFilename) {
|
||||
char cmd[30];
|
||||
char* c;
|
||||
sprintf_P(cmd, PSTR("M23 %s"), filename);
|
||||
for(c = &cmd[4]; *c; c++) *c = tolower(*c);
|
||||
enqueuecommand(cmd);
|
||||
enqueuecommands_P(PSTR("M24"));
|
||||
lcd_return_to_status();
|
||||
}
|
||||
|
||||
static void menu_action_sddirectory(const char* filename, char* longFilename) {
|
||||
card.chdir(filename);
|
||||
encoderPosition = 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif //SDSUPPORT
|
||||
|
||||
static void menu_action_setting_edit_bool(const char* pstr, bool* ptr) { *ptr = !(*ptr); }
|
||||
static void menu_action_setting_edit_callback_bool(const char* pstr, bool* ptr, menuFunc_t callback) {
|
||||
|
|
|
@ -794,30 +794,34 @@ void lcd_implementation_drawedit(const char* pstr, char* value) {
|
|||
lcd_print(value);
|
||||
}
|
||||
|
||||
static void lcd_implementation_drawmenu_sd(bool sel, uint8_t row, const char* pstr, const char* filename, char* longFilename, uint8_t concat, char post_char) {
|
||||
char c;
|
||||
uint8_t n = LCD_WIDTH - concat;
|
||||
lcd.setCursor(0, row);
|
||||
lcd.print(sel ? '>' : ' ');
|
||||
if (longFilename[0]) {
|
||||
filename = longFilename;
|
||||
longFilename[n] = '\0';
|
||||
}
|
||||
while ((c = *filename) && n > 0) {
|
||||
n -= lcd_print(c);
|
||||
filename++;
|
||||
}
|
||||
while (n--) lcd.print(' ');
|
||||
lcd.print(post_char);
|
||||
}
|
||||
#if ENABLED(SDSUPPORT)
|
||||
|
||||
static void lcd_implementation_drawmenu_sdfile(bool sel, uint8_t row, const char* pstr, const char* filename, char* longFilename) {
|
||||
lcd_implementation_drawmenu_sd(sel, row, pstr, filename, longFilename, 2, ' ');
|
||||
}
|
||||
static void lcd_implementation_drawmenu_sd(bool sel, uint8_t row, const char* pstr, const char* filename, char* longFilename, uint8_t concat, char post_char) {
|
||||
char c;
|
||||
uint8_t n = LCD_WIDTH - concat;
|
||||
lcd.setCursor(0, row);
|
||||
lcd.print(sel ? '>' : ' ');
|
||||
if (longFilename[0]) {
|
||||
filename = longFilename;
|
||||
longFilename[n] = '\0';
|
||||
}
|
||||
while ((c = *filename) && n > 0) {
|
||||
n -= lcd_print(c);
|
||||
filename++;
|
||||
}
|
||||
while (n--) lcd.print(' ');
|
||||
lcd.print(post_char);
|
||||
}
|
||||
|
||||
static void lcd_implementation_drawmenu_sddirectory(bool sel, uint8_t row, const char* pstr, const char* filename, char* longFilename) {
|
||||
lcd_implementation_drawmenu_sd(sel, row, pstr, filename, longFilename, 2, LCD_STR_FOLDER[0]);
|
||||
}
|
||||
static void lcd_implementation_drawmenu_sdfile(bool sel, uint8_t row, const char* pstr, const char* filename, char* longFilename) {
|
||||
lcd_implementation_drawmenu_sd(sel, row, pstr, filename, longFilename, 2, ' ');
|
||||
}
|
||||
|
||||
static void lcd_implementation_drawmenu_sddirectory(bool sel, uint8_t row, const char* pstr, const char* filename, char* longFilename) {
|
||||
lcd_implementation_drawmenu_sd(sel, row, pstr, filename, longFilename, 2, LCD_STR_FOLDER[0]);
|
||||
}
|
||||
|
||||
#endif //SDSUPPORT
|
||||
|
||||
#define lcd_implementation_drawmenu_back(sel, row, pstr, data) lcd_implementation_drawmenu_generic(sel, row, pstr, LCD_STR_UPLEVEL[0], LCD_STR_UPLEVEL[0])
|
||||
#define lcd_implementation_drawmenu_submenu(sel, row, pstr, data) lcd_implementation_drawmenu_generic(sel, row, pstr, '>', LCD_STR_ARROW_RIGHT[0])
|
||||
|
|
Loading…
Reference in a new issue