[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:
1 parent
6e6b54b05e
commit
32174e37a5
52 files changed
+1187
-1136
No files matched your search
@@ -53,23 +53,23 @@ Adafruit_AHTX0 ahtSensor;
|
||||
|
||||
void setupZsensorAHTx0() {
|
||||
delay(10); // Gives the Sensor enough time to turn on
|
||||
Log.notice(F("AHTx0 Initialized - begin()" CR));
|
||||
THEENGS_LOG_NOTICE(F("AHTx0 Initialized - begin()" CR));
|
||||
|
||||
# if defined(ESP32)
|
||||
Wire.begin(AHT_I2C_SDA, AHT_I2C_SCL);
|
||||
if (!ahtSensor.begin(&Wire)) {
|
||||
Log.error(F("Failed to initialize AHTx0 sensor!" CR));
|
||||
THEENGS_LOG_ERROR(F("Failed to initialize AHTx0 sensor!" CR));
|
||||
}
|
||||
# else
|
||||
if (!ahtSensor.begin()) {
|
||||
Log.error(F("Failed to initialize AHTx0 sensor!" CR));
|
||||
THEENGS_LOG_ERROR(F("Failed to initialize AHTx0 sensor!" CR));
|
||||
}
|
||||
# endif
|
||||
}
|
||||
|
||||
void MeasureAHTTempHum() {
|
||||
if (millis() > (timeAHTx0 + TimeBetweenReadingAHTx0)) {
|
||||
Log.trace(F("Read AHTx0 Sensor" CR));
|
||||
THEENGS_LOG_TRACE(F("Read AHTx0 Sensor" CR));
|
||||
|
||||
timeAHTx0 = millis();
|
||||
static float persisted_aht_tempc;
|
||||
@@ -78,15 +78,15 @@ void MeasureAHTTempHum() {
|
||||
sensors_event_t ahtTempC, ahtHum;
|
||||
if (!ahtSensor.getEvent(&ahtHum, &ahtTempC)) // get sensor data
|
||||
{
|
||||
Log.error(F("Failed to read from sensor AHTx0!" CR));
|
||||
THEENGS_LOG_ERROR(F("Failed to read from sensor AHTx0!" CR));
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if reads failed and exit early (to try again).
|
||||
if (isnan(ahtTempC.temperature) || isnan(ahtHum.relative_humidity)) {
|
||||
Log.error(F("Failed to read from sensor AHTx0!" CR));
|
||||
THEENGS_LOG_ERROR(F("Failed to read from sensor AHTx0!" CR));
|
||||
} else {
|
||||
Log.notice(F("Creating AHTx0 buffer" CR));
|
||||
THEENGS_LOG_NOTICE(F("Creating AHTx0 buffer" CR));
|
||||
StaticJsonDocument<JSON_MSG_BUFFER> AHTx0dataBuffer;
|
||||
JsonObject AHTx0data = AHTx0dataBuffer.to<JsonObject>();
|
||||
// Generate Temperature in degrees C
|
||||
@@ -95,14 +95,14 @@ void MeasureAHTTempHum() {
|
||||
AHTx0data["tempc"] = (float)ahtTempC.temperature;
|
||||
AHTx0data["tempf"] = (float)ahtTempF;
|
||||
} 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 (ahtHum.relative_humidity != persisted_aht_hum || AHTx0_always) {
|
||||
AHTx0data["hum"] = (float)ahtHum.relative_humidity;
|
||||
} else {
|
||||
Log.notice(F("Same Humidity. Don't send it" CR));
|
||||
THEENGS_LOG_NOTICE(F("Same Humidity. Don't send it" CR));
|
||||
}
|
||||
AHTx0data["origin"] = AHTTOPIC;
|
||||
enqueueJsonObject(AHTx0data);
|
||||
|
||||
Reference in new issue
Block a user