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.

advanced_settings_menu.cpp 4.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. /*****************************************
  2. * cocoa_press/advance_settings_menu.cpp *
  3. *****************************************/
  4. /****************************************************************************
  5. * Written By Mark Pelletier 2017 - Aleph Objects, Inc. *
  6. * Written By Marcio Teixeira 2018 - Aleph Objects, Inc. *
  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. * To view a copy of the GNU General Public License, go to the following *
  19. * location: <https://www.gnu.org/licenses/>. *
  20. ****************************************************************************/
  21. #include "../config.h"
  22. #include "../screens.h"
  23. #ifdef COCOA_ADVANCED_SETTINGS_MENU
  24. using namespace FTDI;
  25. using namespace ExtUI;
  26. using namespace Theme;
  27. #define GRID_COLS 3
  28. #define GRID_ROWS 4
  29. #define STEPS_PER_MM_POS BTN_POS(1,1), BTN_SIZE(1,1)
  30. #define TMC_CURRENT_POS BTN_POS(2,1), BTN_SIZE(1,1)
  31. #define LIN_ADVANCE_POS BTN_POS(3,1), BTN_SIZE(1,1)
  32. #define VELOCITY_POS BTN_POS(1,2), BTN_SIZE(1,1)
  33. #define ACCELERATION_POS BTN_POS(2,2), BTN_SIZE(1,1)
  34. #define JERK_POS BTN_POS(3,2), BTN_SIZE(1,1)
  35. #define DISPLAY_POS BTN_POS(1,3), BTN_SIZE(1,1)
  36. #define INTERFACE_POS BTN_POS(2,3), BTN_SIZE(1,1)
  37. #define ENDSTOPS_POS BTN_POS(3,3), BTN_SIZE(1,1)
  38. #define RESTORE_DEFAULTS_POS BTN_POS(1,4), BTN_SIZE(2,1)
  39. #define BACK_POS BTN_POS(3,4), BTN_SIZE(1,1)
  40. void AdvancedSettingsMenu::onRedraw(draw_mode_t what) {
  41. if (what & BACKGROUND) {
  42. CommandProcessor cmd;
  43. cmd.cmd(CLEAR_COLOR_RGB(Theme::bg_color))
  44. .cmd(CLEAR(true,true,true));
  45. }
  46. if (what & FOREGROUND) {
  47. CommandProcessor cmd;
  48. cmd.colors(normal_btn)
  49. .font(Theme::font_medium)
  50. .tag(2) .button(STEPS_PER_MM_POS, GET_TEXT_F(MSG_STEPS_PER_MM))
  51. .enabled(ENABLED(HAS_TRINAMIC_CONFIG))
  52. .tag(3) .button(TMC_CURRENT_POS, GET_TEXT_F(MSG_TMC_CURRENT))
  53. .enabled(ENABLED(LIN_ADVANCE))
  54. .tag(4) .button(LIN_ADVANCE_POS, GET_TEXT_F(MSG_LINEAR_ADVANCE))
  55. .tag(5) .button(VELOCITY_POS, GET_TEXT_F(MSG_MAX_SPEED))
  56. .tag(6) .button(ACCELERATION_POS, GET_TEXT_F(MSG_ACCELERATION))
  57. .tag(7) .button(JERK_POS, GET_TEXT_F(TERN(HAS_JUNCTION_DEVIATION, MSG_JUNCTION_DEVIATION, MSG_JERK)))
  58. .tag(8) .button(ENDSTOPS_POS, GET_TEXT_F(MSG_LCD_ENDSTOPS))
  59. .tag(9) .button(INTERFACE_POS, GET_TEXT_F(MSG_INTERFACE))
  60. .tag(10).button(DISPLAY_POS, GET_TEXT_F(MSG_DISPLAY_MENU))
  61. .tag(11).button(RESTORE_DEFAULTS_POS, GET_TEXT_F(MSG_RESTORE_DEFAULTS))
  62. .colors(action_btn)
  63. .tag(1).button(BACK_POS, GET_TEXT_F(MSG_BUTTON_DONE));
  64. }
  65. }
  66. bool AdvancedSettingsMenu::onTouchEnd(uint8_t tag) {
  67. switch (tag) {
  68. case 1: SaveSettingsDialogBox::promptToSaveSettings(); break;
  69. case 2: GOTO_SCREEN(StepsScreen); break;
  70. #if HAS_TRINAMIC_CONFIG
  71. case 3: GOTO_SCREEN(StepperCurrentScreen); break;
  72. #endif
  73. #if ENABLED(LIN_ADVANCE)
  74. case 4: GOTO_SCREEN(LinearAdvanceScreen); break;
  75. #endif
  76. case 5: GOTO_SCREEN(MaxVelocityScreen); break;
  77. case 6: GOTO_SCREEN(DefaultAccelerationScreen); break;
  78. case 7: GOTO_SCREEN(TERN(HAS_JUNCTION_DEVIATION, JunctionDeviationScreen, JerkScreen)); break;
  79. case 8: GOTO_SCREEN(EndstopStatesScreen); break;
  80. case 9: GOTO_SCREEN(InterfaceSettingsScreen); LockScreen::check_passcode(); break;
  81. case 10: GOTO_SCREEN(DisplayTuningScreen); break;
  82. case 11: GOTO_SCREEN(RestoreFailsafeDialogBox); LockScreen::check_passcode(); break;
  83. default: return false;
  84. }
  85. return true;
  86. }
  87. #endif // COCOA_ADVANCED_SETTINGS_MENU