mirror of
https://github.com/letscontrolit/ESPEasy.git
synced 2026-07-27 19:57:38 +00:00
[PVS Studio] Test using ESP32 max build + some suggested fixes
This commit is contained in:
@@ -55,6 +55,22 @@ board = esp32dev
|
||||
extra_scripts = ${esp32_common.extra_scripts}
|
||||
pre:tools/pio/pre_custom_esp32.py
|
||||
|
||||
[env:spec_debug_max_ESP32_16M8M]
|
||||
extends = esp32_common, debug_pio
|
||||
lib_ignore = ${esp32_always.lib_ignore}, ESP32_ping
|
||||
lib_deps = ${esp32_common.lib_deps}, VL53L0X
|
||||
board_upload.maximum_size = 4194304
|
||||
build_flags = ${esp32_common.build_flags}
|
||||
${debug_pio.build_flags}
|
||||
-DFEATURE_ARDUINO_OTA
|
||||
-DPLUGIN_BUILD_MAX_ESP32
|
||||
-DPLUGIN_BUILD_IR_EXTENDED
|
||||
; TODO: To enable PS-RAM Support needs more build flags than these 2, for now define ESP32_ENABLE_PSRAM is used to en/disable detecting PS-Ram size on Info page
|
||||
; -DBOARD_HAS_PSRAM // both flags already enabled for Lolin D32 Pro board by PlatformIO
|
||||
; -mfix-esp32-psram-cache-issue
|
||||
board = lolin_d32_pro
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -63,7 +63,7 @@ bool CPlugin_008(CPlugin::Function function, struct EventStruct *event, String&
|
||||
String pubname;
|
||||
{
|
||||
// Place the ControllerSettings in a scope to free the memory as soon as we got all relevant information.
|
||||
MakeControllerSettings(ControllerSettings);
|
||||
MakeControllerSettings(ControllerSettings); //-V522
|
||||
|
||||
if (!AllocatedControllerSettings()) {
|
||||
addLog(LOG_LEVEL_ERROR, F("C008 : Generic HTTP - Cannot send, out of RAM"));
|
||||
|
||||
+1
-1
@@ -69,7 +69,7 @@ bool CPlugin_010(CPlugin::Function function, struct EventStruct *event, String&
|
||||
{
|
||||
String pubname;
|
||||
{
|
||||
MakeControllerSettings(ControllerSettings);
|
||||
MakeControllerSettings(ControllerSettings); //-V522
|
||||
|
||||
if (!AllocatedControllerSettings()) {
|
||||
break;
|
||||
|
||||
+2
-2
@@ -59,7 +59,7 @@ bool CPlugin_011(CPlugin::Function function, struct EventStruct *event, String&
|
||||
case CPlugin::Function::CPLUGIN_INIT:
|
||||
{
|
||||
{
|
||||
MakeControllerSettings(ControllerSettings);
|
||||
MakeControllerSettings(ControllerSettings); //-V522
|
||||
|
||||
if (AllocatedControllerSettings()) {
|
||||
LoadControllerSettings(event->ControllerIndex, ControllerSettings);
|
||||
@@ -114,7 +114,7 @@ bool CPlugin_011(CPlugin::Function function, struct EventStruct *event, String&
|
||||
}
|
||||
{
|
||||
// Place in scope to delete ControllerSettings as soon as it is no longer needed
|
||||
MakeControllerSettings(ControllerSettings);
|
||||
MakeControllerSettings(ControllerSettings); //-V522
|
||||
|
||||
if (!AllocatedControllerSettings()) {
|
||||
addHtmlError(F("Out of memory, cannot load page"));
|
||||
|
||||
+2
-2
@@ -74,7 +74,7 @@ bool CPlugin_016(CPlugin::Function function, struct EventStruct *event, String&
|
||||
case CPlugin::Function::CPLUGIN_INIT:
|
||||
{
|
||||
{
|
||||
MakeControllerSettings(ControllerSettings);
|
||||
MakeControllerSettings(ControllerSettings); //-V522
|
||||
|
||||
if (AllocatedControllerSettings()) {
|
||||
LoadControllerSettings(event->ControllerIndex, ControllerSettings);
|
||||
@@ -124,7 +124,7 @@ bool CPlugin_016(CPlugin::Function function, struct EventStruct *event, String&
|
||||
break;
|
||||
}
|
||||
|
||||
MakeControllerSettings(ControllerSettings);
|
||||
MakeControllerSettings(ControllerSettings); //-V522
|
||||
LoadControllerSettings(event->ControllerIndex, ControllerSettings);
|
||||
success = C016_DelayHandler->addToQueue(std::move(element));
|
||||
Scheduler.scheduleNextDelayQueue(ESPEasy_Scheduler::IntervalTimer_e::TIMER_C016_DELAY_QUEUE,
|
||||
|
||||
+1
-1
@@ -837,7 +837,7 @@ bool C018_init(struct EventStruct *event) {
|
||||
}
|
||||
{
|
||||
// Allocate ControllerSettings object in a scope, so we can destruct it as soon as possible.
|
||||
MakeControllerSettings(ControllerSettings);
|
||||
MakeControllerSettings(ControllerSettings); //-V522
|
||||
|
||||
if (!AllocatedControllerSettings()) {
|
||||
return false;
|
||||
|
||||
+5
-7
@@ -159,6 +159,7 @@ boolean Plugin_003(uint8_t function, struct EventStruct *event, String& string)
|
||||
switch (PCONFIG(P003_IDX_COUNTERTYPE))
|
||||
{
|
||||
case P003_CT_INDEX_COUNTER:
|
||||
case P003_CT_INDEX_COUNTER_TOTAL:
|
||||
{
|
||||
P003_data->pulseHelper.setPulseCounter(UserVar[event->BaseVarIndex + P003_IDX_pulseCounter]);
|
||||
break;
|
||||
@@ -173,16 +174,13 @@ boolean Plugin_003(uint8_t function, struct EventStruct *event, String& string)
|
||||
{
|
||||
break;
|
||||
}
|
||||
case P003_CT_INDEX_COUNTER_TOTAL:
|
||||
{
|
||||
P003_data->pulseHelper.setPulseCounter(UserVar[event->BaseVarIndex + P003_IDX_pulseCounter]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (loglevelActiveFor(LOG_LEVEL_INFO)) {
|
||||
String log; log.reserve(20);
|
||||
log = F("INIT : PulsePin: "); log += Settings.TaskDevicePin1[event->TaskIndex];
|
||||
String log;
|
||||
log.reserve(20);
|
||||
log = F("INIT : PulsePin: ");
|
||||
log += Settings.TaskDevicePin1[event->TaskIndex];
|
||||
addLog(LOG_LEVEL_INFO, log);
|
||||
}
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ bool Blynk_get(const String& command, controllerIndex_t controllerIndex, float *
|
||||
|
||||
{
|
||||
// Place ControllerSettings in its own scope, as it is quite big.
|
||||
MakeControllerSettings(ControllerSettings);
|
||||
MakeControllerSettings(ControllerSettings); //-V522
|
||||
if (!AllocatedControllerSettings()) {
|
||||
addLog(LOG_LEVEL_ERROR, F("Blynk : Cannot run GET, out of RAM"));
|
||||
return false;
|
||||
|
||||
@@ -40,7 +40,7 @@ const __FlashStringHelper * Command_MQTT_Publish(struct EventStruct *event, cons
|
||||
bool mqtt_retainFlag;
|
||||
{
|
||||
// Place the ControllerSettings in a scope to free the memory as soon as we got all relevant information.
|
||||
MakeControllerSettings(ControllerSettings);
|
||||
MakeControllerSettings(ControllerSettings); //-V522
|
||||
if (!AllocatedControllerSettings()) {
|
||||
addLog(LOG_LEVEL_ERROR, F("MQTT : Cannot publish, out of RAM"));
|
||||
return F("MQTT : Cannot publish, out of RAM");
|
||||
@@ -93,7 +93,7 @@ const __FlashStringHelper * Command_MQTT_Subscribe(struct EventStruct *event, co
|
||||
bool mqtt_retainFlag;
|
||||
{
|
||||
// Place the ControllerSettings in a scope to free the memory as soon as we got all relevant information.
|
||||
MakeControllerSettings(ControllerSettings);
|
||||
MakeControllerSettings(ControllerSettings); //-V522
|
||||
if (!AllocatedControllerSettings()) {
|
||||
addLog(LOG_LEVEL_ERROR, F("MQTT : Cannot subscribe, out of RAM"));
|
||||
return F("MQTT : Cannot subscribe, out of RAM");
|
||||
|
||||
@@ -295,7 +295,7 @@ struct ControllerDelayHandlerStruct {
|
||||
if (C##NNN####M##_DelayHandler == nullptr) return; \
|
||||
C##NNN####M##_queue_element *element(C##NNN####M##_DelayHandler->getNext()); \
|
||||
if (element == nullptr) return; \
|
||||
MakeControllerSettings(ControllerSettings); \
|
||||
MakeControllerSettings(ControllerSettings); \
|
||||
bool ready = true; \
|
||||
if (!AllocatedControllerSettings()) { \
|
||||
ready = false; \
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
ControllerDelayHandlerStruct<MQTT_queue_element> *MQTTDelayHandler = nullptr;
|
||||
|
||||
bool init_mqtt_delay_queue(controllerIndex_t ControllerIndex, String& pubname, bool& retainFlag) {
|
||||
MakeControllerSettings(ControllerSettings);
|
||||
MakeControllerSettings(ControllerSettings); //-V522
|
||||
if (!AllocatedControllerSettings()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -326,7 +326,7 @@ class SettingsStruct_tmpl
|
||||
int8_t SPI_SCLK_pin = -1;
|
||||
int8_t SPI_MISO_pin = -1;
|
||||
int8_t SPI_MOSI_pin = -1;
|
||||
int8_t alignmentFiller0; // Should be reused, just added to keep up with alignment
|
||||
int8_t alignmentFiller0 = 0; // Should be reused, just added to keep up with alignment
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
@@ -172,7 +172,7 @@ void MQTTDisconnect()
|
||||
bool MQTTConnect(controllerIndex_t controller_idx)
|
||||
{
|
||||
++mqtt_reconnect_count;
|
||||
MakeControllerSettings(ControllerSettings);
|
||||
MakeControllerSettings(ControllerSettings); //-V522
|
||||
|
||||
if (!AllocatedControllerSettings()) {
|
||||
addLog(LOG_LEVEL_ERROR, F("MQTT : Cannot connect, out of RAM"));
|
||||
@@ -319,7 +319,7 @@ bool MQTTCheck(controllerIndex_t controller_idx)
|
||||
String LWTTopic, LWTMessageConnect;
|
||||
bool willRetain = false;
|
||||
{
|
||||
MakeControllerSettings(ControllerSettings);
|
||||
MakeControllerSettings(ControllerSettings); //-V522
|
||||
|
||||
if (!AllocatedControllerSettings()) {
|
||||
addLog(LOG_LEVEL_ERROR, F("MQTT : Cannot check, out of RAM"));
|
||||
@@ -538,7 +538,7 @@ void MQTTStatus(struct EventStruct *event, const String& status)
|
||||
bool mqtt_retainFlag;
|
||||
{
|
||||
// Place the ControllerSettings in a scope to free the memory as soon as we got all relevant information.
|
||||
MakeControllerSettings(ControllerSettings);
|
||||
MakeControllerSettings(ControllerSettings); //-V522
|
||||
|
||||
if (!AllocatedControllerSettings()) {
|
||||
addLog(LOG_LEVEL_ERROR, F("MQTT : Cannot send status, out of RAM"));
|
||||
|
||||
@@ -234,7 +234,7 @@ void ResetFactory()
|
||||
#if DEFAULT_CONTROLLER
|
||||
{
|
||||
// Place in a scope to have its memory freed ASAP
|
||||
MakeControllerSettings(ControllerSettings);
|
||||
MakeControllerSettings(ControllerSettings); //-V522
|
||||
|
||||
if (AllocatedControllerSettings()) {
|
||||
safe_strncpy(ControllerSettings.Subscribe, F(DEFAULT_SUB), sizeof(ControllerSettings.Subscribe));
|
||||
|
||||
@@ -219,7 +219,7 @@ String BuildFixes()
|
||||
#ifdef USES_MQTT
|
||||
controllerIndex_t controller_idx = firstEnabledMQTT_ControllerIndex();
|
||||
if (validControllerIndex(controller_idx)) {
|
||||
MakeControllerSettings(ControllerSettings);
|
||||
MakeControllerSettings(ControllerSettings); //-V522
|
||||
if (AllocatedControllerSettings()) {
|
||||
LoadControllerSettings(controller_idx, ControllerSettings);
|
||||
|
||||
|
||||
@@ -505,7 +505,7 @@ void P104_data_struct::configureZones() {
|
||||
void P104_data_struct::displayOneZoneText(uint8_t zone,
|
||||
const P104_zone_struct& zstruct,
|
||||
const String & text) {
|
||||
if ((nullptr == P) || (zone < 0) || (zone > P104_MAX_ZONES)) { return; } // double check
|
||||
if ((nullptr == P) || (zone < 0) || (zone >= P104_MAX_ZONES)) { return; } // double check
|
||||
sZoneInitial[zone].reserve(text.length());
|
||||
sZoneInitial[zone] = text; // Keep the original string for future use
|
||||
sZoneBuffers[zone].reserve(text.length());
|
||||
|
||||
@@ -50,7 +50,7 @@ void handle_controllers() {
|
||||
bool mustCallCpluginSave = false;
|
||||
{
|
||||
// Place in a scope to free ControllerSettings memory ASAP
|
||||
MakeControllerSettings(ControllerSettings);
|
||||
MakeControllerSettings(ControllerSettings); //-V522
|
||||
if (!AllocatedControllerSettings()) {
|
||||
addHtmlError(F("Not enough free memory to save settings"));
|
||||
} else {
|
||||
@@ -198,7 +198,7 @@ void handle_controllers_ShowAllControllersTable()
|
||||
html_table_header(F("Host"));
|
||||
html_table_header(F("Port"));
|
||||
|
||||
MakeControllerSettings(ControllerSettings);
|
||||
MakeControllerSettings(ControllerSettings); //-V522
|
||||
if (AllocatedControllerSettings()) {
|
||||
for (controllerIndex_t x = 0; x < CONTROLLER_MAX; x++)
|
||||
{
|
||||
@@ -296,7 +296,7 @@ void handle_controllers_ControllerSettingsPage(controllerIndex_t controllerindex
|
||||
if (Settings.Protocol[controllerindex])
|
||||
{
|
||||
{
|
||||
MakeControllerSettings(ControllerSettings);
|
||||
MakeControllerSettings(ControllerSettings); //-V522
|
||||
if (!AllocatedControllerSettings()) {
|
||||
addHtmlError(F("Out of memory, cannot load page"));
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user