Fix several warnings in code and libs

This commit is contained in:
Luc 2020-11-30 13:46:50 +01:00
parent 217b5062b4
commit fa863105fe
12 changed files with 176 additions and 154 deletions

View File

@ -1817,7 +1817,7 @@ bool COMMAND::execute_command (int cmd, String cmd_params, tpipe output, level_a
String cmd_part1 = currentline.substring (ESPpos + 4, ESPpos2);
String cmd_part2 = "";
//is there space for parameters?
if (ESPpos2 < currentline.length() ) {
if ((uint)ESPpos2 < currentline.length() ) {
cmd_part2 = currentline.substring (ESPpos2 + 1);
}
//if command is a valid number then execute command
@ -2067,7 +2067,7 @@ bool COMMAND::check_command (String buffer, tpipe output, bool handlelockserial,
String cmd_part1 = buffer.substring (ESPpos + 4, ESPpos2);
String cmd_part2 = "";
//is there space for parameters?
if (ESPpos2 < buffer.length() ) {
if ((uint)ESPpos2 < buffer.length() ) {
cmd_part2 = buffer.substring (ESPpos2 + 1);
}
//if command is a valid number then execute command
@ -2086,7 +2086,7 @@ bool COMMAND::check_command (String buffer, tpipe output, bool handlelockserial,
//read a buffer in an array
void COMMAND::read_buffer_serial (uint8_t *b, size_t len)
{
for (long i = 0; i < len; i++) {
for (size_t i = 0; i < len; i++) {
read_buffer_serial (b[i]);
//*b++;
}

View File

@ -344,7 +344,7 @@ bool CONFIG::isHostnameValid (const char * hostname)
return false;
}
//only letter and digit
for (int i = 0; i < strlen (hostname); i++) {
for (uint i = 0; i < strlen (hostname); i++) {
c = hostname[i];
if (! (isdigit (c) || isalpha (c) || c == '_') ) {
return false;
@ -364,7 +364,7 @@ bool CONFIG::isSSIDValid (const char * ssid)
return false;
}
//only printable
for (int i = 0; i < strlen (ssid); i++) {
for (uint i = 0; i < strlen (ssid); i++) {
if (!isPrintable (ssid[i]) ) {
return false;
}
@ -384,7 +384,7 @@ bool CONFIG::isPasswordValid (const char * password)
}
#endif
//no space allowed
for (int i = 0; i < strlen (password); i++)
for (uint i = 0; i < strlen (password); i++)
if (password[i] == ' ') {
return false;
}
@ -399,7 +399,7 @@ bool CONFIG::isLocalPasswordValid (const char * password)
return false;
}
//no space allowed
for (int i = 0; i < strlen (password); i++) {
for (uint i = 0; i < strlen (password); i++) {
c = password[i];
if (c == ' ') {
return false;
@ -424,7 +424,7 @@ bool CONFIG::isIPValid (const char * IP)
return false;
}
//only letter and digit
for (int i = 0; i < strlen (IP); i++) {
for (uint i = 0; i < strlen (IP); i++) {
c = IP[i];
if (isdigit (c) ) {
//only 3 digit at once

View File

@ -167,7 +167,10 @@ bool NotificationsService::sendPushoverMSG(const char * title, const char * mess
String data;
String postcmd;
bool res;
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
TSecureClient Notificationclient;
#pragma GCC diagnostic pop
#if defined(ARDUINO_ARCH_ESP8266) && !defined(USING_AXTLS)
Notificationclient.setInsecure();
#endif //ARDUINO_ARCH_ESP8266 && !USING_AXTLS
@ -200,7 +203,10 @@ bool NotificationsService::sendPushoverMSG(const char * title, const char * mess
}
bool NotificationsService::sendEmailMSG(const char * title, const char * message)
{
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
TSecureClient Notificationclient;
#pragma GCC diagnostic pop
#if defined(ARDUINO_ARCH_ESP8266) && !defined(USING_AXTLS)
Notificationclient.setInsecure();
#endif //ARDUINO_ARCH_ESP8266 && !USING_AXTLS
@ -293,7 +299,10 @@ bool NotificationsService::sendLineMSG(const char * title, const char * message)
String data;
String postcmd;
bool res;
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
TSecureClient Notificationclient;
#pragma GCC diagnostic pop
#if defined(ARDUINO_ARCH_ESP8266) && !defined(USING_AXTLS)
Notificationclient.setInsecure();
#endif //ARDUINO_ARCH_ESP8266 && !USING_AXTLS

View File

@ -122,7 +122,7 @@ void webSocketEvent(uint8_t num, WStype_t type, uint8_t * payload, size_t length
//USE_SERIAL.printf("[%u] Disconnected!\n", num);
break;
case WStype_CONNECTED: {
IPAddress ip = socket_server->remoteIP(num);
//IPAddress ip = socket_server->remoteIP(num);
//USE_SERIAL.printf("[%u] Connected from %d.%d.%d.%d url: %s\n", num, ip[0], ip[1], ip[2], ip[3], payload);
String s = "CURRENT_ID:" + String(num);
// send message to client
@ -961,7 +961,7 @@ void handle_web_command()
return;
}
//is there space for parameters?
if (ESPpos2<cmd.length()) {
if ((uint)ESPpos2<cmd.length()) {
cmd_part2=cmd.substring(ESPpos2+1);
}
//if command is a valid number then execute command
@ -1145,7 +1145,7 @@ void handle_web_command_silent()
String cmd_part1=cmd.substring(ESPpos+4,ESPpos2);
String cmd_part2="";
//is there space for parameters?
if (ESPpos2<cmd.length()) {
if ((uint)ESPpos2<cmd.length()) {
cmd_part2=cmd.substring(ESPpos2+1);
}
//if command is a valid number then execute command
@ -1296,7 +1296,7 @@ void SDFile_serial_upload()
//**************
//upload is on going with data coming by 2K blocks
} else if(upload.status == UPLOAD_FILE_WRITE) { //if com error no need to send more data to serial
for (int pos = 0;( pos < upload.currentSize) && (web_interface->_upload_status == UPLOAD_STATUS_ONGOING); pos++) { //parse full post data
for (uint pos = 0;( pos < upload.currentSize) && (web_interface->_upload_status == UPLOAD_STATUS_ONGOING); pos++) { //parse full post data
//feed watchdog
CONFIG::wait(0);
//it is a comment

View File

@ -221,7 +221,7 @@ bool sendLine2Serial (String & line, int32_t linenb, int32_t * newlinenb)
return sendLine2Serial (line, line_number, newlinenb);
} else {
//the line requested is not the current one so we stop
if (line_number !=linenb) {
if (line_number !=(uint32_t)linenb) {
log_esp3d ("Wrong line requested");
count = 5;
}

View File

@ -239,7 +239,10 @@ bool WIFI_CONFIG::Setup (bool force_ap)
byte bflag = 0;
byte bmode = 0;
#ifdef ARDUINO_ARCH_ESP8266
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
WiFi.onEvent(onWiFiEvent, WIFI_EVENT_ANY);
#pragma GCC diagnostic pop
#else
WiFi.onEvent(onWiFiEvent);
#endif

View File

@ -444,7 +444,7 @@ void WebSockets::handleWebsocketPayloadCb(WSclient_t * client, bool ok, uint8_t
if(header->payloadLen >= 2) {
reasonCode = payload[0] << 8 | payload[1];
}
(void)reasonCode;
DEBUG_WEBSOCKETS("[WS][%d][handleWebsocket] get ask for close. Code: %d", client->num, reasonCode);
if(header->payloadLen > 2) {
DEBUG_WEBSOCKETS(" (%s)\n", (payload + 2));

View File

@ -698,7 +698,8 @@ void WebSocketsClient::connectedCb() {
#if (WEBSOCKETS_NETWORK_TYPE == NETWORK_ESP8266)
_client.tcp->setNoDelay(true);
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
if(_client.isSSL && _fingerprint.length()) {
if(!_client.ssl->verify(_fingerprint.c_str(), _host.c_str())) {
DEBUG_WEBSOCKETS("[WS-Client] certificate mismatch\n");
@ -706,6 +707,7 @@ void WebSocketsClient::connectedCb() {
return;
}
}
#pragma GCC diagnostic pop
#endif
// send Header to Server

View File

@ -469,6 +469,7 @@ bool WebSocketsServer::newClient(WEBSOCKETS_NETWORK_CLASS * TCPclient) {
client->status = WSC_HEADER;
#if (WEBSOCKETS_NETWORK_TYPE == NETWORK_ESP8266) || (WEBSOCKETS_NETWORK_TYPE == NETWORK_ESP8266_ASYNC) || (WEBSOCKETS_NETWORK_TYPE == NETWORK_ESP32)
IPAddress ip = client->tcp->remoteIP();
(void)ip;
DEBUG_WEBSOCKETS("[WS-Server][%d] new client from %d.%d.%d.%d\n", client->num, ip[0], ip[1], ip[2], ip[3]);
#else
DEBUG_WEBSOCKETS("[WS-Server][%d] new client\n", client->num);
@ -645,6 +646,7 @@ void WebSocketsServer::handleNewClients(void) {
// no free space to handle client
#if (WEBSOCKETS_NETWORK_TYPE == NETWORK_ESP8266) || (WEBSOCKETS_NETWORK_TYPE == NETWORK_ESP32)
IPAddress ip = tcpClient->remoteIP();
(void)ip;
DEBUG_WEBSOCKETS("[WS-Server] no free space new client from %d.%d.%d.%d\n", ip[0], ip[1], ip[2], ip[3]);
#else
DEBUG_WEBSOCKETS("[WS-Server] no free space new client\n");

View File

@ -353,7 +353,7 @@ void OLEDDisplay::drawFastImage(int16_t xMove, int16_t yMove, int16_t width, int
void OLEDDisplay::drawXbm(int16_t xMove, int16_t yMove, int16_t width, int16_t height, const char *xbm) {
int16_t widthInXbm = (width + 7) / 8;
uint8_t data;
uint8_t data = 0;
for(int16_t y = 0; y < height; y++) {
for(int16_t x = 0; x < width; x++ ) {
@ -388,6 +388,8 @@ void OLEDDisplay::drawStringInternal(int16_t xMove, int16_t yMove, char* text, u
case TEXT_ALIGN_RIGHT:
xMove -= textWidth;
break;
default:
break;
}
// Don't draw anything if it is not on the screen.
@ -719,7 +721,7 @@ void inline OLEDDisplay::drawInternal(int16_t xMove, int16_t yMove, int16_t widt
int16_t xPos = xMove + (i / rasterHeight);
int16_t yPos = ((yMove >> 3) + (i % rasterHeight)) * DISPLAY_WIDTH;
int16_t yScreenPos = yMove + yOffset;
//int16_t yScreenPos = yMove + yOffset;
int16_t dataPos = xPos + yPos;
if (dataPos >= 0 && dataPos < DISPLAY_BUFFER_SIZE &&

View File

@ -250,7 +250,7 @@ class OLEDDisplay : public Print {
virtual void sendCommand(uint8_t com) {};
// Connect to the display
virtual bool connect() {};
virtual bool connect() {return false;};
// Send all the init commands
void sendInitCommands();

View File

@ -251,7 +251,10 @@ void OLEDDisplayUi::drawFrame(){
switch (this->state.frameState){
case IN_TRANSITION: {
float progress = (float) this->state.ticksSinceLastStateSwitch / (float) this->ticksPerTransition;
int16_t x, y, x1, y1;
int16_t x = 0;
int16_t y = 0;
int16_t x1 = 0;
int16_t y1 = 0;
switch(this->frameAnimationDirection){
case SLIDE_LEFT:
x = -128 * progress;
@ -331,7 +334,7 @@ void OLEDDisplayUi::drawIndicator() {
return;
}
uint8_t posOfHighlightFrame;
uint8_t posOfHighlightFrame = 0;
float indicatorFadeProgress = 0;
// if the indicator needs to be slided in we want to
@ -362,7 +365,8 @@ void OLEDDisplayUi::drawIndicator() {
uint16_t frameStartPos = (12 * frameCount / 2);
const char *image;
uint16_t x,y;
uint16_t x = 0;
uint16_t y = 0;
for (byte i = 0; i < this->frameCount; i++) {
switch (this->indicatorPosition){