-
Notifications
You must be signed in to change notification settings - Fork 2
/
cmdHang.cpp
72 lines (50 loc) · 1.43 KB
/
cmdHang.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/*
Module: cmdHang.cpp
Function:
Process the "hang" command
Copyright and License:
See accompanying LICENSE file for copyright and license information.
Author:
Pranau R, MCCI Corporation April 2024
*/
#include "Catena4430_cmd.h"
#include <Arduino.h>
using namespace McciCatena;
/*
Name: ::cmdHang()
Function:
Command dispatcher for "hang" command.
Definition:
McciCatena::cCommandStream::CommandFn cmdHang;
McciCatena::cCommandStream::CommandStatus cmdHang(
cCommandStream *pThis,
void *pContext,
int argc,
char **argv
);
Description:
The "hang" command has the following syntax:
hang
enter a tight loop waiting for the watchdog to fire.
Returns:
cCommandStream::CommandStatus::kSuccess if successful.
Some other value for failure.
*/
// argv[0] is "hang"
// argv[1] is new log flag mask; if omitted, mask is printed
cCommandStream::CommandStatus cmdHang(
cCommandStream *pThis,
void *pContext,
int argc,
char **argv
)
{
if (argc > 1)
return cCommandStream::CommandStatus::kInvalidParameter;
pThis->printf("looping... watchdog should get us out before we exit\n");
uint32_t now = millis();
while (millis() - now < 60 * 1000)
;
pThis->printf("watchdog did not fire.\n");
return cCommandStream::CommandStatus::kError;
}