My Marlin configs for Fabrikator Mini and CTC i3 Pro B
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

tiny_timer.cpp 1.7KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. /******************
  2. * tiny_timer.cpp *
  3. ******************/
  4. /****************************************************************************
  5. * Written By Marcio Teixeira 2018 - Aleph Objects, Inc. *
  6. * *
  7. * This program is free software: you can redistribute it and/or modify *
  8. * it under the terms of the GNU General Public License as published by *
  9. * the Free Software Foundation, either version 3 of the License, or *
  10. * (at your option) any later version. *
  11. * *
  12. * This program is distributed in the hope that it will be useful, *
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of *
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
  15. * GNU General Public License for more details. *
  16. * *
  17. * To view a copy of the GNU General Public License, go to the following *
  18. * location: <https://www.gnu.org/licenses/>. *
  19. ****************************************************************************/
  20. #include "ftdi_extended.h"
  21. #if ENABLED(FTDI_EXTENDED)
  22. bool tiny_timer_t::elapsed(tiny_time_t duration) {
  23. uint8_t now = tiny_time_t::tiny_time(
  24. TERN(__MARLIN_FIRMWARE__, ExtUI::safe_millis(), millis())
  25. );
  26. uint8_t elapsed = now - _start;
  27. return elapsed >= duration._duration;
  28. }
  29. void tiny_timer_t::start() {
  30. _start = tiny_time_t::tiny_time(
  31. TERN(__MARLIN_FIRMWARE__, ExtUI::safe_millis(), millis())
  32. );
  33. }
  34. #endif // FTDI_EXTENDED