Skip to content

Commit

Permalink
Document Watchodg features and settings
Browse files Browse the repository at this point in the history
- add docs for Watchdog configuration
- add docs to README.md how to recover from errors
- add Watchdog separate values for H-BRIDGE and RELAY builds

Signed-off-by: Martin Mihálek <[email protected]>
  • Loading branch information
aenniw committed Feb 2, 2019
1 parent 36bb422 commit 4c8c3f4
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
10 changes: 10 additions & 0 deletions skarsta/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,16 @@ After testing quite a few DC motors from Ebay, Aliexpress and Banggood, I stuck
<a href="https://drive.google.com/uc?export=view&id=15VFWSnQ_u37xM2864LjUWOSjwABPXVya"><img src="https://drive.google.com/uc?export=view&id=15VFWSnQ_u37xM2864LjUWOSjwABPXVya" style="width: 500px; max-width: 100%; height: auto" title="Click for the larger version." /></a>
</details>

### Error codes && handling

- if any Error message bellow is showed on display it is needed to manually power down/up table to be able to operate once again,
after any of error pops out it is advised to closely inspect table if the problem reoccurs if so open an issue

| _Error code_ | _Description_ |
| ------------ | :---------------------------: |
| Err 1 | Motor stuck and cannot rotate |
| Err 2 | Motor started unexpectedly |

### Library Credentials

[ENCODER](https://github.com/buxtronix/arduino/tree/master/libraries/Rotary)
Expand Down
18 changes: 18 additions & 0 deletions skarsta/lib/watchdog/Watchdog.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,28 @@
#include <Motor.h>
#include <Display.h>

/**
* WATCHDOG_TIMEOUT represents timeout in millis for watchdog to perform its checks
* WATCHDOG_TOLERANCE represents number of failed check in row needed to trigger an error,
* so the reaction time will be (WATCHDOG_TIMEOUT * WATCHDOG_TOLERANCE) ms
*
* WATCHDOG_DEADLOCK_CHANGE represents rotation steps threshold for detecting if motor is stuck and cannot move
* so if rotation change is greater then WATCHDOG_DEADLOCK_CHANGE for WATCHDOG_TOLERANCE times Error 1 will be trigerred
* WATCHDOG_OTHER_CHANGE represents rotation steps threshold for detecting if motor was started mainly due to programing errors,
* so if rotation change is greater then WATCHDOG_OTHER_CHANGE for WATCHDOG_TOLERANCE times Error 2 will be trigerred
*/

#ifndef __H_BRIDGE_MOTOR__
#define WATCHDOG_TIMEOUT 10
#define WATCHDOG_DEADLOCK_CHANGE 1
#define WATCHDOG_OTHER_CHANGE 5
#define WATCHDOG_TOLERANCE 5
#else
#define WATCHDOG_TIMEOUT 250
#define WATCHDOG_DEADLOCK_CHANGE 2
#define WATCHDOG_OTHER_CHANGE 10
#define WATCHDOG_TOLERANCE 2
#endif

class Watchdog : Service {
private:
Expand Down

0 comments on commit 4c8c3f4

Please sign in to comment.