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.

watchdog.cpp 1.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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. #if defined(STM32GENERIC) && (defined(STM32F4) || defined(STM32F7))
  23. #include "../../inc/MarlinConfig.h"
  24. #if ENABLED(USE_WATCHDOG)
  25. #include "watchdog.h"
  26. #define WDT_TIMEOUT_COUNT TERN(WATCHDOG_DURATION_8S, 8192, 4096) // 4 or 8 second timeout
  27. IWDG_HandleTypeDef hiwdg;
  28. void watchdog_init() {
  29. hiwdg.Instance = IWDG;
  30. hiwdg.Init.Prescaler = IWDG_PRESCALER_32; // 32kHz LSI clock and 32x prescalar = 1024Hz IWDG clock
  31. hiwdg.Init.Reload = WDT_TIMEOUT_COUNT - 1;
  32. if (HAL_IWDG_Init(&hiwdg) != HAL_OK) {
  33. //Error_Handler();
  34. }
  35. else {
  36. #if PIN_EXISTS(LED) && DISABLED(PINS_DEBUGGING)
  37. TOGGLE(LED_PIN); // heartbeat indicator
  38. #endif
  39. }
  40. }
  41. void HAL_watchdog_refresh() {
  42. /* Refresh IWDG: reload counter */
  43. if (HAL_IWDG_Refresh(&hiwdg) != HAL_OK) {
  44. /* Refresh Error */
  45. //Error_Handler();
  46. }
  47. }
  48. #endif // USE_WATCHDOG
  49. #endif // STM32GENERIC && (STM32F4 || STM32F7)