Clean warnings when all warning enabled (#2112)

* 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

* change due to deprecated function

* Update with proper variable and label

* Update esp32-hal-i2c.c

* Apply changes requested

* Fix warnings due to #define conflict thanks @atanisoft
This commit is contained in:
Luc 2018-11-29 11:34:55 +01:00 committed by Me No Dev
parent b69b04cb2b
commit ce340faf94
7 changed files with 33 additions and 23 deletions

View File

@ -156,7 +156,7 @@ static uint32_t sketchSize(sketchSize_t response) {
.size = running->size, .size = running->size,
}; };
data.start_addr = running_pos.offset; data.start_addr = running_pos.offset;
esp_image_load(ESP_IMAGE_VERIFY, &running_pos, &data); esp_image_verify(ESP_IMAGE_VERIFY, &running_pos, &data);
if (response) { if (response) {
return running_pos.size - data.image_len; return running_pos.size - data.image_len;
} else { } else {

View File

@ -248,9 +248,10 @@ static void IRAM_ATTR i2cDumpCmdQueue(i2c_t *i2c)
/* Stickbreaker ISR mode debug support /* Stickbreaker ISR mode debug support
*/ */
#if (ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_INFO)
static void i2cDumpDqData(i2c_t * i2c) static void i2cDumpDqData(i2c_t * i2c)
{ {
#if (ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_INFO)&&(defined ENABLE_I2C_DEBUG_BUFFER) #if defined (ENABLE_I2C_DEBUG_BUFFER)
uint16_t a=0; uint16_t a=0;
char buff[140]; char buff[140];
I2C_DATA_QUEUE_t *tdq; I2C_DATA_QUEUE_t *tdq;
@ -306,9 +307,12 @@ static void i2cDumpDqData(i2c_t * i2c)
} }
a++; a++;
} }
#else
log_i("Debug Buffer not Enabled");
#endif #endif
} }
#endif
#if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_INFO
static void i2cDumpI2c(i2c_t * i2c) static void i2cDumpI2c(i2c_t * i2c)
{ {
log_e("i2c=%p",i2c); log_e("i2c=%p",i2c);
@ -332,11 +336,12 @@ static void i2cDumpI2c(i2c_t * i2c)
i2cDumpDqData(i2c); i2cDumpDqData(i2c);
} }
} }
#endif
#if (ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_INFO)
static void i2cDumpInts(uint8_t num) static void i2cDumpInts(uint8_t num)
{ {
#if (ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_INFO) && (defined ENABLE_I2C_DEBUG_BUFFER) #if defined (ENABLE_I2C_DEBUG_BUFFER)
uint32_t b; uint32_t b;
log_i("%u row\tcount\tINTR\tTX\tRX\tTick ",num); log_i("%u row\tcount\tINTR\tTX\tRX\tTick ",num);
for(uint32_t a=1; a<=INTBUFFMAX; a++) { for(uint32_t a=1; a<=INTBUFFMAX; a++) {
@ -349,9 +354,10 @@ static void i2cDumpInts(uint8_t num)
log_i("Debug Buffer not Enabled"); log_i("Debug Buffer not Enabled");
#endif #endif
} }
#endif
static void IRAM_ATTR i2cDumpStatus(i2c_t * i2c){
#if (ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_INFO)&&(defined ENABLE_I2C_DEBUG_BUFFER) #if (ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_INFO)&&(defined ENABLE_I2C_DEBUG_BUFFER)
static void IRAM_ATTR i2cDumpStatus(i2c_t * i2c){
typedef union { typedef union {
struct { struct {
uint32_t ack_rec: 1; /*This register stores the value of ACK bit.*/ 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){
sr.val= i2c->dev->status_reg.val; sr.val= i2c->dev->status_reg.val;
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); 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);
#endif
} }
#endif
static void i2cDumpFifo(i2c_t * i2c){
#if (ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_INFO)&&(defined ENABLE_I2C_DEBUG_BUFFER) #if (ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_INFO)&&(defined ENABLE_I2C_DEBUG_BUFFER)
static void i2cDumpFifo(i2c_t * i2c){
char buf[64]; char buf[64];
uint16_t k = 0; uint16_t k = 0;
uint16_t i = fifoPos+1; uint16_t i = fifoPos+1;
@ -422,8 +428,8 @@ if(i != fifoPos){// actual data
} }
}while( i!= fifoPos); }while( i!= fifoPos);
} }
#endif
} }
#endif
static void IRAM_ATTR i2cTriggerDumps(i2c_t * i2c, uint8_t trigger, const char locus[]){ static void IRAM_ATTR i2cTriggerDumps(i2c_t * i2c, uint8_t trigger, const char locus[]){
#if (ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_INFO)&&(defined ENABLE_I2C_DEBUG_BUFFER) #if (ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_INFO)&&(defined ENABLE_I2C_DEBUG_BUFFER)

View File

@ -16,7 +16,7 @@ extern "C" {
#include "diskio.h" #include "diskio.h"
#include "ffconf.h" #include "ffconf.h"
#include "ff.h" #include "ff.h"
#include "esp_vfs.h" //#include "esp_vfs.h"
#include "esp_vfs_fat.h" #include "esp_vfs_fat.h"
char CRC7(const char* data, int length); char CRC7(const char* data, int length);
unsigned short CRC16(const char* data, int length); unsigned short CRC16(const char* data, int length);

View File

@ -439,6 +439,9 @@ uint8_t WiFiClient::connected()
if (_connected) { if (_connected) {
uint8_t dummy; uint8_t dummy;
int res = recv(fd(), &dummy, 0, MSG_DONTWAIT); int res = recv(fd(), &dummy, 0, MSG_DONTWAIT);
if(res < 0) {
log_e("RES: %d", res);
}
switch (errno) { switch (errno) {
case EWOULDBLOCK: case EWOULDBLOCK:
case ENOENT: //caused by vfs case ENOENT: //caused by vfs

View File

@ -118,16 +118,12 @@ uint8_t WiFiMulti::run(uint32_t connectTimeout)
status = WiFi.status(); status = WiFi.status();
} }
IPAddress ip;
uint8_t * mac;
switch(status) { switch(status) {
case 3: case 3:
ip = WiFi.localIP();
mac = WiFi.BSSID();
log_i("[WIFI] Connecting done."); log_i("[WIFI] Connecting done.");
log_d("[WIFI] SSID: %s", WiFi.SSID().c_str()); log_d("[WIFI] SSID: %s", WiFi.SSID().c_str());
log_d("[WIFI] IP: %d.%d.%d.%d", ip[0], ip[1], ip[2], ip[3]); log_d("[WIFI] IP: %s", WiFi.localIP().toString().c_str());
log_d("[WIFI] MAC: %02X:%02X:%02X:%02X:%02X:%02X", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); log_d("[WIFI] MAC: %s", WiFi.BSSID().toString().c_str());
log_d("[WIFI] Channel: %d", WiFi.channel()); log_d("[WIFI] Channel: %d", WiFi.channel());
break; break;
case 1: case 1:

View File

@ -683,8 +683,10 @@ void WiFiSTAClass::_smartConfigCallback(uint32_t st, void* result) {
smartconfig_status_t status = (smartconfig_status_t) st; smartconfig_status_t status = (smartconfig_status_t) st;
log_d("Status: %s", sc_status_strings[st % 5]); log_d("Status: %s", sc_status_strings[st % 5]);
if (status == SC_STATUS_GETTING_SSID_PSWD) { if (status == SC_STATUS_GETTING_SSID_PSWD) {
#if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_DEBUG
smartconfig_type_t * type = (smartconfig_type_t *)result; smartconfig_type_t * type = (smartconfig_type_t *)result;
log_d("Type: %s", sc_type_strings[*type % 3]); log_d("Type: %s", sc_type_strings[*type % 3]);
#endif
} else if (status == SC_STATUS_LINK) { } else if (status == SC_STATUS_LINK) {
wifi_sta_config_t *sta_conf = reinterpret_cast<wifi_sta_config_t *>(result); wifi_sta_config_t *sta_conf = reinterpret_cast<wifi_sta_config_t *>(result);
log_d("SSID: %s", (char *)(sta_conf->ssid)); log_d("SSID: %s", (char *)(sta_conf->ssid));
@ -694,8 +696,10 @@ void WiFiSTAClass::_smartConfigCallback(uint32_t st, void* result) {
_smartConfigDone = true; _smartConfigDone = true;
} else if (status == SC_STATUS_LINK_OVER) { } else if (status == SC_STATUS_LINK_OVER) {
if(result){ if(result){
#if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_DEBUG
ip4_addr_t * ip = (ip4_addr_t *)result; ip4_addr_t * ip = (ip4_addr_t *)result;
log_d("Sender IP: " IPSTR, IP2STR(ip)); log_d("Sender IP: " IPSTR, IP2STR(ip));
#endif
} }
WiFi.stopSmartConfig(); WiFi.stopSmartConfig();
} }

View File

@ -232,18 +232,19 @@ bool WiFiClientSecure::verify(const char* fp, const char* domain_name)
} }
char *WiFiClientSecure::_streamLoad(Stream& stream, size_t size) { char *WiFiClientSecure::_streamLoad(Stream& stream, size_t size) {
char *dest = (char*)malloc(size); static char *dest = nullptr;
if(dest) {
free(dest);
}
dest = (char*)malloc(size);
if (!dest) { if (!dest) {
return nullptr; return nullptr;
} }
if (size != stream.readBytes(dest, size)) { if (size != stream.readBytes(dest, size)) {
free(dest); free(dest);
return nullptr; dest = nullptr;
} }
char ret[size+1]; return dest;
snprintf(ret, size, "%s", dest);
free(dest);
return ret;
} }
bool WiFiClientSecure::loadCACert(Stream& stream, size_t size) { bool WiFiClientSecure::loadCACert(Stream& stream, size_t size) {