Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
marlin-anet-a8
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jonas Leder
marlin-anet-a8
Commits
7cc358b5
Commit
7cc358b5
authored
13 years ago
by
Bernhard Kubicek
Browse files
Options
Downloads
Patches
Plain Diff
wrong file location
parent
e8092898
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Marlin/watchdog.cpp
+48
-0
48 additions, 0 deletions
Marlin/watchdog.cpp
Marlin/watchdog.h
+10
-0
10 additions, 0 deletions
Marlin/watchdog.h
with
58 additions
and
0 deletions
Marlin/watchdog.cpp
0 → 100644
+
48
−
0
View file @
7cc358b5
#ifdef USE_WATCHDOG
#include
<avr/wdt.h>
#include
<avr/interrupt.h>
volatile
uint8_t
timeout_seconds
=
0
;
void
(
*
ctrlaltdelete
)
(
void
)
=
0
;
//does not work on my atmega2560
//Watchdog timer interrupt, called if main program blocks >1sec
ISR
(
WDT_vect
)
{
if
(
timeout_seconds
++
>=
WATCHDOG_TIMEOUT
)
{
#ifdef RESET_MANUAL
LCD_MESSAGE
(
"Please Reset!"
);
ECHOLN
(
"echo_: Something is wrong, please turn off the printer."
);
#else
LCD_MESSAGE
(
"Timeout, resetting!"
);
#endif
//disable watchdog, it will survife reboot.
WDTCSR
|=
(
1
<<
WDCE
)
|
(
1
<<
WDE
);
WDTCSR
=
0
;
#ifdef RESET_MANUAL
kill
();
//kill blocks
while
(
1
);
//wait for user or serial reset
#else
ctrlaltdelete
();
#endif
}
}
/// intialise watch dog with a 1 sec interrupt time
void
wd_init
()
{
WDTCSR
=
(
1
<<
WDCE
)
|
(
1
<<
WDE
);
//allow changes
WDTCSR
=
(
1
<<
WDIF
)
|
(
1
<<
WDIE
)
|
(
1
<<
WDCE
)
|
(
1
<<
WDE
)
|
(
1
<<
WDP2
)
|
(
1
<<
WDP1
)
|
(
0
<<
WDP0
);
}
/// reset watchdog. MUST be called every 1s after init or avr will reset.
void
wd_reset
()
{
wdt_reset
();
timeout_seconds
=
0
;
//reset counter for resets
}
#endif
/* USE_WATCHDOG */
This diff is collapsed.
Click to expand it.
Marlin/watchdog.h
0 → 100644
+
10
−
0
View file @
7cc358b5
#ifndef __WATCHDOGH
#define __WATCHDOGH
#ifdef
/// intialise watch dog with a 1 sec interrupt time
void
wd_init
();
/// pad the dog/reset watchdog. MUST be called at least every second after the first wd_init or avr will go into emergency procedures..
void
wd_reset
();
#endif
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment