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.

tiny_timer.cpp 1.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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: <http://www.gnu.org/licenses/>. *
  19. ****************************************************************************/
  20. #include "ftdi_extended.h"
  21. #ifdef FTDI_EXTENDED
  22. bool tiny_timer_t::elapsed(tiny_time_t duration) {
  23. uint8_t now = tiny_time_t::tiny_time(
  24. #ifdef __MARLIN_FIRMWARE__
  25. ExtUI::safe_millis()
  26. #else
  27. millis()
  28. #endif
  29. );
  30. uint8_t elapsed = now - _start;
  31. if (elapsed >= duration._duration) {
  32. return true;
  33. } else {
  34. return false;
  35. }
  36. }
  37. void tiny_timer_t::start() {
  38. _start = tiny_time_t::tiny_time(
  39. #ifdef __MARLIN_FIRMWARE__
  40. ExtUI::safe_millis()
  41. #else
  42. millis()
  43. #endif
  44. );
  45. }
  46. #endif // FTDI_EXTENDED