|
13 | 13 |
|
14 | 14 |
|
15 | 15 | // 1. TIME: #define which time settings, wil be used with time_functions.h - will be included later |
16 | | - // define which 3 NTP servers will be called to get current GMT (time) from |
17 | | - // this information will be written into /etc/ntp.conf file if file_system.h will be included |
18 | | - #define DEFAULT_NTP_SERVER_1 "1.si.pool.ntp.org" // <- replace with your information |
19 | | - #define DEFAULT_NTP_SERVER_2 "2.si.pool.ntp.org" // <- replace with your information |
20 | | - #define DEFAULT_NTP_SERVER_3 "3.si.pool.ntp.org" // <- replace with your information |
21 | | - // define time zone to calculate local time from GMT |
22 | | - #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 |
| 16 | +// define which 3 NTP servers will be called to get current GMT (time) from |
| 17 | +// this information will be written into /etc/ntp.conf file if file_system.h will be included |
| 18 | +#define DEFAULT_NTP_SERVER_1 "1.si.pool.ntp.org" // <- replace with your information |
| 19 | +#define DEFAULT_NTP_SERVER_2 "2.si.pool.ntp.org" // <- replace with your information |
| 20 | +#define DEFAULT_NTP_SERVER_3 "3.si.pool.ntp.org" // <- replace with your information |
| 21 | +// define time zone to calculate local time from GMT |
| 22 | +#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 |
23 | 23 |
|
24 | 24 |
|
25 | | -// 2. FILE SYSTEM: #define which file system you want to use |
26 | | - // 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) |
27 | | - // FAT file system can be bitwise combined with FILE_SYSTEM_SD_CARD, like #define FILE_SYSTEM (FILE_SYSTEM_FAT | FILE_SYSTEM_SD_CARD) |
| 25 | +// 2. FILE SYSTEM: #define which file system you want to use |
| 26 | +// 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) |
| 27 | +// FAT file system can be bitwise combined with FILE_SYSTEM_SD_CARD, like #define FILE_SYSTEM (FILE_SYSTEM_FAT | FILE_SYSTEM_SD_CARD) |
28 | 28 |
|
29 | | - #define FILE_SYSTEM FILE_SYSTEM_LITTLEFS // LittleFS uses the least of memory, which may be needed for all the functionalities to run |
| 29 | +#define FILE_SYSTEM FILE_SYSTEM_LITTLEFS // LittleFS uses the least of memory, which may be needed for all the functionalities to run |
30 | 30 |
|
31 | 31 |
|
32 | 32 | // 3. NETWORK: #define how ESP32 will use the network |
33 | | - // STA(tion) |
34 | | - // #define how ESP32 will connecto to WiFi router |
35 | | - // this information will be written into /etc/wpa_supplicant/wpa_supplicant.conf file if file_system.h will be included |
36 | | - // if these #definitions are missing STAtion will not be set up |
37 | | - #define DEFAULT_STA_SSID "YOUR_STA_SSID" // <- replace with your information |
38 | | - #define DEFAULT_STA_PASSWORD "YOUR_STA_PASSWORD" // <- replace with your information |
39 | | - // 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 |
40 | | - // if these #definitions are missing DHCP will be assumed |
41 | | - // #define DEFAULT_STA_IP "10.18.1.200" // <- replace with your information |
42 | | - // #define DEFAULT_STA_SUBNET_MASK "255.255.255.0" // <- replace with your information |
43 | | - // #define DEFAULT_STA_GATEWAY "10.18.1.1" // <- replace with your information |
44 | | - // #define DEFAULT_STA_DNS_1 "193.189.160.13" // <- replace with your information |
45 | | - // #define DEFAULT_STA_DNS_2 "193.189.160.23" // <- replace with your information |
46 | | - |
47 | | - // A(ccess) P(oint) |
48 | | - // #define how ESP32 will set up its access point |
49 | | - // this information will be writte into /etc/dhcpcd.conf and /etc/hostapd/hostapd.conf files if file_system.h will be included |
50 | | - // if these #definitions are missing Access Point will not be set up |
51 | | - // #define DEFAULT_AP_SSID HOSTNAME // <- replace with your information, |
52 | | - // #define DEFAULT_AP_PASSWORD "YOUR_AP_PASSWORD" // <- replace with your information, at least 8 characters |
53 | | - // #define DEFAULT_AP_IP "192.168.0.1" // <- replace with your information |
54 | | - // #define DEFAULT_AP_SUBNET_MASK "255.255.255.0" // <- replace with your information |
55 | | - |
56 | | - // define the name Esp32 will use as its host name |
57 | | - #define HOSTNAME "MyEsp32Server" // <- replace with your information, max 32 bytes |
58 | | - #define MACHINETYPE "ESP32 Dev Module" // <- replace with your information, machine type, it is only used in uname telnet command |
| 33 | +// STA(tion) |
| 34 | +// #define how ESP32 will connecto to WiFi router |
| 35 | +// this information will be written into /etc/wpa_supplicant/wpa_supplicant.conf file if file_system.h will be included |
| 36 | +// if these #definitions are missing STAtion will not be set up |
| 37 | +#define DEFAULT_STA_SSID "YOUR_STA_SSID" // <- replace with your information |
| 38 | +#define DEFAULT_STA_PASSWORD "YOUR_STA_PASSWORD" // <- replace with your information |
| 39 | +// the use of DHCP or static IP address wil be set in /network/interfaces if fileSystem.hpp is included. |
| 40 | +// The following is information needed for static IP configuration. If these #definitions are missing DHCP is assumed |
| 41 | +// #define DEFAULT_STA_IP "10.18.1.200" // <- replace with your information |
| 42 | +// #define DEFAULT_STA_SUBNET_MASK "255.255.255.0" // <- replace with your information |
| 43 | +// #define DEFAULT_STA_GATEWAY "10.18.1.1" // <- replace with your information |
| 44 | +// #define DEFAULT_STA_DNS_1 "193.189.160.13" // <- replace with your information |
| 45 | +// #define DEFAULT_STA_DNS_2 "193.189.160.23" // <- replace with your information |
| 46 | + |
| 47 | +// A(ccess) P(oint) |
| 48 | +// #define how ESP32 will set up its access point |
| 49 | +// this information will be writte into /etc/dhcpcd.conf and /etc/hostapd/hostapd.conf files if file_system.h will be included |
| 50 | +// if these #definitions are missing Access Point will not be set up |
| 51 | +// #define DEFAULT_AP_SSID HOSTNAME // <- replace with your information, |
| 52 | +// #define DEFAULT_AP_PASSWORD "YOUR_AP_PASSWORD" // <- replace with your information, at least 8 characters |
| 53 | +// #define DEFAULT_AP_IP "192.168.0.1" // <- replace with your information |
| 54 | +// #define DEFAULT_AP_SUBNET_MASK "255.255.255.0" // <- replace with your information |
| 55 | + |
| 56 | +// define the name Esp32 will use as its host name |
| 57 | +#define HOSTNAME "MyEsp32Server" // <- replace with your information, max 32 bytes |
| 58 | +// replace MACHINETYPE with your information if you want, it is only used in uname telnet command |
| 59 | +#if CONFIG_IDF_TARGET_ESP32 |
| 60 | + #define MACHINETYPE "ESP32" |
| 61 | +#elif CONFIG_IDF_TARGET_ESP32S2 |
| 62 | + #define MACHINETYPE "ESP32-S2" |
| 63 | +#elif CONFIG_IDF_TARGET_ESP32S3 |
| 64 | + #define MACHINETYPE "ESP32-S3" |
| 65 | +#elif CONFIG_IDF_TARGET_ESP32C3 |
| 66 | + #define MACHINETYPE "ESP32-C3" |
| 67 | +#elif CONFIG_IDF_TARGET_ESP32C6 |
| 68 | + #define MACHINETYPE "ESP32-C6" |
| 69 | +#elif CONFIG_IDF_TARGET_ESP32H2 |
| 70 | + #define MACHINETYPE "ESP32-H2" |
| 71 | +#else |
| 72 | + #define MACHINETYPE "ESP32 (other)" |
| 73 | +#endif |
59 | 74 |
|
60 | 75 |
|
61 | 76 | // 4. USERS: #define what kind of user management you want before #including user_management.h |
62 | | - #define USER_MANAGEMENT UNIX_LIKE_USER_MANAGEMENT // or HARDCODED_USER_MANAGEMENT or NO_USER_MANAGEMENT |
63 | | - // 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 |
64 | | - #define DEFAULT_ROOT_PASSWORD "rootpassword" // <- replace with your information if UNIX_LIKE_USER_MANAGEMENT or HARDCODED_USER_MANAGEMENT are used |
65 | | - #define DEFAULT_WEBADMIN_PASSWORD "webadminpassword" // <- replace with your information if UNIX_LIKE_USER_MANAGEMENT is used |
66 | | - #define DEFAULT_USER_PASSWORD "changeimmediatelly" // <- replace with your information if UNIX_LIKE_USER_MANAGEMENT is used |
| 77 | +#define USER_MANAGEMENT UNIX_LIKE_USER_MANAGEMENT // or HARDCODED_USER_MANAGEMENT or NO_USER_MANAGEMENT |
| 78 | +// 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 |
| 79 | +#define DEFAULT_ROOT_PASSWORD "rootpassword" // <- replace with your information if UNIX_LIKE_USER_MANAGEMENT or HARDCODED_USER_MANAGEMENT are used |
| 80 | +#define DEFAULT_WEBADMIN_PASSWORD "webadminpassword" // <- replace with your information if UNIX_LIKE_USER_MANAGEMENT is used |
| 81 | +#define DEFAULT_USER_PASSWORD "changeimmediatelly" // <- replace with your information if UNIX_LIKE_USER_MANAGEMENT is used |
67 | 82 |
|
68 | 83 |
|
69 | 84 | // 5. #include (or comment-out) the functionalities you want (or don't want) to use |
70 | | -#include "./servers/fileSystem.hpp" // most functionalities can run even without a file system if everything is stored in RAM (smaller web pages, ...) |
71 | | -#include "./servers/time_functions.h" // fileSystem.hpp is needed prior to #including time_functions.h if you want to store the default parameters |
72 | | -#include "./servers/network.h" // file>ystem.hpp is needed prior to #including network.h if you want to store the default parameters |
73 | | -#include "./servers/httpClient.h" // support to access web pages from other servers and curl telnet command |
74 | | -#include "./servers/ftpClient.h" // fileSystem.hpp is needed prior to #including ftpClient.h if you want to store the default parameters |
75 | | -#include "./servers/smtpClient.h" // fileSystem.hpp is needed prior to #including smtpClient.h if you want to store the default parameters |
76 | | -#include "./servers/userManagement.hpp" // fileSystem.hpp is needed prior to #including userManagement.hpp in case of UNIX_LIKE_USER_MANAGEMENT |
77 | | -#include "./servers/telnetServer.hpp" // needs almost all the above files for whole functionality, but can also work without them |
78 | | -#include "./servers/ftpServer.hpp" // fileSystem.hpp is also necessary to use ftpServer.h |
79 | | -#include "./servers/oscilloscope.h" // web based oscilloscope: you must #include httpServer.hpp as well to use it |
80 | | -#define WEB_SESSIONS // comment this line out if you won't use web sessions |
81 | | -#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 |
| 85 | +#ifdef FILE_SYSTEM |
| 86 | + #include "./servers/fileSystem.hpp" // most functionalities can run even without a file system if everything is stored in RAM (smaller web pages, ...) |
| 87 | +#endif |
| 88 | +#include "./servers/time_functions.h" // fileSystem.hpp is needed prior to #including time_functions.h if you want to store the default parameters |
| 89 | +#include "./servers/network.h" // file>ystem.hpp is needed prior to #including network.h if you want to store the default parameters |
| 90 | +#include "./servers/httpClient.h" // support to access web pages from other servers and curl telnet command |
| 91 | +#ifdef FILE_SYSTEM |
| 92 | + #include "./servers/ftpClient.h" // fileSystem.hpp is needed prior to #including ftpClient.h if you want to store the default parameters |
| 93 | +#endif |
| 94 | +#include "./servers/smtpClient.h" // fileSystem.hpp is needed prior to #including smtpClient.h if you want to store the default parameters |
| 95 | +#include "./servers/userManagement.hpp" // fileSystem.hpp is needed prior to #including userManagement.hpp in case of UNIX_LIKE_USER_MANAGEMENT |
| 96 | +#include "./servers/telnetServer.hpp" // needs almost all the above files for whole functionality, but can also work without them |
| 97 | +#ifdef FILE_SYSTEM |
| 98 | + #include "./servers/ftpServer.hpp" // fileSystem.hpp is also necessary to use ftpServer.h |
| 99 | +#endif |
| 100 | +#ifdef FILE_SYSTEM |
| 101 | + #define WEB_SESSIONS // comment this line out if you won't use web sessions |
| 102 | +#endif |
| 103 | +#ifdef FILE_SYSTEM |
| 104 | + #define USE_I2S_INTERFACE // I2S interface improves web based oscilloscope analog sampling (of a single signal) if ESP32 board has one |
| 105 | + // check #definitions in oscilloscope.h if the signals are inverted |
| 106 | + #include "./servers/oscilloscope.h" // web based oscilloscope: you must #include httpServer.hpp as well to use it |
| 107 | +#endif |
| 108 | +#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 |
82 | 109 |
|
83 | 110 |
|
84 | 111 | // uncomment the following line to get additional compile-time information about how the project gets compiled |
85 | 112 | // #define SHOW_COMPILE_TIME_INFORMATION |
86 | 113 |
|
87 | 114 |
|
88 | 115 | // backward compatibility |
89 | | -#if (FILE_SYSTEM & FILE_SYSTEM_FAT) == FILE_SYSTEM_FAT || (FILE_SYSTEM & FILE_SYSTEM_LITTLEFS) == FILE_SYSTEM_LITTLEFS |
90 | | - [[deprecated("Replaced by fileSystem.mount(bool)")]] |
91 | | - bool mountFileSystem (bool formatIfUnformatted) { return fileSystem.mount (formatIfUnformatted); } |
| 116 | +#ifdef FILE_SYSTEM |
| 117 | + #if (FILE_SYSTEM & FILE_SYSTEM_FAT) == FILE_SYSTEM_FAT || (FILE_SYSTEM & FILE_SYSTEM_LITTLEFS) == FILE_SYSTEM_LITTLEFS |
| 118 | + [[deprecated("Replaced by fileSystem.mount(bool)")]] bool mountFileSystem(bool formatIfUnformatted) { |
| 119 | + return fileSystem.mount(formatIfUnformatted); |
| 120 | + } |
| 121 | + #endif |
92 | 122 | #endif |
93 | 123 |
|
94 | | -[[deprecated("Replaced by userManagement.initialize()")]] |
95 | | -void initializeUsers () { userManagement.initialize (); } |
96 | | -
|
| 124 | +[[deprecated("Replaced by userManagement.initialize()")]] void initializeUsers() { |
| 125 | + userManagement.initialize(); |
| 126 | +} |
0 commit comments