[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
@@ -49,7 +49,7 @@ static unsigned long timebh1750 = 0;
|
||||
static int BH1750_i2c_addr = BH1750_I2C_ADDR;
|
||||
|
||||
void setupZsensorBH1750() {
|
||||
Log.notice(F("Setup BH1750 on adress: %H" CR), BH1750_i2c_addr);
|
||||
THEENGS_LOG_NOTICE(F("Setup BH1750 on adress: %H" CR), BH1750_i2c_addr);
|
||||
Wire.begin();
|
||||
Wire.beginTransmission(BH1750_i2c_addr);
|
||||
Wire.write(0x10); // Set resolution to 1 Lux
|
||||
@@ -59,7 +59,7 @@ void setupZsensorBH1750() {
|
||||
|
||||
void MeasureLightIntensity() {
|
||||
if (millis() > (timebh1750 + TimeBetweenReadingBH1750)) { //retrieving value of Lux, FtCd and Wattsm2 from BH1750
|
||||
Log.trace(F("Creating BH1750 buffer" CR));
|
||||
THEENGS_LOG_TRACE(F("Creating BH1750 buffer" CR));
|
||||
StaticJsonDocument<JSON_MSG_BUFFER> BH1750dataBuffer;
|
||||
JsonObject BH1750data = BH1750dataBuffer.to<JsonObject>();
|
||||
|
||||
@@ -75,7 +75,7 @@ void MeasureLightIntensity() {
|
||||
// Check if reads failed and exit early (to try again).
|
||||
Wire.requestFrom(BH1750_i2c_addr, 2);
|
||||
if (Wire.available() != 2) {
|
||||
Log.error(F("Failed to read from LightSensor BH1750!" CR));
|
||||
THEENGS_LOG_ERROR(F("Failed to read from LightSensor BH1750!" CR));
|
||||
} else {
|
||||
i = Wire.read();
|
||||
i <<= 8;
|
||||
@@ -90,21 +90,21 @@ void MeasureLightIntensity() {
|
||||
if (Lux != persistedll || bh1750_always) {
|
||||
BH1750data["lux"] = (unsigned int)Lux;
|
||||
} else {
|
||||
Log.trace(F("Same lux don't send it" CR));
|
||||
THEENGS_LOG_TRACE(F("Same lux don't send it" CR));
|
||||
}
|
||||
|
||||
// Generate FtCd
|
||||
if (ftcd != persistedlf || bh1750_always) {
|
||||
BH1750data["ftcd"] = (unsigned int)ftcd;
|
||||
} else {
|
||||
Log.trace(F("Same ftcd don't send it" CR));
|
||||
THEENGS_LOG_TRACE(F("Same ftcd don't send it" CR));
|
||||
}
|
||||
|
||||
// Generate Watts/m2
|
||||
if (Wattsm2 != persistedlw || bh1750_always) {
|
||||
BH1750data["wattsm2"] = (unsigned int)Wattsm2;
|
||||
} else {
|
||||
Log.trace(F("Same wattsm2 don't send it" CR));
|
||||
THEENGS_LOG_TRACE(F("Same wattsm2 don't send it" CR));
|
||||
}
|
||||
BH1750data["origin"] = subjectBH1750toMQTT;
|
||||
enqueueJsonObject(BH1750data);
|
||||
|
||||
Reference in new issue
Block a user