My Marlin configs for Fabrikator Mini and CTC i3 Pro B
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #ifdef USE_WATCHDOG
  2. #include <avr/wdt.h>
  3. #include <avr/interrupt.h>
  4. volatile uint8_t timeout_seconds=0;
  5. void(* ctrlaltdelete) (void) = 0; //does not work on my atmega2560
  6. //Watchdog timer interrupt, called if main program blocks >1sec
  7. ISR(WDT_vect)
  8. {
  9. if(timeout_seconds++ >= WATCHDOG_TIMEOUT)
  10. {
  11. #ifdef RESET_MANUAL
  12. LCD_MESSAGE("Please Reset!");
  13. ECHOLN("echo_: Something is wrong, please turn off the printer.");
  14. #else
  15. LCD_MESSAGE("Timeout, resetting!");
  16. #endif
  17. //disable watchdog, it will survife reboot.
  18. WDTCSR |= (1<<WDCE) | (1<<WDE);
  19. WDTCSR = 0;
  20. #ifdef RESET_MANUAL
  21. kill(); //kill blocks
  22. while(1); //wait for user or serial reset
  23. #else
  24. ctrlaltdelete();
  25. #endif
  26. }
  27. }
  28. /// intialise watch dog with a 1 sec interrupt time
  29. void wd_init()
  30. {
  31. WDTCSR = (1<<WDCE )|(1<<WDE ); //allow changes
  32. WDTCSR = (1<<WDIF)|(1<<WDIE)| (1<<WDCE )|(1<<WDE )| (1<<WDP2 )|(1<<WDP1)|(0<<WDP0);
  33. }
  34. /// reset watchdog. MUST be called every 1s after init or avr will reset.
  35. void wd_reset()
  36. {
  37. wdt_reset();
  38. timeout_seconds=0; //reset counter for resets
  39. }
  40. #endif /* USE_WATCHDOG */