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.

backlash_compensation_screen.cpp 3.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /************************************
  2. * backlash_compensation_screen.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 FTDI_BACKLASH_COMP_SCREEN
  24. using namespace FTDI;
  25. using namespace ExtUI;
  26. using namespace Theme;
  27. void BacklashCompensationScreen::onRedraw(draw_mode_t what) {
  28. widgets_t w(what);
  29. w.precision(2).units( GET_TEXT_F(MSG_UNITS_MM));
  30. w.heading( GET_TEXT_F(MSG_BACKLASH));
  31. w.color(x_axis).adjuster(2, GET_TEXT_F(MSG_AXIS_X), getAxisBacklash_mm(X));
  32. w.color(y_axis).adjuster(4, GET_TEXT_F(MSG_AXIS_Y), getAxisBacklash_mm(Y));
  33. w.color(z_axis).adjuster(6, GET_TEXT_F(MSG_AXIS_Z), getAxisBacklash_mm(Z));
  34. #if ENABLED(CALIBRATION_GCODE)
  35. w.button(12, GET_TEXT_F(MSG_MEASURE_AUTOMATICALLY));
  36. #endif
  37. #ifdef BACKLASH_SMOOTHING_MM
  38. w.color(other).adjuster(8, GET_TEXT_F(MSG_BACKLASH_SMOOTHING), getBacklashSmoothing_mm());
  39. #endif
  40. w.precision(0).units(GET_TEXT_F(MSG_UNITS_PERCENT))
  41. .adjuster(10, GET_TEXT_F(MSG_BACKLASH_CORRECTION), getBacklashCorrection_percent());
  42. w.precision(2).increments();
  43. }
  44. bool BacklashCompensationScreen::onTouchHeld(uint8_t tag) {
  45. const float increment = getIncrement();
  46. switch (tag) {
  47. case 2: UI_DECREMENT(AxisBacklash_mm, X); break;
  48. case 3: UI_INCREMENT(AxisBacklash_mm, X); break;
  49. case 4: UI_DECREMENT(AxisBacklash_mm, Y); break;
  50. case 5: UI_INCREMENT(AxisBacklash_mm, Y); break;
  51. case 6: UI_DECREMENT(AxisBacklash_mm, Z); break;
  52. case 7: UI_INCREMENT(AxisBacklash_mm, Z); break;
  53. #ifdef BACKLASH_SMOOTHING_MM
  54. case 8: UI_DECREMENT(BacklashSmoothing_mm); break;
  55. case 9: UI_INCREMENT(BacklashSmoothing_mm); break;
  56. #endif
  57. case 10: UI_DECREMENT_BY(BacklashCorrection_percent, increment*100); break;
  58. case 11: UI_INCREMENT_BY(BacklashCorrection_percent, increment*100); break;
  59. #if ENABLED(CALIBRATION_GCODE)
  60. case 12: GOTO_SCREEN(ConfirmAutoCalibrationDialogBox); return true;
  61. #endif
  62. default:
  63. return false;
  64. }
  65. SaveSettingsDialogBox::settingsChanged();
  66. return true;
  67. }
  68. #endif // FTDI_BACKLASH_COMP_SCREEN