Skip to content

Commit 9790cb3

Browse files
author
xlyric
committed
optimisation #define
1 parent 0a104e6 commit 9790cb3

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

src/config/config.h

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ constexpr size_t GETTEMPREFRESH = 5;
4343
* The name of this device (as defined in the AWS IOT console).
4444
* Also used to set the hostname on the network
4545
*/
46-
#define DEVICE_NAME "Pv router ESP32"
46+
constexpr const char* DEVICE_NAME = "Pv router ESP32";
4747

4848
/**
4949
* ADC input pin that is used to read out the CT sensor
@@ -142,7 +142,7 @@ constexpr size_t COMPENSATION = 100; /// % d'asservissement pour l'envoie de pu
142142
* Syncing time with an NTP server
143143
*/
144144
#define NTP_TIME_SYNC_ENABLED true
145-
#define NTP_SERVER "europe.pool.ntp.org"
145+
constexpr const char* NTP_SERVER = "europe.pool.ntp.org";
146146
constexpr size_t NTP_OFFSET_SECONDS = 3600;
147147
constexpr size_t NTP_UPDATE_INTERVAL_MS = 3600000; /// synch de l'heure toute les heures
148148

@@ -156,16 +156,17 @@ constexpr size_t NTP_UPDATE_INTERVAL_MS = 3600000; /// synch de l'heure toute le
156156

157157
#define RELEASE "Version 20250611"
158158
constexpr const int FS_RELEASE = 20250324;
159+
constexpr const char* FS_UPDATE = "<br>!! FS pas à jour !!"; /// paramettre FS pas à jour
159160

160161
#ifdef LIGHT_FIRMWARE
161162
#define VERSION "Light " RELEASE
162163
#else
163-
#define VERSION RELEASE
164+
constexpr const char* VERSION = RELEASE ;
164165
#endif
165166

166-
#define EnvoyJ "/auth/check_jwt"
167-
#define EnvoyR "/api/v1/production"
168-
#define EnvoyS "/production.json"
167+
constexpr const char* EnvoyJ = "/auth/check_jwt";
168+
constexpr const char* EnvoyR = "/api/v1/production";
169+
constexpr const char* EnvoyS = "/production.json";
169170

170171
bool AP = true;
171172

src/functions/appweb.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@ String getState() {
9999
state = INJECTION;
100100
}
101101

102-
const String fs_update = String("<br>!! FS pas à jour !!") ;
103102
const String pvname = String("PV ROUTER ") + WiFi.macAddress().substring(12,14)+ WiFi.macAddress().substring(15,17);
104103
JsonDocument doc;
105104
doc["state"] = state;
@@ -110,7 +109,7 @@ String getState() {
110109
doc["version"] = VERSION ;
111110
}
112111
else {
113-
doc["version"] = VERSION + fs_update;
112+
doc["version"] = String(VERSION) + String(FS_UPDATE);
114113
}
115114
doc["RSSI"] = WiFi.RSSI();
116115
doc["name"] = String(pvname);
@@ -143,7 +142,7 @@ String getStateFull() {
143142
state = INJECTION;
144143
}
145144

146-
const String fs_update = String("<br>!! FS pas à jour !!") ;
145+
147146
const String pvname = String("PV ROUTER ") + WiFi.macAddress().substring(12,14)+ WiFi.macAddress().substring(15,17);
148147

149148
JsonDocument doc;
@@ -158,7 +157,7 @@ String getStateFull() {
158157
doc["version"] = VERSION ;
159158
}
160159
else {
161-
doc["version"] = VERSION + fs_update;
160+
doc["version"] = String(VERSION) + String(FS_UPDATE);
162161
}
163162
doc["RSSI"] = WiFi.RSSI();
164163
doc["name"] = String(pvname);

0 commit comments

Comments
 (0)