My Marlin configs for Fabrikator Mini and CTC i3 Pro B
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

power.h 2.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /**
  2. * Marlin 3D Printer Firmware
  3. * Copyright (c) 2020 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. #pragma once
  23. /**
  24. * power.h - power control
  25. */
  26. #if EITHER(AUTO_POWER_CONTROL, POWER_OFF_TIMER)
  27. #include "../core/millis_t.h"
  28. #endif
  29. class Power {
  30. public:
  31. static bool psu_on;
  32. static void init();
  33. static void power_on();
  34. static void power_off();
  35. #if EITHER(POWER_OFF_TIMER, POWER_OFF_WAIT_FOR_COOLDOWN)
  36. #if ENABLED(POWER_OFF_TIMER)
  37. static millis_t power_off_time;
  38. static void setPowerOffTimer(const millis_t delay_ms);
  39. #endif
  40. #if ENABLED(POWER_OFF_WAIT_FOR_COOLDOWN)
  41. static bool power_off_on_cooldown;
  42. static void setPowerOffOnCooldown(const bool ena);
  43. #endif
  44. static void cancelAutoPowerOff();
  45. static void checkAutoPowerOff();
  46. #endif
  47. #if ENABLED(AUTO_POWER_CONTROL) && POWER_OFF_DELAY > 0
  48. static void power_off_soon();
  49. #else
  50. static void power_off_soon() { power_off(); }
  51. #endif
  52. #if ENABLED(AUTO_POWER_CONTROL)
  53. static void check(const bool pause);
  54. private:
  55. static millis_t lastPowerOn;
  56. static bool is_power_needed();
  57. static bool is_cooling_needed();
  58. #elif ENABLED(POWER_OFF_WAIT_FOR_COOLDOWN)
  59. private:
  60. static bool is_cooling_needed();
  61. #endif
  62. };
  63. extern Power powerManager;