Skip to content

Commit 1901dbd

Browse files
authored
Add files via upload
1 parent e54b5ad commit 1901dbd

File tree

4 files changed

+375
-327
lines changed

4 files changed

+375
-327
lines changed

Esp32_servers_config.h

+94-100
Original file line numberDiff line numberDiff line change
@@ -2,120 +2,114 @@
22
// you can skip some files #included if you don't need the whole functionality
33

44

5-
// uncomment the following line to get additional compile-time information about how the project gets compiled
6-
// #define SHOW_COMPILE_TIME_INFORMATION
5+
// Lightweight STL memory settings
6+
// #define LIST_MEMORY_TYPE PSRAM_MEM
7+
// #define VECTOR_QUEUE_MEMORY_TYPE PSRAM_MEM // please note that this also affect keyValueDatabase
8+
// #define MAP_MEMORY_TYPE PSRAM_MEM // please note that this also affect keyValueDatabase
9+
// bool psramInitialized = psramInit ();
710

11+
// locale settings for Cstrings
12+
// #include "servers/std/locale.hpp"
13+
// bool localeSet = setlocale (lc_all, "sl_SI.UTF-8");
814

9-
/* use PSRAM?
10-
#define QUEUE_MEMORY_TYPE PSRAM_MEM
11-
#define MAP_MEMORY_TYPE PSRAM_MEM
12-
#define VECTOR_MEMORY_TYPE PSRAM_MEM
13-
bool psramused = psramInit ();
14-
*/
1515

16+
// uncomment the following line to get additional compile-time information about how the project gets compiled
17+
// #define SHOW_COMPILE_TIME_INFORMATION
1618

17-
// include version_of_servers.h to include version information
18-
#include "./servers/version_of_servers.h"
19-
// include dmesg.hpp which is useful for run-time debugging - for dmesg telnet command
20-
#include "./servers/dmesg.hpp"
2119

20+
// 1. TIME: #define which time settings, wil be used with time_functions.h - will be included later
21+
// define which 3 NTP servers will be called to get current GMT (time) from
22+
// this information will be written into /etc/ntp.conf file if file_system.h will be included
23+
#define DEFAULT_NTP_SERVER_1 "1.si.pool.ntp.org" // <- replace with your information
24+
#define DEFAULT_NTP_SERVER_2 "2.si.pool.ntp.org" // <- replace with your information
25+
#define DEFAULT_NTP_SERVER_3 "3.si.pool.ntp.org" // <- replace with your information
26+
// define time zone to calculate local time from GMT
27+
#define TZ "CET-1CEST,M3.5.0,M10.5.0/3" // default: Europe/Ljubljana, or select another (POSIX) time zones: https://github.com/nayarsystems/posix_tz_db/blob/master/zones.csv
2228

23-
// 1. TIME LOCALIZATION: #define which time settings, wil be used with time_functions.h - will be included later
24-
// define which 3 NTP servers will be called to get current GMT (time) from
25-
// this information will be written into /etc/ntp.conf file if file_system.h will be included
26-
#define DEFAULT_NTP_SERVER_1 "1.si.pool.ntp.org" // <- replace with your information
27-
#define DEFAULT_NTP_SERVER_2 "2.si.pool.ntp.org" // <- replace with your information
28-
#define DEFAULT_NTP_SERVER_3 "3.si.pool.ntp.org" // <- replace with your information
29-
// define time zone to calculate local time from GMT
30-
#define TZ "CET-1CEST,M3.5.0,M10.5.0/3" // default: Europe/Ljubljana, or select another (POSIX) time zones: https://github.com/nayarsystems/posix_tz_db/blob/master/zones.csv
3129

30+
// 2. FILE SYSTEM: #define which file system you want to use
31+
// the file system must correspond to Tools | Partition scheme setting: FILE_SYSTEM_FAT (for FAT partition scheme), FILE_SYSTEM_LITTLEFS (for SPIFFS partition scheme) or FILE_SYSTEM_SD_CARD (if SD card is attached)
32+
// FAT file system can be bitwise combined with FILE_SYSTEM_SD_CARD, like #define FILE_SYSTEM (FILE_SYSTEM_FAT | FILE_SYSTEM_SD_CARD), LITTLEFS uses less memory
3233

33-
// 2. FILE SYSTEM: #define which file system you want to use
34-
// the file system must correspond to Tools | Partition scheme setting: FILE_SYSTEM_FAT (for FAT partition scheme), FILE_SYSTEM_LITTLEFS (for SPIFFS partition scheme) or FILE_SYSTEM_SD_CARD (if SC card is attached)
35-
// FAT file system can be bitwise combined with FILE_SYSTEM_SD_CARD, like #define FILE_SYSTEM (FILE_SYSTEM_FAT | FILE_SYSTEM_SD_CARD)
36-
#define FILE_SYSTEM FILE_SYSTEM_LITTLEFS // LittleFS uses the least of memory, which may be needed for all the functionalities to run
34+
#define FILE_SYSTEM FILE_SYSTEM_LITTLEFS // FILE_SYSTEM_LITTLEFS or FILE_SYSTEM_FAT or FILE_SYSTEM_SD_CARD or FILE_SYSTEM_FAT | FILE_SYSTEM_SD_CARD
3735

3836

3937
// 3. NETWORK: #define how ESP32 will use the network
40-
// STA(tion)
41-
// #define how ESP32 will connecto to WiFi router
42-
// this information will be written into /etc/wpa_supplicant/wpa_supplicant.conf file if file_system.h will be included
43-
// if these #definitions are missing STAtion will not be set up
44-
#define DEFAULT_STA_SSID "YOUR_STA_SSID" // <- replace with your information
45-
#define DEFAULT_STA_PASSWORD "YOUR_STA_PASSWORD" // <- replace with your information
46-
// the use of DHCP or static IP address wil be set in /network/interfaces if fileSystem.hpp is included.
47-
// The following is information needed for static IP configuration. If these #definitions are missing DHCP is assumed
48-
// #define DEFAULT_STA_IP "10.18.1.200" // <- replace with your information
49-
// #define DEFAULT_STA_SUBNET_MASK "255.255.255.0" // <- replace with your information
50-
// #define DEFAULT_STA_GATEWAY "10.18.1.1" // <- replace with your information
51-
// #define DEFAULT_STA_DNS_1 "193.189.160.13" // <- replace with your information
52-
// #define DEFAULT_STA_DNS_2 "193.189.160.23" // <- replace with your information
53-
54-
// A(ccess) P(oint)
55-
// #define how ESP32 will set up its access point
56-
// this information will be writte into /etc/dhcpcd.conf and /etc/hostapd/hostapd.conf files if file_system.h will be included
57-
// if these #definitions are missing Access Point will not be set up
58-
// #define DEFAULT_AP_SSID HOSTNAME // <- replace with your information,
59-
// #define DEFAULT_AP_PASSWORD "YOUR_AP_PASSWORD" // <- replace with your information, at least 8 characters
60-
// #define DEFAULT_AP_IP "192.168.0.1" // <- replace with your information
61-
// #define DEFAULT_AP_SUBNET_MASK "255.255.255.0" // <- replace with your information
62-
63-
// define the name Esp32 will use as its host name
64-
#define HOSTNAME "MyEsp32Server" // <- replace with your information, max 32 bytes
65-
66-
67-
// power saving
68-
#define POVER_SAVING_MODE WIFI_PS_NONE // WIFI_PS_NONE or WIFI_PD_MIN_MODEM or WIFI_PS_MAX_MODEM // please check: https://docs.espressif.com/projects/esp-idf/en/stable/esp32/api-reference/network/esp_wifi.html
69-
70-
71-
// replace MACHINETYPE with your information if you want, it is only used in uname telnet command
72-
#if CONFIG_IDF_TARGET_ESP32
73-
#define MACHINETYPE "ESP32"
74-
#elif CONFIG_IDF_TARGET_ESP32S2
75-
#define MACHINETYPE "ESP32-S2"
76-
#elif CONFIG_IDF_TARGET_ESP32S3
77-
#define MACHINETYPE "ESP32-S3"
78-
#elif CONFIG_IDF_TARGET_ESP32C3
79-
#define MACHINETYPE "ESP32-C3"
80-
#elif CONFIG_IDF_TARGET_ESP32C6
81-
#define MACHINETYPE "ESP32-C6"
82-
#elif CONFIG_IDF_TARGET_ESP32H2
83-
#define MACHINETYPE "ESP32-H2"
84-
#else
85-
#define MACHINETYPE "ESP32 (other)"
86-
#endif
38+
// STA(tion)
39+
// #define how ESP32 will connecto to WiFi router
40+
// this information will be written into /etc/wpa_supplicant/wpa_supplicant.conf file if file_system.h will be included
41+
// if these #definitions are missing STAtion will not be set up
42+
#define DEFAULT_STA_SSID "YOUR_STA_SSID" // <- replace with your information
43+
#define DEFAULT_STA_PASSWORD "YOUR_STA_PASSWORD" // <- replace with your information
44+
// the use of DHCP or static IP address wil be set in /network/interfaces if file_system.h will be included, the following is information needed for static IP configuration
45+
// if these #definitions are missing DHCP will be assumed
46+
// #define DEFAULT_STA_IP "10.18.1.200" // <- replace with your information
47+
// #define DEFAULT_STA_SUBNET_MASK "255.255.255.0" // <- replace with your information
48+
// #define DEFAULT_STA_GATEWAY "10.18.1.1" // <- replace with your information
49+
// #define DEFAULT_STA_DNS_1 "193.189.160.13" // <- replace with your information
50+
// #define DEFAULT_STA_DNS_2 "193.189.160.23" // <- replace with your information
51+
52+
// A(ccess) P(oint)
53+
// #define how ESP32 will set up its access point
54+
// this information will be writte into /etc/dhcpcd.conf and /etc/hostapd/hostapd.conf files if file_system.h will be included
55+
// if these #definitions are missing Access Point will not be set up
56+
// #define DEFAULT_AP_SSID HOSTNAME // <- replace with your information,
57+
// #define DEFAULT_AP_PASSWORD "YOUR_AP_PASSWORD" // <- replace with your information, at least 8 characters
58+
// #define DEFAULT_AP_IP "192.168.0.1" // <- replace with your information
59+
// #define DEFAULT_AP_SUBNET_MASK "255.255.255.0" // <- replace with your information
60+
61+
// power saving
62+
#define POVER_SAVING_MODE WIFI_PS_NONE // WIFI_PS_NONE or WIFI_PD_MIN_MODEM or WIFI_PS_MAX_MODEM // please check: https://docs.espressif.com/projects/esp-idf/en/stable/esp32/api-reference/network/esp_wifi.html
63+
64+
// use mDNS so the servers can be accessed in local network by HOSTNAME, but uses some additional memory
65+
#define USE_mDNS // comment this line out to save some memory and code space
66+
67+
// define the name Esp32 will use as its host name, if USE_mDNS is #dfined this is also the name by wich you can address your ESP32 on your local network
68+
#define HOSTNAME "MyESP32Server" // <- replace with your information, max 32 bytes (ESP_NETIF_HOSTNAME_MAX_SIZE) - if you are using mDNS make sure host name complies also with mDNS requirements
69+
// replace MACHINETYPE with your information if you want, it is only used in uname telnet command
70+
#if CONFIG_IDF_TARGET_ESP32
71+
#define MACHINETYPE "ESP32"
72+
#elif CONFIG_IDF_TARGET_ESP32S2
73+
#define MACHINETYPE "ESP32-S2"
74+
#elif CONFIG_IDF_TARGET_ESP32S3
75+
#define MACHINETYPE "ESP32-S3"
76+
#elif CONFIG_IDF_TARGET_ESP32C3
77+
#define MACHINETYPE "ESP32-C3"
78+
#elif CONFIG_IDF_TARGET_ESP32C6
79+
#define MACHINETYPE "ESP32-C6"
80+
#elif CONFIG_IDF_TARGET_ESP32H2
81+
#define MACHINETYPE "ESP32-H2"
82+
#else
83+
#define MACHINETYPE "ESP32 (other)"
84+
#endif
8785

8886

8987
// 4. USERS: #define what kind of user management you want before #including user_management.h
90-
#define USER_MANAGEMENT UNIX_LIKE_USER_MANAGEMENT // or HARDCODED_USER_MANAGEMENT or NO_USER_MANAGEMENT
91-
// if UNIX_LIKE_USER_MANAGEMENT is selected you must also include file_system.h to be able to use /etc/passwd and /etc/shadow files
92-
#define DEFAULT_ROOT_PASSWORD "rootpassword" // <- replace with your information if UNIX_LIKE_USER_MANAGEMENT or HARDCODED_USER_MANAGEMENT are used
93-
#define DEFAULT_WEBADMIN_PASSWORD "webadminpassword" // <- replace with your information if UNIX_LIKE_USER_MANAGEMENT is used
94-
#define DEFAULT_USER_PASSWORD "changeimmediatelly" // <- replace with your information if UNIX_LIKE_USER_MANAGEMENT is used
88+
#define USER_MANAGEMENT UNIX_LIKE_USER_MANAGEMENT // NO_USER_MANAGEMENT or HARDCODED_USER_MANAGEMENT or UNIX_LIKE_USER_MANAGEMENT
89+
// if UNIX_LIKE_USER_MANAGEMENT is selected you must also include file_system.h to be able to use /etc/passwd and /etc/shadow files
90+
#define DEFAULT_ROOT_PASSWORD "rootpassword" // <- replace with your information if UNIX_LIKE_USER_MANAGEMENT or HARDCODED_USER_MANAGEMENT are used
91+
#define DEFAULT_WEBADMIN_PASSWORD "webadminpassword" // <- replace with your information if UNIX_LIKE_USER_MANAGEMENT is used
92+
#define DEFAULT_USER_PASSWORD "changeimmediatelly" // <- replace with your information if UNIX_LIKE_USER_MANAGEMENT is used
9593

9694

9795
// 5. #include (or comment-out) the functionalities you want (or don't want) to use
98-
#ifdef FILE_SYSTEM
99-
#include "./servers/fileSystem.hpp" // most functionalities can run even without a file system if everything is stored in RAM (smaller web pages, ...)
100-
#endif
101-
#include "./servers/netwk.h" // fileSystem.hpp is needed prior to #including network.h if you want to store the default parameters
102-
#include "./servers/time_functions.h" // fileSystem.hpp is needed prior to #including time_functions.h if you want to store the default parameters
103-
#include "./servers/httpClient.h" // support to access web pages from other servers and curl telnet command
104-
#ifdef FILE_SYSTEM
105-
#include "./servers/ftpClient.h" // fileSystem.hpp is needed prior to #including ftpClient.h if you want to store the default parameters
106-
#endif
107-
#include "./servers/smtpClient.h" // fileSystem.hpp is needed prior to #including smtpClient.h if you want to store the default parameters
108-
#include "./servers/userManagement.hpp" // fileSystem.hpp is needed prior to #including userManagement.hpp in case of UNIX_LIKE_USER_MANAGEMENT
109-
#include "./servers/telnetServer.hpp" // needs almost all the above files for whole functionality, but can also work without them
110-
#ifdef FILE_SYSTEM
111-
#include "./servers/ftpServer.hpp" // fileSystem.hpp is also necessary to use ftpServer.h
112-
#endif
113-
#ifdef FILE_SYSTEM
114-
#define WEB_SESSIONS // comment this line out if you won't use web sessions
115-
#endif
116-
#ifdef FILE_SYSTEM
117-
#define USE_I2S_INTERFACE // I2S interface improves web based oscilloscope analog sampling (of a single signal) if ESP32 board has one
118-
// check #definitions in oscilloscope.h if the signals are inverted
119-
#include "./servers/oscilloscope.h" // web based oscilloscope: you must #include httpServer.hpp as well to use it
120-
#endif
121-
#include "./servers/httpServer.hpp" // fileSystem.hpp is needed prior to #including httpServer.h if you want server also to serve .html and other files from built-in flash disk
96+
#include "./servers/dmesg.hpp" // include dmesg_functions.h which is useful for run-time debugging - for dmesg telnet command
97+
#include "./servers/fileSystem.hpp" // most functionalities can run even without a file system if everything is stored in RAM (smaller web pages, ...)
98+
#include "./servers/time_functions.h" // fileSystem.hpp is needed prior to #including time_functions.h if you want to store the default parameters
99+
#include "./servers/netwk.h" // fileSystem.hpp is needed prior to #including network.h if you want to store the default parameters
100+
#include "./servers/httpClient.h" // support to access web pages from other servers and curl telnet command
101+
#include "./servers/smtpClient.h" // fileSystem.hpp is needed prior to #including smtpClient.h if you want to store the default parameters
102+
#include "./servers/userManagement.hpp" // fileSystem.hpp is needed prior to #including userManagement.hpp in case of UNIX_LIKE_USER_MANAGEMENT
103+
#include "./servers/esp32_ping.hpp" // include esp32_ping.hpp to occasioanly ping the router to check if ESP32 is still connected to WiFi
104+
#include "./servers/version_of_servers.h" // include version_of_servers.h to include version information
105+
#include "./servers/telnetServer.hpp" // needs almost all the above files for whole functionality, but can also work without them
106+
#include "./servers/ftpServer.hpp" // fileSystem.hpp is also necessary to use ftpServer.h
107+
#ifdef FILE_SYSTEM
108+
#define USE_WEB_SESSIONS // comment this line out to save some memory if you won't use web sessions
109+
#endif
110+
#ifdef FILE_SYSTEM
111+
#define USE_I2S_INTERFACE // I2S interface improves web based oscilloscope analog sampling (of a single signal) if ESP32 board has one
112+
// check INVERT_ADC1_GET_RAW and INVERT_I2S_READ #definitions in oscilloscope.h if the signals are inverted
113+
#include "./servers/oscilloscope.h" // web based oscilloscope: you must #include httpServer.hpp as well to use it
114+
#endif
115+
#include "./servers/httpServer.hpp" // fileSystem.hpp is needed prior to #including httpServer.h if you want server also to serve .html and other files from built-in flash disk

0 commit comments

Comments
 (0)