[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

+12 -12
View File
@@ -76,7 +76,7 @@ void dumpRTL_433Devices() {
void createOrUpdateDeviceRTL_433(const char* id, const char* model, const char* type, uint8_t flags) {
if (xSemaphoreTake(semaphorecreateOrUpdateDeviceRTL_433, pdMS_TO_TICKS(30000)) == pdFALSE) {
Log.error(F("[rtl_433] semaphorecreateOrUpdateDeviceRTL_433 Semaphore NOT taken" CR));
THEENGS_LOG_ERROR(F("[rtl_433] semaphorecreateOrUpdateDeviceRTL_433 Semaphore NOT taken" CR));
return;
}
@@ -86,13 +86,13 @@ void createOrUpdateDeviceRTL_433(const char* id, const char* model, const char*
//new device
device = new RTL_433device();
if (strlcpy(device->uniqueId, id, uniqueIdSize) > uniqueIdSize) {
Log.warning(F("[rtl_433] Device id %s exceeds available space" CR), id); // Remove from production release ?
THEENGS_LOG_WARNING(F("[rtl_433] Device id %s exceeds available space" CR), id); // Remove from production release ?
};
if (strlcpy(device->modelName, model, modelNameSize) > modelNameSize) {
Log.warning(F("[rtl_433] Device model %s exceeds available space" CR), model); // Remove from production release ?
THEENGS_LOG_WARNING(F("[rtl_433] Device model %s exceeds available space" CR), model); // Remove from production release ?
};
if (strlcpy(device->type, type, typeSize) > typeSize) {
Log.warning(F("[rtl_433] Device type %s exceeds available space" CR), type); // Remove from production release ?
THEENGS_LOG_WARNING(F("[rtl_433] Device type %s exceeds available space" CR), type); // Remove from production release ?
}
DISCOVERY_TRACE_LOG(F("[rtl_433] Device type is %s." CR), device->type); // Remove from production release ?
device->isDisc = flags & device_flags_isDisc;
@@ -115,7 +115,7 @@ void launchRTL_433Discovery(bool overrideDiscovery) {
if (!overrideDiscovery && newRTL_433Devices == 0)
return;
if (xSemaphoreTake(semaphorecreateOrUpdateDeviceRTL_433, pdMS_TO_TICKS(QueueSemaphoreTimeOutLoop)) == pdFALSE) {
Log.error(F("[rtl_433] semaphorecreateOrUpdateDeviceRTL_433 Semaphore NOT taken" CR));
THEENGS_LOG_ERROR(F("[rtl_433] semaphorecreateOrUpdateDeviceRTL_433 Semaphore NOT taken" CR));
return;
}
newRTL_433Devices = 0;
@@ -131,7 +131,7 @@ void launchRTL_433Discovery(bool overrideDiscovery) {
char deviceKeyParameter[25];
memcpy(deviceKeyParameter, &pdevice->uniqueId[strlen(pdevice->uniqueId) - strlen(parameters[i][0])], strlen(parameters[i][0]));
deviceKeyParameter[strlen(parameters[i][0])] = '\0';
Log.trace(F("deviceKeyParameter: %s" CR), deviceKeyParameter);
THEENGS_LOG_TRACE(F("deviceKeyParameter: %s" CR), deviceKeyParameter);
if (strcmp(deviceKeyParameter, parameters[i][0]) == 0) {
// Remove the key from the unique id to extract the device id
@@ -269,7 +269,7 @@ void rtl_433_Callback(char* message) {
JsonObject RFrtl_433_ESPdata = jsonBuffer2.to<JsonObject>();
auto error = deserializeJson(jsonBuffer2, message);
if (error) {
Log.error(F("[rtl_433] deserializeJson() failed: %s" CR), error.c_str());
THEENGS_LOG_ERROR(F("[rtl_433] deserializeJson() failed: %s" CR), error.c_str());
return;
}
@@ -308,7 +308,7 @@ void rtl_433_Callback(char* message) {
storeSignalValue(MQTTvalue);
}
# ifdef MEMORY_DEBUG
Log.trace(F("Post rtl_433_Callback: %d" CR), ESP.getFreeHeap());
THEENGS_LOG_TRACE(F("Post rtl_433_Callback: %d" CR), ESP.getFreeHeap());
# endif
}
@@ -318,8 +318,8 @@ void setupRTL_433() {
semaphorecreateOrUpdateDeviceRTL_433 = xSemaphoreCreateBinary();
xSemaphoreGive(semaphorecreateOrUpdateDeviceRTL_433);
# endif
Log.trace(F("gatewayRTL_433 command topic: %s%s%s" CR), mqtt_topic, gateway_name, subjectMQTTtoRFset);
Log.notice(F("gatewayRTL_433 setup done " CR));
THEENGS_LOG_TRACE(F("gatewayRTL_433 command topic: %s%s%s" CR), mqtt_topic, gateway_name, subjectMQTTtoRFset);
THEENGS_LOG_NOTICE(F("gatewayRTL_433 setup done " CR));
}
void RTL_433Loop() {
@@ -327,13 +327,13 @@ void RTL_433Loop() {
}
extern void enableRTLreceive() {
Log.notice(F("Enable RTL_433 Receiver: %FMhz" CR), RFConfig.frequency);
THEENGS_LOG_NOTICE(F("Enable RTL_433 Receiver: %FMhz" CR), RFConfig.frequency);
rtl_433.initReceiver(RF_MODULE_RECEIVER_GPIO, RFConfig.frequency);
rtl_433.enableReceiver();
}
extern void disableRTLreceive() {
Log.trace(F("disableRTLreceive" CR));
THEENGS_LOG_TRACE(F("disableRTLreceive" CR));
rtl_433.disableReceiver();
}