mirror of
https://github.com/letscontrolit/ESPEasy.git
synced 2026-07-27 19:57:38 +00:00
[Build] Reduce bin size by disabling logs in BUILD_NO_DEBUG builds
This commit is contained in:
@@ -42,7 +42,9 @@ void setNetworkMedium(NetworkMedium_t new_medium) {
|
||||
}
|
||||
statusLED(true);
|
||||
active_network_medium = new_medium;
|
||||
#ifndef BUILD_NO_DEBUG
|
||||
addLog(LOG_LEVEL_INFO, concat(F("Set Network mode: "), toString(active_network_medium)));
|
||||
#endif
|
||||
}
|
||||
|
||||
/*********************************************************************************************\
|
||||
|
||||
@@ -296,7 +296,7 @@ void ESPEasyWiFi_t::disconnect() { doWiFiDisconnect(); }
|
||||
|
||||
void ESPEasyWiFi_t::setState(WiFiState_e newState, uint32_t timeout) {
|
||||
if (newState == _state) { return; }
|
||||
|
||||
#ifndef BUILD_NO_DEBUG
|
||||
if (loglevelActiveFor(LOG_LEVEL_INFO)) {
|
||||
addLog(
|
||||
LOG_LEVEL_INFO,
|
||||
@@ -304,7 +304,7 @@ void ESPEasyWiFi_t::setState(WiFiState_e newState, uint32_t timeout) {
|
||||
concat(F(" to: "), toString(newState)) +
|
||||
concat(F(" timeout: "), timeout));
|
||||
}
|
||||
|
||||
#endif
|
||||
if (_state == WiFiState_e::AP_only) {
|
||||
setAPinternal(false);
|
||||
setAP(false);
|
||||
@@ -482,14 +482,14 @@ bool ESPEasyWiFi_t::connectSTA()
|
||||
}
|
||||
|
||||
const WiFi_AP_Candidate candidate = WiFi_AP_Candidates.getCurrent();
|
||||
|
||||
#ifndef BUILD_NO_DEBUG
|
||||
if (loglevelActiveFor(LOG_LEVEL_INFO)) {
|
||||
addLogMove(LOG_LEVEL_INFO, strformat(
|
||||
F("WIFI : Connecting %s attempt #%u"),
|
||||
candidate.toString().c_str(),
|
||||
wifi_STA_data->_establishConnectStats.getCycleCount() + 1));
|
||||
}
|
||||
|
||||
#endif
|
||||
// WiFiEventData.markWiFiBegin();
|
||||
|
||||
if (prepareWiFi()) {
|
||||
|
||||
@@ -293,7 +293,7 @@ void setupStaticIPconfig() {
|
||||
// WiFiEventData.dns0_cache = dns;
|
||||
|
||||
WiFi.config(ip, gw, subnet, dns);
|
||||
|
||||
#ifndef BUILD_NO_DEBUG
|
||||
if (loglevelActiveFor(LOG_LEVEL_INFO)) {
|
||||
addLogMove(LOG_LEVEL_INFO, strformat(
|
||||
F("IP : Static IP : %s GW: %s SN: %s DNS: %s"),
|
||||
@@ -302,6 +302,7 @@ void setupStaticIPconfig() {
|
||||
formatIP(subnet).c_str(),
|
||||
getValue(LabelType::DNS).c_str()));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// ********************************************************************************
|
||||
|
||||
@@ -136,7 +136,7 @@ void doSetAPinternal(bool enable)
|
||||
auto data = getWiFi_AP_NWPluginData_static_runtime();
|
||||
|
||||
if (data) { data->mark_start(); }
|
||||
|
||||
#ifndef BUILD_NO_DEBUG
|
||||
if (loglevelActiveFor(LOG_LEVEL_INFO)) {
|
||||
addLogMove(LOG_LEVEL_INFO, strformat(
|
||||
F("WIFI : AP Mode enabled. SSID: %s IP: %s ch: %d"),
|
||||
@@ -151,6 +151,7 @@ void doSetAPinternal(bool enable)
|
||||
softAPSSID.c_str(),
|
||||
formatIP(apIP).c_str()));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if (Settings.ApCaptivePortal()) {
|
||||
|
||||
@@ -139,7 +139,6 @@ const __FlashStringHelper * Command_Background(struct EventStruct *event, const
|
||||
serialPrintln(F("end"));
|
||||
return return_see_serial(event);
|
||||
}
|
||||
#endif // BUILD_NO_DIAGNOSTIC_COMMANDS
|
||||
|
||||
const __FlashStringHelper * Command_Debug(struct EventStruct *event, const char *Line)
|
||||
{
|
||||
@@ -152,6 +151,8 @@ const __FlashStringHelper * Command_Debug(struct EventStruct *event, const char
|
||||
}
|
||||
return return_see_serial(event);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
String Command_logentry(struct EventStruct *event, const char *Line)
|
||||
{
|
||||
|
||||
@@ -17,8 +17,8 @@ const __FlashStringHelper * Command_SerialFloat(struct EventStruct *event, const
|
||||
const __FlashStringHelper * Command_MemInfo(struct EventStruct *event, const char* Line);
|
||||
const __FlashStringHelper * Command_MemInfo_detail(struct EventStruct *event, const char* Line);
|
||||
const __FlashStringHelper * Command_Background(struct EventStruct *event, const char* Line);
|
||||
#endif
|
||||
const __FlashStringHelper * Command_Debug(struct EventStruct *event, const char* Line);
|
||||
#endif
|
||||
String Command_logentry(struct EventStruct *event, const char* Line);
|
||||
#ifndef BUILD_NO_DIAGNOSTIC_COMMANDS
|
||||
const __FlashStringHelper * Command_JSONPortStatus(struct EventStruct *event, const char* Line);
|
||||
|
||||
@@ -281,7 +281,9 @@ bool InternalCommands::executeInternalCommand()
|
||||
case ESPEasy_cmd_e::controllerdisable: COMMAND_CASE_R(Command_Controller_Disable, 1); // Controller.h
|
||||
case ESPEasy_cmd_e::controllerenable: COMMAND_CASE_R(Command_Controller_Enable, 1); // Controller.h
|
||||
case ESPEasy_cmd_e::datetime: COMMAND_CASE_R(Command_DateTime, 2); // Time.h
|
||||
#ifndef BUILD_NO_DIAGNOSTIC_COMMANDS
|
||||
case ESPEasy_cmd_e::debug: COMMAND_CASE_R(Command_Debug, 1); // Diagnostic.h
|
||||
#endif
|
||||
case ESPEasy_cmd_e::dec: COMMAND_CASE_A(Command_Rules_Dec, -1); // Rules.h
|
||||
case ESPEasy_cmd_e::deepsleep: COMMAND_CASE_R(Command_System_deepSleep, 1); // System.h
|
||||
case ESPEasy_cmd_e::delay: COMMAND_CASE_R(Command_Delay, 1); // Timers.h
|
||||
|
||||
@@ -46,7 +46,9 @@ const char Internal_commands_c[] PROGMEM =
|
||||
#define Int_cmd_d_offset ESPEasy_cmd_e::datetime
|
||||
const char Internal_commands_d[] PROGMEM =
|
||||
"datetime|"
|
||||
#ifndef BUILD_NO_DIAGNOSTIC_COMMANDS
|
||||
"debug|"
|
||||
#endif
|
||||
"dec|"
|
||||
"deepsleep|"
|
||||
"delay|"
|
||||
|
||||
@@ -31,7 +31,9 @@ enum class ESPEasy_cmd_e : uint8_t {
|
||||
controllerenable,
|
||||
|
||||
datetime,
|
||||
#ifndef BUILD_NO_DIAGNOSTIC_COMMANDS
|
||||
debug,
|
||||
#endif
|
||||
dec,
|
||||
deepsleep,
|
||||
delay,
|
||||
|
||||
@@ -2248,12 +2248,18 @@ To create/register a plugin, you have to :
|
||||
#ifdef USES_P040
|
||||
#undef USES_P040 // RFID - ID12LA/RDM6300
|
||||
#endif
|
||||
#ifdef USES_P042
|
||||
#undef USES_P042 // Candle
|
||||
#endif
|
||||
#ifdef USES_P043
|
||||
#undef USES_P043 // ClkOutput
|
||||
#endif
|
||||
#ifdef USES_P079
|
||||
#undef USES_P079 // Wemos Motoshield
|
||||
#endif
|
||||
#ifdef USES_P073
|
||||
#undef USES_P073 // 7DGT
|
||||
#endif
|
||||
#endif // ifdef PLUGIN_BUILD_IR_EXTENDED_NO_RX
|
||||
|
||||
// EXPERIMENTAL (playground) #######################
|
||||
@@ -4033,4 +4039,13 @@ To create/register a plugin, you have to :
|
||||
# define FEATURE_STORE_NETWORK_INTERFACE_SETTINGS 0
|
||||
#endif
|
||||
|
||||
#ifdef USES_P180
|
||||
#ifdef FEATURE_BUS_COMMAND
|
||||
#undef FEATURE_BUS_COMMAND
|
||||
#endif
|
||||
#ifndef FEATURE_BUS_COMMAND
|
||||
#define FEATURE_BUS_COMMAND 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif // CUSTOMBUILD_DEFINE_PLUGIN_SETS_H
|
||||
|
||||
@@ -656,10 +656,11 @@ void MQTTparseSystemVariablesAndSubscribe(String subscribeTo) {
|
||||
|
||||
if (!subscribeTo.isEmpty()) {
|
||||
MQTTclient.subscribe(subscribeTo.c_str());
|
||||
|
||||
# ifndef BUILD_NO_DEBUG
|
||||
if (loglevelActiveFor(LOG_LEVEL_INFO)) {
|
||||
addLogMove(LOG_LEVEL_INFO, concat(F("MQTT : Subscribed to: "), subscribeTo));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -98,11 +98,11 @@ void rulesProcessing(const String& event) {
|
||||
#ifndef BUILD_NO_DEBUG
|
||||
const unsigned long timer = millis();
|
||||
#endif // ifndef BUILD_NO_DEBUG
|
||||
|
||||
#ifndef BUILD_NO_DEBUG
|
||||
if (loglevelActiveFor(LOG_LEVEL_INFO)) {
|
||||
addLogMove(LOG_LEVEL_INFO, concat(F("EVENT: "), event));
|
||||
}
|
||||
|
||||
#endif
|
||||
if (Settings.OldRulesEngine()) {
|
||||
bool eventHandled = false;
|
||||
|
||||
@@ -1049,13 +1049,13 @@ void processMatchedRule(String& action, const String& event,
|
||||
substitute_eventvalue(action, event);
|
||||
|
||||
const bool executeRestricted = equals(parseString(action, 1), F("restrict"));
|
||||
|
||||
#ifndef BUILD_NO_DEBUG
|
||||
if (loglevelActiveFor(LOG_LEVEL_INFO)) {
|
||||
String actionlog = executeRestricted ? F("ACT : (restricted) ") : F("ACT : ");
|
||||
actionlog += action;
|
||||
addLogMove(LOG_LEVEL_INFO, actionlog);
|
||||
}
|
||||
|
||||
#endif
|
||||
if (executeRestricted) {
|
||||
ExecuteCommand_all({EventValueSource::Enum::VALUE_SOURCE_RULES_RESTRICTED, parseStringToEndKeepCase(action, 2)});
|
||||
} else {
|
||||
|
||||
@@ -208,9 +208,9 @@ void EspEasy_Console_t::begin(uint32_t baudrate)
|
||||
#else // if FEATURE_DEFINE_SERIAL_CONSOLE_PORT
|
||||
# ifdef ESP8266
|
||||
_mainSerial._serial->begin(baudrate);
|
||||
#ifdef BUILD_NO_DEBUG
|
||||
# ifndef BUILD_NO_DEBUG
|
||||
addLog(LOG_LEVEL_INFO, F("ESPEasy console using HW Serial"));
|
||||
#endif
|
||||
#endif
|
||||
# endif // ifdef ESP8266
|
||||
# ifdef ESP32
|
||||
|
||||
|
||||
@@ -369,9 +369,9 @@ void ESPEasy_setup()
|
||||
#ifndef BUILD_NO_RAM_TRACKER
|
||||
logMemUsageAfter(F("LoadSettings()"));
|
||||
#endif // ifndef BUILD_NO_RAM_TRACKER
|
||||
|
||||
#ifndef BUILD_NO_DEBUG
|
||||
addLog(LOG_LEVEL_INFO, concat(F("CPU Frequency: "), ESP.getCpuFreqMHz()));
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef ESP32
|
||||
#if !defined(CORE32SOLO1) && !defined(ESP32P4)
|
||||
@@ -488,11 +488,11 @@ void ESPEasy_setup()
|
||||
#ifndef BUILD_NO_RAM_TRACKER
|
||||
logMemUsageAfter(F("initSerial()"));
|
||||
#endif // ifndef BUILD_NO_RAM_TRACKER
|
||||
|
||||
#ifndef BUILD_NO_DEBUG
|
||||
if (loglevelActiveFor(LOG_LEVEL_INFO)) {
|
||||
addLogMove(LOG_LEVEL_INFO, concat(F("INIT : Free RAM:"), FreeMem()));
|
||||
}
|
||||
|
||||
#endif
|
||||
#ifndef BUILD_NO_DEBUG
|
||||
|
||||
if (Settings.UseSerial && (Settings.SerialLogLevel >= LOG_LEVEL_DEBUG_MORE)) {
|
||||
@@ -524,7 +524,7 @@ void ESPEasy_setup()
|
||||
#ifndef BUILD_NO_RAM_TRACKER
|
||||
logMemUsageAfter(F("PluginInit()"));
|
||||
#endif
|
||||
|
||||
#ifndef BUILD_NO_DEBUG
|
||||
if (loglevelActiveFor(LOG_LEVEL_INFO)) {
|
||||
String log;
|
||||
if (reserve_special(log, 80)) {
|
||||
@@ -537,7 +537,7 @@ void ESPEasy_setup()
|
||||
addLogMove(LOG_LEVEL_INFO, log);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
/*
|
||||
if ((getDeviceCount() + 1) >= PLUGIN_MAX) {
|
||||
addLog(LOG_LEVEL_ERROR, concat(F("Programming error! - Increase PLUGIN_MAX ("), getDeviceCount()) + ')');
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "../Helpers/BusCmd_Handler_I2C.h"
|
||||
|
||||
#if FEATURE_BUS_COMMAND
|
||||
/**
|
||||
* Constructor BusCmd_Handler_I2C
|
||||
*/
|
||||
@@ -487,4 +488,5 @@ uint32_t BusCmd_Handler_I2C::writeStringReg(uint16_t reg,
|
||||
return _wire->endTransmission() == 0;
|
||||
}
|
||||
|
||||
#endif // if FEATURE_BUSCMD_STRING
|
||||
#endif
|
||||
#endif
|
||||
@@ -7,6 +7,8 @@
|
||||
*/
|
||||
|
||||
#include "../../_Plugin_Helper.h"
|
||||
#if FEATURE_BUS_COMMAND
|
||||
|
||||
#include "../Helpers/IBusCmd_Handler.h"
|
||||
#include <Wire.h>
|
||||
|
||||
@@ -89,4 +91,5 @@ private:
|
||||
TwoWire *_wire;
|
||||
bool _ok;
|
||||
};
|
||||
#endif
|
||||
#endif // ifndef _HELPERS_BUSCMD_HANDLER_I2C_H
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "../Helpers/BusCmd_Helper.h"
|
||||
|
||||
#if FEATURE_BUS_COMMAND
|
||||
#include <GPIO_Direct_Access.h>
|
||||
#include "../Globals/RulesCalculate.h"
|
||||
|
||||
@@ -259,11 +259,12 @@ std::vector<BusCmd_Command_struct>BusCmd_Helper_struct::parseBusCmdCommands(cons
|
||||
|
||||
if (!key.isEmpty() && (_commandCache.count(key) == 1) && !update) {
|
||||
commands = _commandCache.find(key)->second;
|
||||
|
||||
#ifndef BUILD_NO_DEBUG
|
||||
if (loglevelActiveFor(LOG_LEVEL_INFO) && _showLog && ((BusCmd_CommandSource_e::PluginRead == _commandSource) ||
|
||||
(BusCmd_CommandSource_e::PluginGetConfigVar == _commandSource))) {
|
||||
addLog(LOG_LEVEL_INFO, strformat(F("BUSCMD: Retrieve '%s' from cache with %d commands."), name.c_str(), commands.size()));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if (!line.isEmpty() && ((commands.empty()) || update) && ((BusCmd_CommandSource_e::PluginRead == _commandSource) ||
|
||||
@@ -506,11 +507,12 @@ std::vector<BusCmd_Command_struct>BusCmd_Helper_struct::parseBusCmdCommands(cons
|
||||
|
||||
if (!key.isEmpty()) {
|
||||
_commandCache[concat(key, keyPostfix)] = commands;
|
||||
|
||||
#ifndef BUILD_NO_DEBUG
|
||||
if (loglevelActiveFor(LOG_LEVEL_INFO) && _showLog) {
|
||||
addLog(LOG_LEVEL_INFO, strformat(F("BUSCMD: Insert '%s%s' into cache with %d commands."),
|
||||
name.c_str(), keyPostfix.c_str(), commands.size()));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -938,11 +940,12 @@ bool BusCmd_Helper_struct::executeBusCmdCommands() {
|
||||
#endif // if FEATURE_BUSCMD_STRING && FEATURE_STRING_VARIABLES
|
||||
|
||||
if (Calculate(newCalc, tmp) == CalculateReturnCode::OK) {
|
||||
#ifndef BUILD_NO_DEBUG
|
||||
if (loglevelActiveFor(LOG_LEVEL_INFO) && _showLog && ((BusCmd_CommandSource_e::PluginRead == _commandSource) ||
|
||||
(BusCmd_CommandSource_e::PluginGetConfigVar == _commandSource))) {
|
||||
addLog(LOG_LEVEL_INFO, strformat(F("BUSCMD: Calculation: %s, result: %s"), toCalc.c_str(), doubleToString(tmp).c_str()));
|
||||
}
|
||||
|
||||
#endif
|
||||
if (BusCmd_Command_e::If == _it->command) {
|
||||
if (essentiallyZero(tmp)) { // 0 = false => cancel execution
|
||||
if (0 == _it->len) {
|
||||
@@ -1131,9 +1134,11 @@ bool BusCmd_Helper_struct::parseAndExecute(BusCmd_CommandSource_e source,
|
||||
_commands = parseBusCmdCommands(EMPTY_STRING, line);
|
||||
|
||||
if (!_commands.empty()) {
|
||||
#ifndef BUILD_NO_DEBUG
|
||||
if (loglevelActiveFor(LOG_LEVEL_INFO) && _showLog) {
|
||||
addLog(LOG_LEVEL_INFO, strformat(logFormat, _commands.size()));
|
||||
}
|
||||
#endif
|
||||
_commandState = BusCmd_CommandState_e::Processing;
|
||||
result = executeBusCmdCommands();
|
||||
_commands.clear();
|
||||
@@ -1307,3 +1312,4 @@ bool BusCmd_Helper_struct::plugin_get_config(struct EventStruct *event,
|
||||
}
|
||||
|
||||
#endif // ifndef LIMIT_BUILD_SIZE
|
||||
#endif
|
||||
@@ -10,7 +10,7 @@
|
||||
*/
|
||||
|
||||
#include "../../_Plugin_Helper.h"
|
||||
|
||||
#if FEATURE_BUS_COMMAND
|
||||
#include "../Helpers/IBusCmd_Handler.h"
|
||||
|
||||
#define BUSCMD_EVENT_SEPARATOR '|'
|
||||
@@ -230,4 +230,5 @@ private:
|
||||
std::vector<BusCmd_Command_struct>::iterator _it;
|
||||
std::vector<BusCmd_Buffer> _buffer;
|
||||
};
|
||||
#endif
|
||||
#endif // ifndef _HELPERS_BUSCMD_HELPER_H
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
* 2025-05-13 tonhuisman: Add String data-format support, guarded with FEATURE_BUSCMD_STRING
|
||||
* 2025-05-10 tonhuisman: Extract interface and I2C implementation from Plugin P180 I2C Generic implementation
|
||||
*/
|
||||
|
||||
#if FEATURE_BUS_COMMAND
|
||||
#include <vector>
|
||||
|
||||
class IBusCmd_Handler { // Interface/Abstract Class
|
||||
@@ -86,4 +86,5 @@ public:
|
||||
bool wideReg = false) = 0;
|
||||
#endif // if FEATURE_BUSCMD_STRING
|
||||
};
|
||||
#endif
|
||||
#endif // ifndef _HELPERS_IBUSCMD_HANDLER_H
|
||||
|
||||
@@ -828,7 +828,9 @@ void handle_devicess_ShowAllTasksTable(uint8_t page)
|
||||
html_TD();
|
||||
|
||||
if (validDeviceIndex(DeviceIndex)) {
|
||||
#if FEATURE_STRING_VARIABLES
|
||||
const DeviceStruct& device = Device[DeviceIndex];
|
||||
#endif
|
||||
String customValuesString;
|
||||
const bool customValues = PluginCall(PLUGIN_WEBFORM_SHOW_VALUES, &TempEvent, customValuesString);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user