My Marlin configs for Fabrikator Mini and CTC i3 Pro B
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

menu_custom.cpp 2.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /**
  2. * Marlin 3D Printer Firmware
  3. * Copyright (c) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
  4. *
  5. * Based on Sprinter and grbl.
  6. * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
  7. *
  8. * This program is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation, either version 3 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  20. *
  21. */
  22. //
  23. // Custom User Menu
  24. //
  25. #include "../../inc/MarlinConfigPre.h"
  26. #if HAS_LCD_MENU && ENABLED(CUSTOM_USER_MENUS)
  27. #include "menu.h"
  28. #include "../../gcode/queue.h"
  29. #ifdef USER_SCRIPT_DONE
  30. #define _DONE_SCRIPT "\n" USER_SCRIPT_DONE
  31. #else
  32. #define _DONE_SCRIPT ""
  33. #endif
  34. void _lcd_user_gcode(PGM_P const cmd) {
  35. queue.inject_P(cmd);
  36. #if ENABLED(USER_SCRIPT_AUDIBLE_FEEDBACK) && HAS_BUZZER
  37. ui.completion_feedback();
  38. #endif
  39. #if ENABLED(USER_SCRIPT_RETURN)
  40. ui.return_to_status();
  41. #endif
  42. }
  43. void menu_user() {
  44. START_MENU();
  45. BACK_ITEM(MSG_MAIN);
  46. #if defined(USER_DESC_1) && defined(USER_GCODE_1)
  47. ACTION_ITEM_P(PSTR(USER_DESC_1), [](){ _lcd_user_gcode(PSTR(USER_GCODE_1 _DONE_SCRIPT)); });
  48. #endif
  49. #if defined(USER_DESC_2) && defined(USER_GCODE_2)
  50. ACTION_ITEM_P(PSTR(USER_DESC_2), [](){ _lcd_user_gcode(PSTR(USER_GCODE_2 _DONE_SCRIPT)); });
  51. #endif
  52. #if defined(USER_DESC_3) && defined(USER_GCODE_3)
  53. ACTION_ITEM_P(PSTR(USER_DESC_3), [](){ _lcd_user_gcode(PSTR(USER_GCODE_3 _DONE_SCRIPT)); });
  54. #endif
  55. #if defined(USER_DESC_4) && defined(USER_GCODE_4)
  56. ACTION_ITEM_P(PSTR(USER_DESC_4), [](){ _lcd_user_gcode(PSTR(USER_GCODE_4 _DONE_SCRIPT)); });
  57. #endif
  58. #if defined(USER_DESC_5) && defined(USER_GCODE_5)
  59. ACTION_ITEM_P(PSTR(USER_DESC_5), [](){ _lcd_user_gcode(PSTR(USER_GCODE_5 _DONE_SCRIPT)); });
  60. #endif
  61. END_MENU();
  62. }
  63. #endif // HAS_LCD_MENU && CUSTOM_USER_MENUS