|
@@ -3068,13 +3068,13 @@ static void lcd_move_z() {
|
|
|
* other value leads to storing Z_AXIS
|
|
|
* @param msg text to be displayed
|
|
|
*/
|
|
|
-static void _lcd_babystep(int axis, const char *msg)
|
|
|
+static void lcd_babystep_z()
|
|
|
{
|
|
|
typedef struct
|
|
|
- { // 19bytes total
|
|
|
- int8_t status; // 1byte
|
|
|
- int babystepMem[3]; // 6bytes
|
|
|
- float babystepMemMM[3]; // 12bytes
|
|
|
+ {
|
|
|
+ int8_t status;
|
|
|
+ int16_t babystepMemZ;
|
|
|
+ float babystepMemMMZ;
|
|
|
} _menu_data_t;
|
|
|
static_assert(sizeof(menu_data)>= sizeof(_menu_data_t),"_menu_data_t doesn't fit into menu_data");
|
|
|
_menu_data_t* _md = (_menu_data_t*)&(menu_data[0]);
|
|
@@ -3084,18 +3084,20 @@ static void _lcd_babystep(int axis, const char *msg)
|
|
|
// Initialize its status.
|
|
|
_md->status = 1;
|
|
|
check_babystep();
|
|
|
-
|
|
|
- EEPROM_read_B(EEPROM_BABYSTEP_X, &_md->babystepMem[0]);
|
|
|
- EEPROM_read_B(EEPROM_BABYSTEP_Y, &_md->babystepMem[1]);
|
|
|
- EEPROM_read_B(EEPROM_BABYSTEP_Z, &_md->babystepMem[2]);
|
|
|
+
|
|
|
+ if(!is_sheet_initialized()){
|
|
|
+ _md->babystepMemZ = 0;
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ _md->babystepMemZ = eeprom_read_word(reinterpret_cast<uint16_t *>(&(EEPROM_Sheets_base->
|
|
|
+ s[(eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)))].z_offset)));
|
|
|
+ }
|
|
|
|
|
|
// same logic as in babystep_load
|
|
|
if (calibration_status() >= CALIBRATION_STATUS_LIVE_ADJUST)
|
|
|
- _md->babystepMem[2] = 0;
|
|
|
+ _md->babystepMemZ = 0;
|
|
|
|
|
|
- _md->babystepMemMM[0] = _md->babystepMem[0]/cs.axis_steps_per_unit[X_AXIS];
|
|
|
- _md->babystepMemMM[1] = _md->babystepMem[1]/cs.axis_steps_per_unit[Y_AXIS];
|
|
|
- _md->babystepMemMM[2] = _md->babystepMem[2]/cs.axis_steps_per_unit[Z_AXIS];
|
|
|
+ _md->babystepMemMMZ = _md->babystepMemZ/cs.axis_steps_per_unit[Z_AXIS];
|
|
|
lcd_draw_update = 1;
|
|
|
//SERIAL_ECHO("Z baby step: ");
|
|
|
//SERIAL_ECHO(_md->babystepMem[2]);
|
|
@@ -3106,46 +3108,49 @@ static void _lcd_babystep(int axis, const char *msg)
|
|
|
if (lcd_encoder != 0)
|
|
|
{
|
|
|
if (homing_flag) lcd_encoder = 0;
|
|
|
- _md->babystepMem[axis] += (int)lcd_encoder;
|
|
|
- if (axis == 2)
|
|
|
- {
|
|
|
- if (_md->babystepMem[axis] < Z_BABYSTEP_MIN) _md->babystepMem[axis] = Z_BABYSTEP_MIN; //-3999 -> -9.99 mm
|
|
|
- else if (_md->babystepMem[axis] > Z_BABYSTEP_MAX) _md->babystepMem[axis] = Z_BABYSTEP_MAX; //0
|
|
|
- else
|
|
|
- {
|
|
|
- CRITICAL_SECTION_START
|
|
|
- babystepsTodo[axis] += (int)lcd_encoder;
|
|
|
- CRITICAL_SECTION_END
|
|
|
- }
|
|
|
- }
|
|
|
- _md->babystepMemMM[axis] = _md->babystepMem[axis]/cs.axis_steps_per_unit[axis];
|
|
|
+ _md->babystepMemZ += (int)lcd_encoder;
|
|
|
+
|
|
|
+ if (_md->babystepMemZ < Z_BABYSTEP_MIN) _md->babystepMemZ = Z_BABYSTEP_MIN; //-3999 -> -9.99 mm
|
|
|
+ else if (_md->babystepMemZ > Z_BABYSTEP_MAX) _md->babystepMemZ = Z_BABYSTEP_MAX; //0
|
|
|
+ else
|
|
|
+ {
|
|
|
+ CRITICAL_SECTION_START
|
|
|
+ babystepsTodo[Z_AXIS] += (int)lcd_encoder;
|
|
|
+ CRITICAL_SECTION_END
|
|
|
+ }
|
|
|
+
|
|
|
+ _md->babystepMemMMZ = _md->babystepMemZ/cs.axis_steps_per_unit[Z_AXIS];
|
|
|
_delay(50);
|
|
|
lcd_encoder = 0;
|
|
|
lcd_draw_update = 1;
|
|
|
}
|
|
|
if (lcd_draw_update)
|
|
|
{
|
|
|
+ SheetFormatBuffer buffer;
|
|
|
+ menu_format_sheet_E(EEPROM_Sheets_base->s[(eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)))], buffer);
|
|
|
+ lcd_set_cursor(0, 0);
|
|
|
+ lcd_print(buffer.c);
|
|
|
lcd_set_cursor(0, 1);
|
|
|
- menu_draw_float13(msg, _md->babystepMemMM[axis]);
|
|
|
+ menu_draw_float13(_i("Adjusting Z:"), _md->babystepMemMMZ); ////MSG_BABYSTEPPING_Z c=15 Beware: must include the ':' as its last character
|
|
|
}
|
|
|
if (LCD_CLICKED || menu_leaving)
|
|
|
{
|
|
|
// Only update the EEPROM when leaving the menu.
|
|
|
- EEPROM_save_B(
|
|
|
- (axis == X_AXIS) ? EEPROM_BABYSTEP_X : ((axis == Y_AXIS) ? EEPROM_BABYSTEP_Y : EEPROM_BABYSTEP_Z),
|
|
|
- &_md->babystepMem[axis]);
|
|
|
- if(Z_AXIS == axis) calibration_status_store(CALIBRATION_STATUS_CALIBRATED);
|
|
|
+ eeprom_update_word(reinterpret_cast<uint16_t *>(&(EEPROM_Sheets_base->
|
|
|
+ s[(eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)))].z_offset)),
|
|
|
+ _md->babystepMemZ);
|
|
|
+ eeprom_update_byte(&(EEPROM_Sheets_base->s[(eeprom_read_byte(
|
|
|
+ &(EEPROM_Sheets_base->active_sheet)))].bed_temp),
|
|
|
+ target_temperature_bed);
|
|
|
+ eeprom_update_byte(&(EEPROM_Sheets_base->s[(eeprom_read_byte(
|
|
|
+ &(EEPROM_Sheets_base->active_sheet)))].pinda_temp),
|
|
|
+ current_temperature_pinda);
|
|
|
+ calibration_status_store(CALIBRATION_STATUS_CALIBRATED);
|
|
|
}
|
|
|
if (LCD_CLICKED) menu_back();
|
|
|
}
|
|
|
|
|
|
|
|
|
-static void lcd_babystep_z()
|
|
|
-{
|
|
|
- _lcd_babystep(Z_AXIS, (_i("Adjusting Z:")));////MSG_BABYSTEPPING_Z c=15 Beware: must include the ':' as its last character
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
typedef struct
|
|
|
{ // 12bytes + 9bytes = 21bytes total
|
|
|
menu_data_edit_t reserved; //12 bytes reserved for number editing functions
|
|
@@ -6300,6 +6305,95 @@ void lcd_resume_print()
|
|
|
isPrintPaused = false;
|
|
|
}
|
|
|
|
|
|
+static void change_sheet(uint8_t sheet_num)
|
|
|
+{
|
|
|
+ eeprom_update_byte(&(EEPROM_Sheets_base->active_sheet), sheet_num);
|
|
|
+ if(is_sheet_initialized())
|
|
|
+ calibration_status_store(CALIBRATION_STATUS_CALIBRATED);
|
|
|
+ else
|
|
|
+ calibration_status_store(CALIBRATION_STATUS_LIVE_ADJUST);
|
|
|
+
|
|
|
+ menu_back(3);
|
|
|
+}
|
|
|
+
|
|
|
+static void lcd_select_sheet_0_menu()
|
|
|
+{
|
|
|
+ change_sheet(0);
|
|
|
+}
|
|
|
+static void lcd_select_sheet_1_menu()
|
|
|
+{
|
|
|
+ change_sheet(1);
|
|
|
+}
|
|
|
+static void lcd_select_sheet_2_menu()
|
|
|
+{
|
|
|
+ change_sheet(2);
|
|
|
+}
|
|
|
+
|
|
|
+static void lcd_select_sheet_menu()
|
|
|
+{
|
|
|
+ MENU_BEGIN();
|
|
|
+ MENU_ITEM_BACK_P(_T(MSG_BACK));
|
|
|
+ MENU_ITEM_SUBMENU_E(EEPROM_Sheets_base->s[0], lcd_select_sheet_0_menu);
|
|
|
+ MENU_ITEM_SUBMENU_E(EEPROM_Sheets_base->s[1], lcd_select_sheet_1_menu);
|
|
|
+ MENU_ITEM_SUBMENU_E(EEPROM_Sheets_base->s[2], lcd_select_sheet_2_menu);
|
|
|
+ MENU_END();
|
|
|
+}
|
|
|
+
|
|
|
+static void lcd_rename_sheet_menu()
|
|
|
+{
|
|
|
+ struct MenuData
|
|
|
+ {
|
|
|
+ bool initialized;
|
|
|
+ uint8_t selected;
|
|
|
+ char name[sizeof(Sheet::name)];
|
|
|
+ };
|
|
|
+ static_assert(sizeof(menu_data)>= sizeof(MenuData),"MenuData doesn't fit into menu_data");
|
|
|
+ MenuData* menuData = (MenuData*)&(menu_data[0]);
|
|
|
+
|
|
|
+ if (!menuData->initialized)
|
|
|
+ {
|
|
|
+ eeprom_read_block(menuData->name, EEPROM_Sheets_base->s[(eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)))].name, sizeof(Sheet::name));
|
|
|
+ lcd_encoder = menuData->name[0];
|
|
|
+ menuData->initialized = true;
|
|
|
+ }
|
|
|
+ if (lcd_encoder < '\x20') lcd_encoder = '\x20';
|
|
|
+ if (lcd_encoder > '\x7F') lcd_encoder = '\x7F';
|
|
|
+
|
|
|
+ menuData->name[menuData->selected] = lcd_encoder;
|
|
|
+ lcd_set_cursor(0,0);
|
|
|
+ for (uint_least8_t i = 0; i < sizeof(Sheet::name); ++i)
|
|
|
+ {
|
|
|
+ lcd_putc(menuData->name[i]);
|
|
|
+ }
|
|
|
+ lcd_set_cursor(menuData->selected, 1);
|
|
|
+ lcd_putc('^');
|
|
|
+ if (lcd_clicked())
|
|
|
+ {
|
|
|
+ if ((menuData->selected + 1u) < sizeof(Sheet::name))
|
|
|
+ {
|
|
|
+ lcd_encoder = menuData->name[++(menuData->selected)];
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ eeprom_update_block(menuData->name,
|
|
|
+ EEPROM_Sheets_base->s[(eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)))].name,
|
|
|
+ sizeof(Sheet::name));
|
|
|
+ menu_back();
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+static void lcd_sheet_menu()
|
|
|
+{
|
|
|
+ MENU_BEGIN();
|
|
|
+ MENU_ITEM_BACK_P(_T(MSG_MAIN));
|
|
|
+ MENU_ITEM_SUBMENU_P(_T(MSG_SELECT), lcd_select_sheet_menu); //// c=18
|
|
|
+ MENU_ITEM_SUBMENU_P(_T(MSG_RENAME), lcd_rename_sheet_menu); //// c=18
|
|
|
+ MENU_ITEM_SUBMENU_P(_T(MSG_V2_CALIBRATION), lcd_v2_calibration); ////MSG_V2_CALIBRATION c=17 r=1
|
|
|
+
|
|
|
+ MENU_END();
|
|
|
+}
|
|
|
+
|
|
|
static void lcd_main_menu()
|
|
|
{
|
|
|
|
|
@@ -6321,55 +6415,6 @@ static void lcd_main_menu()
|
|
|
MENU_ITEM_FUNCTION_P(PSTR("recover print"), recover_print);
|
|
|
MENU_ITEM_FUNCTION_P(PSTR("power panic"), uvlo_);
|
|
|
#endif //TMC2130_DEBUG
|
|
|
-
|
|
|
- /* if (farm_mode && !IS_SD_PRINTING )
|
|
|
- {
|
|
|
-
|
|
|
- int tempScrool = 0;
|
|
|
- if (lcd_draw_update == 0 && LCD_CLICKED == 0)
|
|
|
- //_delay(100);
|
|
|
- return; // nothing to do (so don't thrash the SD card)
|
|
|
- uint16_t fileCnt = card.getnrfilenames();
|
|
|
-
|
|
|
- card.getWorkDirName();
|
|
|
- if (card.filename[0] == '/')
|
|
|
- {
|
|
|
-#if SDCARDDETECT == -1
|
|
|
- MENU_ITEM_FUNCTION_P(_T(MSG_REFRESH), lcd_sd_refresh);
|
|
|
-#endif
|
|
|
- } else {
|
|
|
- MENU_ITEM_FUNCTION_P(PSTR(LCD_STR_FOLDER ".."), lcd_sd_updir);
|
|
|
- }
|
|
|
-
|
|
|
- for (uint16_t i = 0; i < fileCnt; i++)
|
|
|
- {
|
|
|
- if (menu_item == menu_line)
|
|
|
- {
|
|
|
-#ifndef SDCARD_RATHERRECENTFIRST
|
|
|
- card.getfilename(i);
|
|
|
-#else
|
|
|
- card.getfilename(fileCnt - 1 - i);
|
|
|
-#endif
|
|
|
- if (card.filenameIsDir)
|
|
|
- {
|
|
|
- MENU_ITEM_SDDIR(_T(MSG_CARD_MENU), card.filename, card.longFilename);
|
|
|
- } else {
|
|
|
-
|
|
|
- MENU_ITEM_SDFILE(_T(MSG_CARD_MENU), card.filename, card.longFilename);
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
- } else {
|
|
|
- MENU_ITEM_DUMMY();
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- MENU_ITEM_BACK_P(PSTR("- - - - - - - - -"));
|
|
|
-
|
|
|
-
|
|
|
- }*/
|
|
|
|
|
|
if ( ( IS_SD_PRINTING || is_usb_printing || (lcd_commands_type == LcdCommands::Layer1Cal)) && (current_position[Z_AXIS] < Z_HEIGHT_HIDE_LIVE_ADJUST_MENU) && !homing_flag && !mesh_bed_leveling_flag)
|
|
|
{
|
|
@@ -6385,6 +6430,8 @@ static void lcd_main_menu()
|
|
|
MENU_ITEM_SUBMENU_P(_i("Preheat"), lcd_preheat_menu);////MSG_PREHEAT
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
#ifdef SDSUPPORT
|
|
|
if (card.cardOK || lcd_commands_type == LcdCommands::Layer1Cal)
|
|
|
{
|
|
@@ -6475,6 +6522,8 @@ static void lcd_main_menu()
|
|
|
|
|
|
}
|
|
|
|
|
|
+ if(!isPrintPaused)MENU_ITEM_SUBMENU_E(EEPROM_Sheets_base->s[(eeprom_read_byte(&(EEPROM_Sheets_base->active_sheet)))], lcd_sheet_menu);
|
|
|
+
|
|
|
if (!is_usb_printing && (lcd_commands_type != LcdCommands::Layer1Cal))
|
|
|
{
|
|
|
MENU_ITEM_SUBMENU_P(_i("Statistics "), lcd_menu_statistics);////MSG_STATISTICS
|