-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Clean warnings when all warning enabled #2112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 4 commits
3421590
10486fe
65ee625
d5ad89a
684e7ba
6a180ee
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -118,17 +118,19 @@ uint8_t WiFiMulti::run(uint32_t connectTimeout) | |
status = WiFi.status(); | ||
} | ||
|
||
IPAddress ip; | ||
uint8_t * mac; | ||
switch(status) { | ||
case 3: | ||
ip = WiFi.localIP(); | ||
mac = WiFi.BSSID(); | ||
{ | ||
#if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_DEBUG | ||
IPAddress ip = WiFi.localIP(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you can not declare new variables inside the case. Add another There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the variable is not necessary at all even, the log_d line can be updated to just:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same for BSSID probably with WiFi.BSSIDstr() There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. that is not a bad idea :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok I will do |
||
uint8_t * mac = WiFi.BSSID(); | ||
#endif | ||
log_i("[WIFI] Connecting done."); | ||
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] MAC: %02X:%02X:%02X:%02X:%02X:%02X", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); | ||
log_d("[WIFI] Channel: %d", WiFi.channel()); | ||
} | ||
break; | ||
case 1: | ||
log_e("[WIFI] Connecting Failed AP not found."); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -683,7 +683,9 @@ void WiFiSTAClass::_smartConfigCallback(uint32_t st, void* result) { | |
smartconfig_status_t status = (smartconfig_status_t) st; | ||
log_d("Status: %s", sc_status_strings[st % 5]); | ||
if (status == SC_STATUS_GETTING_SSID_PSWD) { | ||
#if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_DEBUG | ||
smartconfig_type_t * type = (smartconfig_type_t *)result; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you should also include the call to log_d in the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok |
||
#endif | ||
log_d("Type: %s", sc_type_strings[*type % 3]); | ||
} else if (status == SC_STATUS_LINK) { | ||
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) { | |
_smartConfigDone = true; | ||
} else if (status == SC_STATUS_LINK_OVER) { | ||
if(result){ | ||
#if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_DEBUG | ||
ip4_addr_t * ip = (ip4_addr_t *)result; | ||
#endif | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. move the log_d line inside the if/endif block as well There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok |
||
log_d("Sender IP: " IPSTR, IP2STR(ip)); | ||
} | ||
WiFi.stopSmartConfig(); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -232,18 +232,17 @@ bool WiFiClientSecure::verify(const char* fp, const char* domain_name) | |
} | ||
|
||
char *WiFiClientSecure::_streamLoad(Stream& stream, size_t size) { | ||
char *dest = (char*)malloc(size); | ||
static char *dest = nullptr; | ||
if(dest)free(dest); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. :D Please at least try to put some style. if(dest) {
free(dest);
} There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok |
||
dest = (char*)malloc(size); | ||
if (!dest) { | ||
return nullptr; | ||
} | ||
if (size != stream.readBytes(dest, size)) { | ||
free(dest); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. set dest to null here, or free will be called again on this region and bad things might happen :P There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes correct |
||
return nullptr; | ||
} | ||
char ret[size+1]; | ||
snprintf(ret, size, "%s", dest); | ||
free(dest); | ||
return ret; | ||
return dest; | ||
} | ||
|
||
bool WiFiClientSecure::loadCACert(Stream& stream, size_t size) { | ||
|
@@ -290,4 +289,4 @@ int WiFiClientSecure::lastError(char *buf, const size_t size) | |
void WiFiClientSecure::setHandshakeTimeout(unsigned long handshake_timeout) | ||
{ | ||
sslclient->handshake_timeout = handshake_timeout * 1000; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,7 +27,7 @@ | |
#include <sys/reent.h> | ||
#include <sys/stat.h> | ||
#include <sys/time.h> | ||
#include <sys/termios.h> | ||
//#include <sys/termios.h> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this comes from ESP-IDF and should be fixed on that side instead There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well that was my problem as in esp_arduino it is the solution in current context - but in IDF it may be necessary , I do not use idf and this change could be rejected |
||
#include <dirent.h> | ||
#include <string.h> | ||
#include "sdkconfig.h" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it would be better to not log anything at all here so as not to clutter the console
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Except, if debug level is at "info" I assume you actually want to see information?
The debug buffer in hal-i2c takes up 2570 bytes of ram if enabled.
That is why this message exists. If you set debug_level at or above "info" I expect you have a problem you are trying to solve.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@stickbreaker this function isn't called from what I can tell if the level isn't at least DEBUG.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have tried to follow same as others functions - should I change it ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My bad, I got confused with the add/subtract highlighting. I just though you were questioning the "enable" message. My only excuse is that I hadn't had my coffee before I read your Post 😃
I don't have any problems with your changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One other question on the debug subject: I added a an app level control for debug output with
Wire.setDebugFlags( uint32_t setBits, uint32_t resetBits);
, but I did not document how/when to use it. Is there any standard for such documentation?I used it around calls to a "recalcitrant" i2c devices when I get unexpected responses. I don't know if it would be good to put "debug" conditionals around all levels of this code (i.e. Wire() and hal-i2c).
What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@stickbreaker @atanisoft I followed same as line 354 - it means, I need to remove original 354 as well ? Or I misunderstood ?
thanks for your review
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@luc-github Let me spend some time looking through it. The "debug_buffer" only houses interrupt activity(used inside the ISR). I just scanned through
i2cDumpDqData()
and don't know why I had it conditional on "debug_buffer"?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@stickbreaker thank you - I did not wanted to break anything that is why I have mimic existing code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For some reason github won't let me create an edited version of your version? So, I'm going to create an edited version the current espressif version in my repo? (might work? very confusing to me anyway!)