2018-10-27 19:53:05 +00:00
|
|
|
/**
|
|
|
|
* Marlin 3D Printer Firmware
|
2020-02-03 14:00:57 +00:00
|
|
|
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
2018-10-27 19:53:05 +00:00
|
|
|
*
|
|
|
|
* Based on Sprinter and grbl.
|
2019-06-28 04:57:50 +00:00
|
|
|
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
|
2018-10-27 19:53:05 +00:00
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2020-07-23 03:20:14 +00:00
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
2018-10-27 19:53:05 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
//
|
|
|
|
// Tune Menu
|
|
|
|
//
|
|
|
|
|
|
|
|
#include "../../inc/MarlinConfigPre.h"
|
|
|
|
|
|
|
|
#if HAS_LCD_MENU
|
|
|
|
|
|
|
|
#include "menu.h"
|
|
|
|
#include "../../module/motion.h"
|
|
|
|
#include "../../module/planner.h"
|
|
|
|
#include "../../module/temperature.h"
|
2020-01-03 01:01:38 +00:00
|
|
|
#include "../../MarlinCore.h"
|
2018-10-27 19:53:05 +00:00
|
|
|
|
|
|
|
#if HAS_LEVELING
|
|
|
|
#include "../../feature/bedlevel/bedlevel.h"
|
|
|
|
#endif
|
|
|
|
|
2019-01-21 05:24:53 +00:00
|
|
|
#if ENABLED(SINGLENOZZLE)
|
|
|
|
#include "../../module/tool_change.h"
|
|
|
|
#endif
|
|
|
|
|
2018-10-27 19:53:05 +00:00
|
|
|
#if ENABLED(BABYSTEPPING)
|
|
|
|
|
2019-04-06 23:04:34 +00:00
|
|
|
#include "../../feature/babystep.h"
|
|
|
|
#include "../lcdprint.h"
|
|
|
|
#if HAS_GRAPHICAL_LCD
|
|
|
|
#include "../dogm/ultralcd_DOGM.h"
|
|
|
|
#endif
|
2018-10-27 19:53:05 +00:00
|
|
|
|
2019-04-06 23:04:34 +00:00
|
|
|
void _lcd_babystep(const AxisEnum axis, PGM_P const msg) {
|
2018-11-11 18:16:24 +00:00
|
|
|
if (ui.use_click()) return ui.goto_previous_screen_no_defer();
|
|
|
|
if (ui.encoderPosition) {
|
2019-10-28 21:44:17 +00:00
|
|
|
const int16_t steps = int16_t(ui.encoderPosition) * (
|
|
|
|
#if ENABLED(BABYSTEP_XY)
|
2020-07-03 14:24:41 +00:00
|
|
|
axis == X_AXIS ? BABYSTEP_SIZE_X :
|
|
|
|
axis == Y_AXIS ? BABYSTEP_SIZE_Y :
|
2019-10-28 21:44:17 +00:00
|
|
|
#endif
|
2020-07-03 14:24:41 +00:00
|
|
|
BABYSTEP_SIZE_Z
|
2019-10-28 21:44:17 +00:00
|
|
|
);
|
2018-11-11 18:16:24 +00:00
|
|
|
ui.encoderPosition = 0;
|
|
|
|
ui.refresh(LCDVIEW_REDRAW_NOW);
|
2019-04-06 23:04:34 +00:00
|
|
|
babystep.add_steps(axis, steps);
|
|
|
|
}
|
|
|
|
if (ui.should_draw()) {
|
|
|
|
const float spm = planner.steps_to_mm[axis];
|
2020-03-17 20:12:52 +00:00
|
|
|
MenuEditItemBase::draw_edit_screen(msg, BABYSTEP_TO_STR(spm * babystep.accum));
|
2019-04-06 23:04:34 +00:00
|
|
|
#if ENABLED(BABYSTEP_DISPLAY_TOTAL)
|
2020-04-22 21:35:03 +00:00
|
|
|
const bool in_view = TERN1(HAS_GRAPHICAL_LCD, PAGE_CONTAINS(LCD_PIXEL_HEIGHT - MENU_FONT_HEIGHT, LCD_PIXEL_HEIGHT - 1));
|
2019-04-06 23:04:34 +00:00
|
|
|
if (in_view) {
|
2020-04-22 21:35:03 +00:00
|
|
|
TERN_(HAS_GRAPHICAL_LCD, ui.set_font(FONT_MENU));
|
|
|
|
lcd_moveto(0, TERN(HAS_GRAPHICAL_LCD, LCD_PIXEL_HEIGHT - MENU_FONT_DESCENT, LCD_HEIGHT - 1));
|
2019-10-10 00:46:10 +00:00
|
|
|
lcd_put_u8str_P(GET_TEXT(MSG_BABYSTEP_TOTAL));
|
|
|
|
lcd_put_wchar(':');
|
2020-03-17 20:12:52 +00:00
|
|
|
lcd_put_u8str(BABYSTEP_TO_STR(spm * babystep.axis_total[BS_TOTAL_IND(axis)]));
|
2019-04-06 23:04:34 +00:00
|
|
|
}
|
|
|
|
#endif
|
2018-10-27 19:53:05 +00:00
|
|
|
}
|
2019-04-06 23:04:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
inline void _lcd_babystep_go(const screenFunc_t screen) {
|
|
|
|
ui.goto_screen(screen);
|
|
|
|
ui.defer_status_screen();
|
|
|
|
babystep.accum = 0;
|
2018-10-27 19:53:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#if ENABLED(BABYSTEP_XY)
|
2019-10-10 00:46:10 +00:00
|
|
|
void _lcd_babystep_x() { _lcd_babystep(X_AXIS, GET_TEXT(MSG_BABYSTEP_X)); }
|
|
|
|
void _lcd_babystep_y() { _lcd_babystep(Y_AXIS, GET_TEXT(MSG_BABYSTEP_Y)); }
|
2018-10-27 19:53:05 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if DISABLED(BABYSTEP_ZPROBE_OFFSET)
|
2019-10-10 00:46:10 +00:00
|
|
|
void _lcd_babystep_z() { _lcd_babystep(Z_AXIS, GET_TEXT(MSG_BABYSTEP_Z)); }
|
2019-10-08 00:44:33 +00:00
|
|
|
void lcd_babystep_z() { _lcd_babystep_go(_lcd_babystep_z); }
|
2018-10-27 19:53:05 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif // BABYSTEPPING
|
|
|
|
|
|
|
|
void menu_tune() {
|
|
|
|
START_MENU();
|
2019-10-03 10:38:30 +00:00
|
|
|
BACK_ITEM(MSG_MAIN);
|
2018-10-27 19:53:05 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// Speed:
|
|
|
|
//
|
2019-10-03 10:38:30 +00:00
|
|
|
EDIT_ITEM(int3, MSG_SPEED, &feedrate_percentage, 10, 999);
|
2018-10-27 19:53:05 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// Manual bed leveling, Bed Z:
|
|
|
|
//
|
2019-03-17 04:43:06 +00:00
|
|
|
#if BOTH(MESH_BED_LEVELING, LCD_BED_LEVELING)
|
2019-10-03 10:38:30 +00:00
|
|
|
EDIT_ITEM(float43, MSG_BED_Z, &mbl.z_offset, -1, 1);
|
2018-10-27 19:53:05 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
//
|
|
|
|
// Nozzle:
|
|
|
|
// Nozzle [1-4]:
|
|
|
|
//
|
|
|
|
#if HOTENDS == 1
|
2020-04-27 09:48:11 +00:00
|
|
|
EDIT_ITEM_FAST(int3, MSG_NOZZLE, &thermalManager.temp_hotend[0].target, 0, HEATER_0_MAXTEMP - HOTEND_OVERSHOOT, []{ thermalManager.start_watching_hotend(0); });
|
2020-04-20 04:56:55 +00:00
|
|
|
#elif HAS_MULTI_HOTEND
|
2020-01-08 23:43:36 +00:00
|
|
|
HOTEND_LOOP()
|
2020-04-27 12:53:58 +00:00
|
|
|
EDIT_ITEM_FAST_N(int3, e, MSG_NOZZLE_N, &thermalManager.temp_hotend[e].target, 0, thermalManager.heater_maxtemp[e] - HOTEND_OVERSHOOT, []{ thermalManager.start_watching_hotend(MenuItemBase::itemIndex); });
|
2019-11-15 02:30:30 +00:00
|
|
|
#endif
|
2018-10-27 19:53:05 +00:00
|
|
|
|
2020-04-28 05:21:23 +00:00
|
|
|
#if ENABLED(SINGLENOZZLE_STANDBY_TEMP)
|
|
|
|
LOOP_S_L_N(e, 1, EXTRUDERS)
|
|
|
|
EDIT_ITEM_FAST_N(uint16_3, e, MSG_NOZZLE_STANDBY, &singlenozzle_temp[e], 0, thermalManager.heater_maxtemp[0] - HOTEND_OVERSHOOT);
|
2019-01-21 05:24:53 +00:00
|
|
|
#endif
|
|
|
|
|
2018-10-27 19:53:05 +00:00
|
|
|
//
|
|
|
|
// Bed:
|
|
|
|
//
|
|
|
|
#if HAS_HEATED_BED
|
2020-04-27 09:41:18 +00:00
|
|
|
EDIT_ITEM_FAST(int3, MSG_BED, &thermalManager.temp_bed.target, 0, BED_MAX_TARGET, thermalManager.start_watching_bed);
|
2018-10-27 19:53:05 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
//
|
|
|
|
// Fan Speed:
|
|
|
|
//
|
2020-04-27 09:41:18 +00:00
|
|
|
#if HAS_FAN
|
2020-01-25 08:13:39 +00:00
|
|
|
|
|
|
|
auto on_fan_update = []{
|
|
|
|
thermalManager.set_fan_speed(MenuItemBase::itemIndex, editable.uint8);
|
|
|
|
};
|
|
|
|
|
|
|
|
#if HAS_FAN1 || HAS_FAN2 || HAS_FAN3 || HAS_FAN4 || HAS_FAN5 || HAS_FAN6 || HAS_FAN7
|
|
|
|
auto fan_edit_items = [&](const uint8_t f) {
|
2020-04-29 19:52:42 +00:00
|
|
|
editable.uint8 = thermalManager.fan_speed[f];
|
|
|
|
EDIT_ITEM_FAST_N(percent, f, MSG_FAN_SPEED_N, &editable.uint8, 0, 255, on_fan_update);
|
2020-01-25 08:13:39 +00:00
|
|
|
#if ENABLED(EXTRA_FAN_SPEED)
|
|
|
|
EDIT_ITEM_FAST_N(percent, f, MSG_EXTRA_FAN_SPEED_N, &thermalManager.new_fan_speed[f], 3, 255);
|
|
|
|
#endif
|
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
2020-04-28 05:21:23 +00:00
|
|
|
#define SNFAN(N) (ENABLED(SINGLENOZZLE_STANDBY_FAN) && !HAS_FAN##N && EXTRUDERS > N)
|
2020-01-25 08:13:39 +00:00
|
|
|
#if SNFAN(1) || SNFAN(2) || SNFAN(3) || SNFAN(4) || SNFAN(5) || SNFAN(6) || SNFAN(7)
|
|
|
|
auto singlenozzle_item = [&](const uint8_t f) {
|
2020-04-29 19:52:42 +00:00
|
|
|
editable.uint8 = singlenozzle_fan_speed[f];
|
|
|
|
EDIT_ITEM_FAST_N(percent, f, MSG_STORED_FAN_N, &editable.uint8, 0, 255, on_fan_update);
|
2020-01-25 08:13:39 +00:00
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
2018-10-27 19:53:05 +00:00
|
|
|
#if HAS_FAN0
|
2020-04-29 19:52:42 +00:00
|
|
|
editable.uint8 = thermalManager.fan_speed[0];
|
|
|
|
EDIT_ITEM_FAST_N(percent, 0, MSG_FIRST_FAN_SPEED, &editable.uint8, 0, 255, on_fan_update);
|
2018-10-27 19:53:05 +00:00
|
|
|
#if ENABLED(EXTRA_FAN_SPEED)
|
2020-01-25 08:13:39 +00:00
|
|
|
EDIT_ITEM_FAST_N(percent, 0, MSG_FIRST_EXTRA_FAN_SPEED, &thermalManager.new_fan_speed[0], 3, 255);
|
2018-10-27 19:53:05 +00:00
|
|
|
#endif
|
|
|
|
#endif
|
2019-10-28 21:49:31 +00:00
|
|
|
#if HAS_FAN1
|
2020-01-25 08:13:39 +00:00
|
|
|
fan_edit_items(1);
|
|
|
|
#elif SNFAN(1)
|
|
|
|
singlenozzle_item(1);
|
2018-10-27 19:53:05 +00:00
|
|
|
#endif
|
2019-10-28 21:49:31 +00:00
|
|
|
#if HAS_FAN2
|
2020-01-25 08:13:39 +00:00
|
|
|
fan_edit_items(2);
|
|
|
|
#elif SNFAN(2)
|
|
|
|
singlenozzle_item(1);
|
|
|
|
#endif
|
|
|
|
#if HAS_FAN3
|
|
|
|
fan_edit_items(3);
|
|
|
|
#elif SNFAN(3)
|
|
|
|
singlenozzle_item(1);
|
|
|
|
#endif
|
|
|
|
#if HAS_FAN4
|
|
|
|
fan_edit_items(4);
|
|
|
|
#elif SNFAN(4)
|
|
|
|
singlenozzle_item(1);
|
2018-10-27 19:53:05 +00:00
|
|
|
#endif
|
2020-01-25 08:13:39 +00:00
|
|
|
#if HAS_FAN5
|
|
|
|
fan_edit_items(5);
|
|
|
|
#elif SNFAN(5)
|
|
|
|
singlenozzle_item(1);
|
|
|
|
#endif
|
|
|
|
#if HAS_FAN6
|
|
|
|
fan_edit_items(6);
|
|
|
|
#elif SNFAN(6)
|
|
|
|
singlenozzle_item(1);
|
|
|
|
#endif
|
|
|
|
#if HAS_FAN7
|
|
|
|
fan_edit_items(7);
|
|
|
|
#elif SNFAN(7)
|
|
|
|
singlenozzle_item(1);
|
|
|
|
#endif
|
|
|
|
|
2020-04-27 09:41:18 +00:00
|
|
|
#endif // HAS_FAN
|
2018-10-27 19:53:05 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// Flow:
|
|
|
|
//
|
2020-01-08 23:43:36 +00:00
|
|
|
#if EXTRUDERS
|
2019-11-02 05:05:05 +00:00
|
|
|
EDIT_ITEM(int3, MSG_FLOW, &planner.flow_percentage[active_extruder], 10, 999, []{ planner.refresh_e_factor(active_extruder); });
|
2020-01-08 23:43:36 +00:00
|
|
|
// Flow En:
|
|
|
|
#if EXTRUDERS > 1
|
2020-03-14 04:18:16 +00:00
|
|
|
LOOP_L_N(n, EXTRUDERS)
|
2020-01-08 23:43:36 +00:00
|
|
|
EDIT_ITEM_N(int3, n, MSG_FLOW_N, &planner.flow_percentage[n], 10, 999, []{ planner.refresh_e_factor(MenuItemBase::itemIndex); });
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
//
|
|
|
|
// Advance K:
|
|
|
|
//
|
|
|
|
#if ENABLED(LIN_ADVANCE) && DISABLED(SLIM_LCD_MENUS)
|
|
|
|
#if EXTRUDERS == 1
|
2020-03-17 20:12:52 +00:00
|
|
|
EDIT_ITEM(float42_52, MSG_ADVANCE_K, &planner.extruder_advance_K[0], 0, 999);
|
2020-01-08 23:43:36 +00:00
|
|
|
#elif EXTRUDERS > 1
|
2020-03-14 04:18:16 +00:00
|
|
|
LOOP_L_N(n, EXTRUDERS)
|
2020-03-17 20:12:52 +00:00
|
|
|
EDIT_ITEM_N(float42_52, n, MSG_ADVANCE_K_E, &planner.extruder_advance_K[n], 0, 999);
|
2020-01-08 23:43:36 +00:00
|
|
|
#endif
|
2019-11-15 02:30:30 +00:00
|
|
|
#endif
|
2018-10-27 19:53:05 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// Babystep X:
|
|
|
|
// Babystep Y:
|
|
|
|
// Babystep Z:
|
|
|
|
//
|
|
|
|
#if ENABLED(BABYSTEPPING)
|
|
|
|
#if ENABLED(BABYSTEP_XY)
|
2019-11-02 05:05:05 +00:00
|
|
|
SUBMENU(MSG_BABYSTEP_X, []{ _lcd_babystep_go(_lcd_babystep_x); });
|
|
|
|
SUBMENU(MSG_BABYSTEP_Y, []{ _lcd_babystep_go(_lcd_babystep_y); });
|
2018-10-27 19:53:05 +00:00
|
|
|
#endif
|
|
|
|
#if ENABLED(BABYSTEP_ZPROBE_OFFSET)
|
2019-10-03 10:38:30 +00:00
|
|
|
SUBMENU(MSG_ZPROBE_ZOFFSET, lcd_babystep_zoffset);
|
2018-10-27 19:53:05 +00:00
|
|
|
#else
|
2019-10-03 10:38:30 +00:00
|
|
|
SUBMENU(MSG_BABYSTEP_Z, lcd_babystep_z);
|
2018-10-27 19:53:05 +00:00
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
END_MENU();
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // HAS_LCD_MENU
|