Singleton for cutting tools (#14429)
This commit is contained in:
@ -162,7 +162,8 @@ DEFINE_MENU_EDIT_ITEM(int4); // 1234, -123 right-justified
|
||||
DEFINE_MENU_EDIT_ITEM(int8); // 123, -12 right-justified
|
||||
DEFINE_MENU_EDIT_ITEM(uint8); // 123 right-justified
|
||||
DEFINE_MENU_EDIT_ITEM(uint16_3); // 123, -12 right-justified
|
||||
DEFINE_MENU_EDIT_ITEM(uint16_4); // 1234, -123 right-justified
|
||||
DEFINE_MENU_EDIT_ITEM(uint16_4); // 1234 right-justified
|
||||
DEFINE_MENU_EDIT_ITEM(uint16_5); // 12345 right-justified
|
||||
DEFINE_MENU_EDIT_ITEM(float3); // 123 right-justified
|
||||
DEFINE_MENU_EDIT_ITEM(float52); // 123.45
|
||||
DEFINE_MENU_EDIT_ITEM(float43); // 1.234
|
||||
|
@ -51,8 +51,9 @@ DECLARE_MENU_EDIT_TYPE(int16_t, int3, i16tostr3, 1 ); // 123
|
||||
DECLARE_MENU_EDIT_TYPE(int16_t, int4, i16tostr4sign, 1 ); // 1234, -123 right-justified
|
||||
DECLARE_MENU_EDIT_TYPE(int8_t, int8, i8tostr3, 1 ); // 123, -12 right-justified
|
||||
DECLARE_MENU_EDIT_TYPE(uint8_t, uint8, ui8tostr3, 1 ); // 123 right-justified
|
||||
DECLARE_MENU_EDIT_TYPE(uint16_t, uint16_3, ui16tostr3, 1 ); // 123, -12 right-justified
|
||||
DECLARE_MENU_EDIT_TYPE(uint16_t, uint16_4, ui16tostr4, 0.1 ); // 1234, -123 right-justified
|
||||
DECLARE_MENU_EDIT_TYPE(uint16_t, uint16_3, ui16tostr3, 1 ); // 123 right-justified
|
||||
DECLARE_MENU_EDIT_TYPE(uint16_t, uint16_4, ui16tostr4, 0.1 ); // 1234 right-justified
|
||||
DECLARE_MENU_EDIT_TYPE(uint16_t, uint16_5, ui16tostr5, 0.01 ); // 12345 right-justified
|
||||
DECLARE_MENU_EDIT_TYPE(float, float3, ftostr3, 1 ); // 123 right-justified
|
||||
DECLARE_MENU_EDIT_TYPE(float, float52, ftostr42_52, 100 ); // _2.34, 12.34, -2.34 or 123.45, -23.45
|
||||
DECLARE_MENU_EDIT_TYPE(float, float43, ftostr43sign, 1000 ); // 1.234
|
||||
@ -121,8 +122,9 @@ DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(int3); // 123, -12 right-justif
|
||||
DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(int4); // 1234, -123 right-justified
|
||||
DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(int8); // 123, -12 right-justified
|
||||
DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(uint8); // 123 right-justified
|
||||
DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(uint16_3); // 123, -12 right-justified
|
||||
DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(uint16_4); // 1234, -123 right-justified
|
||||
DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(uint16_3); // 123 right-justified
|
||||
DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(uint16_4); // 1234 right-justified
|
||||
DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(uint16_5); // 12345 right-justified
|
||||
DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(float3); // 123 right-justified
|
||||
DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(float52); // _2.34, 12.34, -2.34 or 123.45, -23.45
|
||||
DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(float43); // 1.234
|
||||
@ -206,6 +208,7 @@ DECLARE_MENU_EDIT_ITEM(int8);
|
||||
DECLARE_MENU_EDIT_ITEM(uint8);
|
||||
DECLARE_MENU_EDIT_ITEM(uint16_3);
|
||||
DECLARE_MENU_EDIT_ITEM(uint16_4);
|
||||
DECLARE_MENU_EDIT_ITEM(uint16_5);
|
||||
DECLARE_MENU_EDIT_ITEM(float3);
|
||||
DECLARE_MENU_EDIT_ITEM(float52);
|
||||
DECLARE_MENU_EDIT_ITEM(float43);
|
||||
|
@ -74,6 +74,11 @@ void menu_configuration();
|
||||
void menu_led();
|
||||
#endif
|
||||
|
||||
#if HAS_CUTTER
|
||||
#include "../../feature/spindle_laser.h"
|
||||
void menu_spindle_laser();
|
||||
#endif
|
||||
|
||||
#if ENABLED(MIXING_EXTRUDER)
|
||||
void menu_mixer();
|
||||
#endif
|
||||
@ -153,6 +158,10 @@ void menu_main() {
|
||||
MENU_ITEM(submenu, MSG_MOTION, menu_motion);
|
||||
}
|
||||
|
||||
#if HAS_CUTTER
|
||||
MENU_ITEM(submenu, MSG_CUTTER(MENU), menu_spindle_laser);
|
||||
#endif
|
||||
|
||||
MENU_ITEM(submenu, MSG_TEMPERATURE, menu_temperature);
|
||||
|
||||
#if ENABLED(MIXING_EXTRUDER)
|
||||
|
54
Marlin/src/lcd/menu/menu_spindle_laser.cpp
Normal file
54
Marlin/src/lcd/menu/menu_spindle_laser.cpp
Normal file
@ -0,0 +1,54 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
|
||||
*
|
||||
* Based on Sprinter and grbl.
|
||||
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
|
||||
*
|
||||
* 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
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
//
|
||||
// Spindle / Laser Menu
|
||||
//
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
|
||||
#if HAS_CUTTER
|
||||
|
||||
#include "menu.h"
|
||||
|
||||
#include "../../feature/spindle_laser.h"
|
||||
|
||||
void menu_spindle_laser() {
|
||||
|
||||
START_MENU();
|
||||
MENU_BACK(MSG_MAIN);
|
||||
if (cutter.enabled()) {
|
||||
#if ENABLED(SPINDLE_LASER_PWM)
|
||||
MENU_ITEM_EDIT_CALLBACK(CUTTER_MENU_TYPE, MSG_CUTTER(POWER), &cutter.power, SPEED_POWER_MIN, SPEED_POWER_MAX, cutter.update_output);
|
||||
#endif
|
||||
MENU_ITEM(function, MSG_CUTTER(OFF), cutter.disable);
|
||||
}
|
||||
else {
|
||||
MENU_ITEM(function, MSG_CUTTER(ON), cutter.enable_forward);
|
||||
#if ENABLED(SPINDLE_CHANGE_DIR)
|
||||
MENU_ITEM(function, MSG_SPINDLE_REVERSE, cutter.enable_reverse);
|
||||
#endif
|
||||
}
|
||||
END_MENU();
|
||||
}
|
||||
|
||||
#endif // HAS_CUTTER
|
@ -303,48 +303,6 @@ void _lcd_preheat(const int16_t endnum, const int16_t temph, const int16_t tempb
|
||||
|
||||
#endif // HAS_TEMP_HOTEND || HAS_HEATED_BED
|
||||
|
||||
#if ENABLED(SPINDLE_LASER_ENABLE)
|
||||
|
||||
extern uint8_t spindle_laser_power;
|
||||
bool spindle_laser_enabled();
|
||||
void set_spindle_laser_enabled(const bool enabled);
|
||||
#if ENABLED(SPINDLE_LASER_PWM)
|
||||
void update_spindle_laser_power();
|
||||
#endif
|
||||
|
||||
inline void _lcd_spindle_laser_off() { set_spindle_laser_enabled(false); }
|
||||
void set_spindle_direction(bool);
|
||||
inline void _lcd_spindle_laser_on(const bool is_M4) {
|
||||
#if SPINDLE_DIR_CHANGE
|
||||
set_spindle_direction(is_M4);
|
||||
#endif
|
||||
set_spindle_laser_enabled(true);
|
||||
}
|
||||
inline void _lcd_spindle_laser_on() { _lcd_spindle_laser_on(false); }
|
||||
#if SPINDLE_DIR_CHANGE
|
||||
inline void _lcd_spindle_on_reverse() { _lcd_spindle_laser_on(true); }
|
||||
#endif
|
||||
|
||||
void menu_spindle_laser() {
|
||||
START_MENU();
|
||||
MENU_BACK(MSG_MAIN);
|
||||
if (spindle_laser_enabled()) {
|
||||
#if ENABLED(SPINDLE_LASER_PWM)
|
||||
MENU_ITEM_EDIT_CALLBACK(uint8, MSG_LASER_POWER, &spindle_laser_power, SPEED_POWER_MIN, SPEED_POWER_MAX, update_spindle_laser_power);
|
||||
#endif
|
||||
MENU_ITEM(function, MSG_LASER_OFF, _lcd_spindle_laser_off);
|
||||
}
|
||||
else {
|
||||
MENU_ITEM(function, MSG_LASER_ON, _lcd_spindle_laser_on);
|
||||
#if SPINDLE_DIR_CHANGE
|
||||
MENU_ITEM(function, MSG_SPINDLE_REVERSE, _lcd_spindle_on_reverse);
|
||||
#endif
|
||||
}
|
||||
END_MENU();
|
||||
}
|
||||
|
||||
#endif // SPINDLE_LASER_ENABLE
|
||||
|
||||
void menu_temperature() {
|
||||
START_MENU();
|
||||
MENU_BACK(MSG_MAIN);
|
||||
@ -415,10 +373,6 @@ void menu_temperature() {
|
||||
#endif
|
||||
#endif // FAN_COUNT > 0
|
||||
|
||||
#if ENABLED(SPINDLE_LASER_ENABLE)
|
||||
MENU_ITEM(submenu, MSG_LASER_MENU, menu_spindle_laser);
|
||||
#endif
|
||||
|
||||
#if HAS_TEMP_HOTEND
|
||||
|
||||
//
|
||||
|
Reference in New Issue
Block a user