-
Notifications
You must be signed in to change notification settings - Fork 0
/
nodeInfo.ino
66 lines (54 loc) · 1.79 KB
/
nodeInfo.ino
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
//nodeInfo.ino
const char * const RST_REASONS[] =
{
"REASON_DEFAULT_RST",
"REASON_WDT_RST",
"REASON_EXCEPTION_RST",
"REASON_SOFT_WDT_RST",
"REASON_SOFT_RESTART",
"REASON_DEEP_SLEEP_AWAKE",
"REASON_EXT_SYS_RST"
};
const char * const FLASH_SIZE_MAP_NAMES[] =
{
"FLASH_SIZE_4M_MAP_256_256",
"FLASH_SIZE_2M",
"FLASH_SIZE_8M_MAP_512_512",
"FLASH_SIZE_16M_MAP_512_512",
"FLASH_SIZE_32M_MAP_512_512",
"FLASH_SIZE_16M_MAP_1024_1024",
"FLASH_SIZE_32M_MAP_1024_1024"
};
#ifdef ESP8266
extern "C" {
#include "user_interface.h"
}
#endif
String getESPStatusUpdate()
{
String infoStrin = "";
const rst_info * resetInfo = system_get_rst_info();
infoStrin += "\nsystem_get_rst_info() reset reason: ";
infoStrin += RST_REASONS[resetInfo->reason];
infoStrin += "\nsystem_get_free_heap_size(): ";
infoStrin += system_get_free_heap_size();
infoStrin += "\nsystem_get_os_print(): ";
infoStrin += system_get_os_print();
infoStrin += "\nsystem_get_os_print(): ";
infoStrin += system_get_os_print();
infoStrin += "\nsystem_get_chip_id(): 0x";
infoStrin += system_get_chip_id();
infoStrin += "\nsystem_get_sdk_version(): ";
infoStrin += system_get_sdk_version();
infoStrin += "\nsystem_get_boot_version(): ";
infoStrin += system_get_boot_version();
infoStrin += "\nsystem_get_userbin_addr(): 0x";
infoStrin += system_get_userbin_addr();
infoStrin += "\nsystem_get_boot_mode(): ";
infoStrin += (system_get_boot_mode() == 0) ? "\nSYS_BOOT_ENHANCE_MODE" : "\nSYS_BOOT_NORMAL_MODE";
infoStrin += "\nsystem_get_cpu_freq(): ";
infoStrin += system_get_cpu_freq();
infoStrin += "\nsystem_get_flash_size_map(): ";
infoStrin += FLASH_SIZE_MAP_NAMES[system_get_flash_size_map()];
return infoStrin;
}