My Marlin configs for Fabrikator Mini and CTC i3 Pro B
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

M255.cpp 1.8KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /**
  2. * Marlin 3D Printer Firmware
  3. * Copyright (c) 2022 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 <https://www.gnu.org/licenses/>.
  20. *
  21. */
  22. #include "../../inc/MarlinConfig.h"
  23. #if HAS_GCODE_M255
  24. #include "../gcode.h"
  25. #include "../../lcd/marlinui.h"
  26. /**
  27. * M255: Set the LCD sleep timeout (in minutes)
  28. * S<minutes> - Period of inactivity required for display / backlight sleep
  29. */
  30. void GcodeSuite::M255() {
  31. if (parser.seenval('S')) {
  32. #if HAS_DISPLAY_SLEEP
  33. const int m = parser.value_int();
  34. ui.sleep_timeout_minutes = constrain(m, SLEEP_TIMEOUT_MIN, SLEEP_TIMEOUT_MAX);
  35. #else
  36. const int s = parser.value_int() * 60;
  37. ui.lcd_backlight_timeout = constrain(s, LCD_BKL_TIMEOUT_MIN, LCD_BKL_TIMEOUT_MAX);
  38. #endif
  39. }
  40. else
  41. M255_report();
  42. }
  43. void GcodeSuite::M255_report(const bool forReplay/*=true*/) {
  44. report_heading_etc(forReplay, F(STR_DISPLAY_SLEEP));
  45. SERIAL_ECHOLNPGM(" M255 S",
  46. #if HAS_DISPLAY_SLEEP
  47. ui.sleep_timeout_minutes, " ; (minutes)"
  48. #else
  49. ui.lcd_backlight_timeout, " ; (seconds)"
  50. #endif
  51. );
  52. }
  53. #endif // HAS_GCODE_M255