-
Notifications
You must be signed in to change notification settings - Fork 190
Expand file tree
/
Copy pathconfig.h
More file actions
140 lines (121 loc) · 5.36 KB
/
config.h
File metadata and controls
140 lines (121 loc) · 5.36 KB
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
#ifndef CONFIG_H
#define CONFIG_H
#define FW_MAJOR_VERSION 1
#define FW_MINOR_VERSION 7
#define FW_PATCH_VERSION 4
// Helper macros for stringification
#define STRINGIFY(x) #x
#define TOSTRING(x) STRINGIFY(x)
#ifndef FW_VERSION_SUFFIX
#define FW_VERSION_SUFFIX ""
#endif
// Compile-time firmware version string
#define FW_VERSION_STRING TOSTRING(FW_MAJOR_VERSION) "." TOSTRING(FW_MINOR_VERSION) "." TOSTRING(FW_PATCH_VERSION) FW_VERSION_SUFFIX
#define LOG_MAX_NOTES_NUMBER 10
#define PREFERENCES_API_KEY "api_key"
#define PREFERENCES_API_KEY_DEFAULT ""
#define PREFERENCES_API_URL "api_url"
#define PREFERENCES_FRIENDLY_ID "friendly_id"
#define PREFERENCES_FRIENDLY_ID_DEFAULT ""
#define PREFERENCES_SLEEP_TIME_KEY "refresh_rate"
#define PREFERENCES_TEMP_PROFILE "temp_profile"
#define PREFERENCES_LOG_KEY "log_"
#define PREFERENCES_LOG_BUFFER_HEAD_KEY "log_head"
#define PREFERENCES_LOG_ID_KEY "log_id"
#define PREFERENCES_DEVICE_REGISTERED_KEY "plugin"
#define PREFERENCES_SF_KEY "sf"
#define PREFERENCES_FILENAME_KEY "filename"
#define PREFERENCES_LAST_SLEEP_TIME "last_sleep"
#define PREFERENCES_CONNECT_API_RETRY_COUNT "retry_count"
#define PREFERENCES_CONNECT_WIFI_RETRY_COUNT "wifi_retry"
// Ed25519 authentication keys
#define PREFERENCES_ED25519_PUBLIC_KEY "ed_pub"
#define PREFERENCES_ED25519_PRIVATE_KEY "ed_priv"
#define PREFERENCES_AUTH_MODE "auth_mode"
#define PREFERENCES_AUTH_MODE_DEFAULT "api_key"
#define PREFERENCES_AUTH_MODE_ED25519 "ed25519"
#define WIFI_CONNECTION_RSSI (-100)
#define DISPLAY_BMP_IMAGE_SIZE 48062 // in bytes - 62 bytes - header; 48000 bytes - bitmap (480*800 1bpp) / 8
#define DEFAULT_IMAGE_SIZE 48000
#ifdef BOARD_TRMNL_X
#define MAX_IMAGE_SIZE 750000 // Use PSRAM on the ESP32-S3
#else
#define MAX_IMAGE_SIZE 90000 // largest compressed image we can receive
#endif
#define SLEEP_uS_TO_S_FACTOR 1000000 /* Conversion factor for micro seconds to seconds */
#define SLEEP_TIME_TO_SLEEP 900 /* Time ESP32 will go to sleep (in seconds) */
#define SLEEP_TIME_WHILE_NOT_CONNECTED 5 /* Time ESP32 will go to sleep (in seconds) */
#define SLEEP_TIME_WHILE_PLUGIN_NOT_ATTACHED 5 /* Time ESP32 will go to sleep (in seconds) */
// Different display profiles
#define TEMP_PROFILE_DEFAULT 0
#define TEMP_PROFILE_A 1
#define TEMP_PROFILE_B 2
#define TEMP_PROFILE_C 3
#define MS_TO_S_FACTOR 1000 /* Conversion factor for milliseconds to seconds */
enum API_CONNECT_RETRY_TIME // Time to sleep before trying to connect to the API (in seconds)
{
API_FIRST_RETRY = 15,
API_SECOND_RETRY = 30,
API_THIRD_RETRY = 60
};
enum WIFI_CONNECT_RETRY_TIME // Time to sleep before trying to connect to the Wi-Fi (in seconds)
{
WIFI_FIRST_RETRY = 60,
WIFI_SECOND_RETRY = 180,
WIFI_THIRD_RETRY = 300
};
#if defined(BOARD_TRMNL) || defined(BOARD_TRMNL_4CLR)
#define PIN_INTERRUPT 2
#define DEVICE_MODEL "og"
#elif defined(BOARD_XTEINK_X4)
#define DEVICE_MODEL "XTEINK_X4"
#define PIN_INTERRUPT 3
#elif defined(BOARD_TRMNL_X)
#define PIN_INTERRUPT 0
#define DEVICE_MODEL "x"
#elif defined(BOARD_WAVESHARE_ESP32_DRIVER)
#define PIN_INTERRUPT 33
#define DEVICE_MODEL "waveshare"
#define FAKE_BATTERY_VOLTAGE
#elif defined(BOARD_SEEED_XIAO_ESP32C3)
#define DEVICE_MODEL "seeed_esp32c3"
#define PIN_INTERRUPT 9 //the boot button on the XIAO ESP32-C3, this button can't be used as wakeup source though
//because it's not in the RTC GPIO group. Instead, you can always use the reset button to
//wake up the device. Resetting WiFi configuration needs special routine - press reset button
//then press the boot button in less than 2 seconds, and hold it for 5 seconds.
#define FAKE_BATTERY_VOLTAGE
#elif defined(BOARD_SEEED_XIAO_ESP32S3)
#define DEVICE_MODEL "seeed_esp32s3"
#define PIN_INTERRUPT 0 //the boot button on the XIAO ESP32-S3, this button works as regular wakeup button
#define FAKE_BATTERY_VOLTAGE
#elif (defined(BOARD_XIAO_EPAPER_DISPLAY) || defined(BOARD_XIAO_EPAPER_DISPLAY_3CLR))
#define DEVICE_MODEL "xiao_epaper_display"
#define PIN_INTERRUPT 5 //with silkscreen "KEY3"
#define PIN_VBAT_SWITCH 6 //load switch enable pin for battery voltage measurement
#define VBAT_SWITCH_LEVEL HIGH //load switch enable pin active level
#elif defined(BOARD_SEEED_RETERMINAL_E1001)
#define DEVICE_MODEL "reTerminal E1001"
#define PIN_INTERRUPT 3 //the green button
#define PIN_VBAT_SWITCH 21 //load switch enable pin for battery voltage measurement
#define VBAT_SWITCH_LEVEL HIGH //load switch enable pin active level
#elif defined(BOARD_SEEED_RETERMINAL_E1002)
#define DEVICE_MODEL "reTerminal E1002"
#define PIN_INTERRUPT 3 //the green button
#define PIN_VBAT_SWITCH 21 //load switch enable pin for battery voltage measurement
#define VBAT_SWITCH_LEVEL HIGH //load switch enable pin active level
#endif
#if defined(BOARD_XIAO_EPAPER_DISPLAY) || defined(BOARD_SEEED_RETERMINAL_E1001) || defined(BOARD_SEEED_RETERMINAL_E1002)
#define PIN_BATTERY 1
#elif defined(BOARD_XTEINK_X4)
#define PIN_BATTERY 0
#else
#define PIN_BATTERY 3
#endif
// #define FAKE_BATTERY_VOLTAGE // Uncomment to report 4.2V instead of reading ADC
#define BUTTON_HOLD_TIME 5000
#define BUTTON_MEDIUM_HOLD_TIME 1000
#define BUTTON_SOFT_RESET_TIME 15000
#define BUTTON_DOUBLE_CLICK_WINDOW 800
#define SERVER_MAX_RETRIES 3
#define API_BASE_URL "https://trmnl.app"
#endif