[SYS] Reduce Logs flash footprint (#2232)

By building only the log level required into LOG_LEVEL

Co-authored-by: Florian <1technophile@users.noreply.github.com>
This commit is contained in:
FlorianandFlorian authored and GitHub committed 2025-08-19 09:15:41 -05:00
1 parent 6e6b54b05e
commit 32174e37a5
52 files changed
+1187 -1136

No files matched your search

+7 -7
View File
@@ -53,7 +53,7 @@ HTU21D htuSensor;
void setupZsensorHTU21() {
delay(10); // Gives the Sensor enough time to turn on
Log.notice(F("HTU21 Initialized - begin()" CR));
THEENGS_LOG_NOTICE(F("HTU21 Initialized - begin()" CR));
# if defined(ESP32)
Wire.begin(I2C_SDA, I2C_SCL);
@@ -65,7 +65,7 @@ void setupZsensorHTU21() {
void MeasureTempHum() {
if (millis() > (timehtu21 + TimeBetweenReadinghtu21)) {
Log.trace(F("Read HTU21 Sensor" CR));
THEENGS_LOG_TRACE(F("Read HTU21 Sensor" CR));
timehtu21 = millis();
static float persisted_htu_tempc;
@@ -75,15 +75,15 @@ void MeasureTempHum() {
float HtuHum = htuSensor.readHumidity();
if (HtuTempC >= 998 || HtuHum >= 998) {
Log.error(F("Failed to read from sensor HTU21!" CR));
THEENGS_LOG_ERROR(F("Failed to read from sensor HTU21!" CR));
return;
}
// Check if reads failed and exit early (to try again).
if (isnan(HtuTempC) || isnan(HtuHum)) {
Log.error(F("Failed to read from sensor HTU21!" CR));
THEENGS_LOG_ERROR(F("Failed to read from sensor HTU21!" CR));
} else {
Log.notice(F("Creating HTU21 buffer" CR));
THEENGS_LOG_NOTICE(F("Creating HTU21 buffer" CR));
StaticJsonDocument<JSON_MSG_BUFFER> HTU21dataBuffer;
JsonObject HTU21data = HTU21dataBuffer.to<JsonObject>();
// Generate Temperature in degrees C
@@ -92,14 +92,14 @@ void MeasureTempHum() {
HTU21data["tempc"] = (float)HtuTempC;
HTU21data["tempf"] = (float)HtuTempF;
} else {
Log.notice(F("Same Temp. Don't send it" CR));
THEENGS_LOG_NOTICE(F("Same Temp. Don't send it" CR));
}
// Generate Humidity in percent
if (HtuHum != persisted_htu_hum || htu21_always) {
HTU21data["hum"] = (float)HtuHum;
} else {
Log.notice(F("Same Humidity. Don't send it" CR));
THEENGS_LOG_NOTICE(F("Same Humidity. Don't send it" CR));
}
HTU21data["origin"] = HTUTOPIC;
enqueueJsonObject(HTU21data);