Skip to content

Commit 3421590

Browse files
author
Luc
committed
Clean warnings when all warning enabled
Not used variables / functions due to debug log Dual define with different values : cores\esp32/binary.h #define B110 6 #define B1000000 64 tools/sdk/include/newlib/sys/termios.h #define B110 3 #define B1000000 23 Local variable returned in WiFiclient Secure
1 parent bec6f87 commit 3421590

File tree

6 files changed

+33
-19
lines changed

6 files changed

+33
-19
lines changed

cores/esp32/esp32-hal-i2c.c

+14-8
Original file line numberDiff line numberDiff line change
@@ -248,9 +248,10 @@ static void IRAM_ATTR i2cDumpCmdQueue(i2c_t *i2c)
248248

249249
/* Stickbreaker ISR mode debug support
250250
*/
251+
#if (ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_INFO)
251252
static void i2cDumpDqData(i2c_t * i2c)
252253
{
253-
#if (ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_INFO)&&(defined ENABLE_I2C_DEBUG_BUFFER)
254+
#if defined (ENABLE_I2C_DEBUG_BUFFER)
254255
uint16_t a=0;
255256
char buff[140];
256257
I2C_DATA_QUEUE_t *tdq;
@@ -306,9 +307,12 @@ static void i2cDumpDqData(i2c_t * i2c)
306307
}
307308
a++;
308309
}
310+
#else
311+
log_i("Debug Buffer not Enabled");
309312
#endif
310313
}
311-
314+
#endif
315+
#if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_INFO
312316
static void i2cDumpI2c(i2c_t * i2c)
313317
{
314318
log_e("i2c=%p",i2c);
@@ -332,11 +336,12 @@ static void i2cDumpI2c(i2c_t * i2c)
332336
i2cDumpDqData(i2c);
333337
}
334338
}
339+
#endif
335340

341+
#if (ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_INFO)
336342
static void i2cDumpInts(uint8_t num)
337343
{
338-
#if (ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_INFO) && (defined ENABLE_I2C_DEBUG_BUFFER)
339-
344+
#if defined (ENABLE_I2C_DEBUG_BUFFER)
340345
uint32_t b;
341346
log_i("%u row\tcount\tINTR\tTX\tRX\tTick ",num);
342347
for(uint32_t a=1; a<=INTBUFFMAX; a++) {
@@ -349,9 +354,10 @@ static void i2cDumpInts(uint8_t num)
349354
log_i("Debug Buffer not Enabled");
350355
#endif
351356
}
357+
#endif
352358

353-
static void IRAM_ATTR i2cDumpStatus(i2c_t * i2c){
354359
#if (ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_INFO)&&(defined ENABLE_I2C_DEBUG_BUFFER)
360+
static void IRAM_ATTR i2cDumpStatus(i2c_t * i2c){
355361
typedef union {
356362
struct {
357363
uint32_t ack_rec: 1; /*This register stores the value of ACK bit.*/
@@ -377,11 +383,11 @@ static void IRAM_ATTR i2cDumpStatus(i2c_t * i2c){
377383
sr.val= i2c->dev->status_reg.val;
378384

379385
log_i("ack(%d) sl_rw(%d) to(%d) arb(%d) busy(%d) sl(%d) trans(%d) rx(%d) tx(%d) sclMain(%d) scl(%d)",sr.ack_rec,sr.slave_rw,sr.time_out,sr.arb_lost,sr.bus_busy,sr.slave_addressed,sr.byte_trans, sr.rx_fifo_cnt, sr.tx_fifo_cnt,sr.scl_main_state_last, sr.scl_state_last);
380-
#endif
381386
}
387+
#endif
382388

383-
static void i2cDumpFifo(i2c_t * i2c){
384389
#if (ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_INFO)&&(defined ENABLE_I2C_DEBUG_BUFFER)
390+
static void i2cDumpFifo(i2c_t * i2c){
385391
char buf[64];
386392
uint16_t k = 0;
387393
uint16_t i = fifoPos+1;
@@ -422,8 +428,8 @@ if(i != fifoPos){// actual data
422428
}
423429
}while( i!= fifoPos);
424430
}
425-
#endif
426431
}
432+
#endif
427433

428434
static void IRAM_ATTR i2cTriggerDumps(i2c_t * i2c, uint8_t trigger, const char locus[]){
429435
#if (ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_INFO)&&(defined ENABLE_I2C_DEBUG_BUFFER)

libraries/WiFi/src/WiFiClient.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,9 @@ uint8_t WiFiClient::connected()
439439
if (_connected) {
440440
uint8_t dummy;
441441
int res = recv(fd(), &dummy, 0, MSG_DONTWAIT);
442+
if(res < 0) {
443+
log_e("%d", errno);
444+
}
442445
switch (errno) {
443446
case EWOULDBLOCK:
444447
case ENOENT: //caused by vfs

libraries/WiFi/src/WiFiMulti.cpp

+6-4
Original file line numberDiff line numberDiff line change
@@ -118,17 +118,19 @@ uint8_t WiFiMulti::run(uint32_t connectTimeout)
118118
status = WiFi.status();
119119
}
120120

121-
IPAddress ip;
122-
uint8_t * mac;
123121
switch(status) {
124122
case 3:
125-
ip = WiFi.localIP();
126-
mac = WiFi.BSSID();
123+
{
124+
#if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_DEBUG
125+
IPAddress ip = WiFi.localIP();
126+
uint8_t * mac = WiFi.BSSID();
127+
#endif
127128
log_i("[WIFI] Connecting done.");
128129
log_d("[WIFI] SSID: %s", WiFi.SSID().c_str());
129130
log_d("[WIFI] IP: %d.%d.%d.%d", ip[0], ip[1], ip[2], ip[3]);
130131
log_d("[WIFI] MAC: %02X:%02X:%02X:%02X:%02X:%02X", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
131132
log_d("[WIFI] Channel: %d", WiFi.channel());
133+
}
132134
break;
133135
case 1:
134136
log_e("[WIFI] Connecting Failed AP not found.");

libraries/WiFi/src/WiFiSTA.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -683,7 +683,9 @@ void WiFiSTAClass::_smartConfigCallback(uint32_t st, void* result) {
683683
smartconfig_status_t status = (smartconfig_status_t) st;
684684
log_d("Status: %s", sc_status_strings[st % 5]);
685685
if (status == SC_STATUS_GETTING_SSID_PSWD) {
686+
#if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_DEBUG
686687
smartconfig_type_t * type = (smartconfig_type_t *)result;
688+
#endif
687689
log_d("Type: %s", sc_type_strings[*type % 3]);
688690
} else if (status == SC_STATUS_LINK) {
689691
wifi_sta_config_t *sta_conf = reinterpret_cast<wifi_sta_config_t *>(result);
@@ -694,7 +696,9 @@ void WiFiSTAClass::_smartConfigCallback(uint32_t st, void* result) {
694696
_smartConfigDone = true;
695697
} else if (status == SC_STATUS_LINK_OVER) {
696698
if(result){
699+
#if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_DEBUG
697700
ip4_addr_t * ip = (ip4_addr_t *)result;
701+
#endif
698702
log_d("Sender IP: " IPSTR, IP2STR(ip));
699703
}
700704
WiFi.stopSmartConfig();

libraries/WiFiClientSecure/src/WiFiClientSecure.cpp

+5-6
Original file line numberDiff line numberDiff line change
@@ -232,18 +232,17 @@ bool WiFiClientSecure::verify(const char* fp, const char* domain_name)
232232
}
233233

234234
char *WiFiClientSecure::_streamLoad(Stream& stream, size_t size) {
235-
char *dest = (char*)malloc(size);
235+
static char *dest = nullptr;
236+
if(dest)free(dest);
237+
dest = (char*)malloc(size);
236238
if (!dest) {
237239
return nullptr;
238240
}
239241
if (size != stream.readBytes(dest, size)) {
240242
free(dest);
241243
return nullptr;
242244
}
243-
char ret[size+1];
244-
snprintf(ret, size, "%s", dest);
245-
free(dest);
246-
return ret;
245+
return dest;
247246
}
248247

249248
bool WiFiClientSecure::loadCACert(Stream& stream, size_t size) {
@@ -290,4 +289,4 @@ int WiFiClientSecure::lastError(char *buf, const size_t size)
290289
void WiFiClientSecure::setHandshakeTimeout(unsigned long handshake_timeout)
291290
{
292291
sslclient->handshake_timeout = handshake_timeout * 1000;
293-
}
292+
}

tools/sdk/include/vfs/esp_vfs.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
#include <sys/reent.h>
2828
#include <sys/stat.h>
2929
#include <sys/time.h>
30-
#include <sys/termios.h>
30+
//#include <sys/termios.h>
3131
#include <dirent.h>
3232
#include <string.h>
3333
#include "sdkconfig.h"

0 commit comments

Comments
 (0)