mirror of
https://git.mirrors.martin98.com/https://github.com/luc-github/ESP3D.git
synced 2025-08-12 11:48:59 +08:00
Fix several warnings in code and libs
This commit is contained in:
parent
217b5062b4
commit
fa863105fe
@ -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_part1 = currentline.substring (ESPpos + 4, ESPpos2);
|
||||||
String cmd_part2 = "";
|
String cmd_part2 = "";
|
||||||
//is there space for parameters?
|
//is there space for parameters?
|
||||||
if (ESPpos2 < currentline.length() ) {
|
if ((uint)ESPpos2 < currentline.length() ) {
|
||||||
cmd_part2 = currentline.substring (ESPpos2 + 1);
|
cmd_part2 = currentline.substring (ESPpos2 + 1);
|
||||||
}
|
}
|
||||||
//if command is a valid number then execute command
|
//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_part1 = buffer.substring (ESPpos + 4, ESPpos2);
|
||||||
String cmd_part2 = "";
|
String cmd_part2 = "";
|
||||||
//is there space for parameters?
|
//is there space for parameters?
|
||||||
if (ESPpos2 < buffer.length() ) {
|
if ((uint)ESPpos2 < buffer.length() ) {
|
||||||
cmd_part2 = buffer.substring (ESPpos2 + 1);
|
cmd_part2 = buffer.substring (ESPpos2 + 1);
|
||||||
}
|
}
|
||||||
//if command is a valid number then execute command
|
//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
|
//read a buffer in an array
|
||||||
void COMMAND::read_buffer_serial (uint8_t *b, size_t len)
|
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]);
|
read_buffer_serial (b[i]);
|
||||||
//*b++;
|
//*b++;
|
||||||
}
|
}
|
||||||
|
@ -344,7 +344,7 @@ bool CONFIG::isHostnameValid (const char * hostname)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
//only letter and digit
|
//only letter and digit
|
||||||
for (int i = 0; i < strlen (hostname); i++) {
|
for (uint i = 0; i < strlen (hostname); i++) {
|
||||||
c = hostname[i];
|
c = hostname[i];
|
||||||
if (! (isdigit (c) || isalpha (c) || c == '_') ) {
|
if (! (isdigit (c) || isalpha (c) || c == '_') ) {
|
||||||
return false;
|
return false;
|
||||||
@ -364,7 +364,7 @@ bool CONFIG::isSSIDValid (const char * ssid)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
//only printable
|
//only printable
|
||||||
for (int i = 0; i < strlen (ssid); i++) {
|
for (uint i = 0; i < strlen (ssid); i++) {
|
||||||
if (!isPrintable (ssid[i]) ) {
|
if (!isPrintable (ssid[i]) ) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -384,7 +384,7 @@ bool CONFIG::isPasswordValid (const char * password)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
//no space allowed
|
//no space allowed
|
||||||
for (int i = 0; i < strlen (password); i++)
|
for (uint i = 0; i < strlen (password); i++)
|
||||||
if (password[i] == ' ') {
|
if (password[i] == ' ') {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -399,7 +399,7 @@ bool CONFIG::isLocalPasswordValid (const char * password)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
//no space allowed
|
//no space allowed
|
||||||
for (int i = 0; i < strlen (password); i++) {
|
for (uint i = 0; i < strlen (password); i++) {
|
||||||
c = password[i];
|
c = password[i];
|
||||||
if (c == ' ') {
|
if (c == ' ') {
|
||||||
return false;
|
return false;
|
||||||
@ -424,7 +424,7 @@ bool CONFIG::isIPValid (const char * IP)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
//only letter and digit
|
//only letter and digit
|
||||||
for (int i = 0; i < strlen (IP); i++) {
|
for (uint i = 0; i < strlen (IP); i++) {
|
||||||
c = IP[i];
|
c = IP[i];
|
||||||
if (isdigit (c) ) {
|
if (isdigit (c) ) {
|
||||||
//only 3 digit at once
|
//only 3 digit at once
|
||||||
|
@ -167,7 +167,10 @@ bool NotificationsService::sendPushoverMSG(const char * title, const char * mess
|
|||||||
String data;
|
String data;
|
||||||
String postcmd;
|
String postcmd;
|
||||||
bool res;
|
bool res;
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||||
TSecureClient Notificationclient;
|
TSecureClient Notificationclient;
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
#if defined(ARDUINO_ARCH_ESP8266) && !defined(USING_AXTLS)
|
#if defined(ARDUINO_ARCH_ESP8266) && !defined(USING_AXTLS)
|
||||||
Notificationclient.setInsecure();
|
Notificationclient.setInsecure();
|
||||||
#endif //ARDUINO_ARCH_ESP8266 && !USING_AXTLS
|
#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)
|
bool NotificationsService::sendEmailMSG(const char * title, const char * message)
|
||||||
{
|
{
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||||
TSecureClient Notificationclient;
|
TSecureClient Notificationclient;
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
#if defined(ARDUINO_ARCH_ESP8266) && !defined(USING_AXTLS)
|
#if defined(ARDUINO_ARCH_ESP8266) && !defined(USING_AXTLS)
|
||||||
Notificationclient.setInsecure();
|
Notificationclient.setInsecure();
|
||||||
#endif //ARDUINO_ARCH_ESP8266 && !USING_AXTLS
|
#endif //ARDUINO_ARCH_ESP8266 && !USING_AXTLS
|
||||||
@ -293,7 +299,10 @@ bool NotificationsService::sendLineMSG(const char * title, const char * message)
|
|||||||
String data;
|
String data;
|
||||||
String postcmd;
|
String postcmd;
|
||||||
bool res;
|
bool res;
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||||
TSecureClient Notificationclient;
|
TSecureClient Notificationclient;
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
#if defined(ARDUINO_ARCH_ESP8266) && !defined(USING_AXTLS)
|
#if defined(ARDUINO_ARCH_ESP8266) && !defined(USING_AXTLS)
|
||||||
Notificationclient.setInsecure();
|
Notificationclient.setInsecure();
|
||||||
#endif //ARDUINO_ARCH_ESP8266 && !USING_AXTLS
|
#endif //ARDUINO_ARCH_ESP8266 && !USING_AXTLS
|
||||||
|
@ -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);
|
//USE_SERIAL.printf("[%u] Disconnected!\n", num);
|
||||||
break;
|
break;
|
||||||
case WStype_CONNECTED: {
|
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);
|
//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);
|
String s = "CURRENT_ID:" + String(num);
|
||||||
// send message to client
|
// send message to client
|
||||||
@ -961,7 +961,7 @@ void handle_web_command()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//is there space for parameters?
|
//is there space for parameters?
|
||||||
if (ESPpos2<cmd.length()) {
|
if ((uint)ESPpos2<cmd.length()) {
|
||||||
cmd_part2=cmd.substring(ESPpos2+1);
|
cmd_part2=cmd.substring(ESPpos2+1);
|
||||||
}
|
}
|
||||||
//if command is a valid number then execute command
|
//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_part1=cmd.substring(ESPpos+4,ESPpos2);
|
||||||
String cmd_part2="";
|
String cmd_part2="";
|
||||||
//is there space for parameters?
|
//is there space for parameters?
|
||||||
if (ESPpos2<cmd.length()) {
|
if ((uint)ESPpos2<cmd.length()) {
|
||||||
cmd_part2=cmd.substring(ESPpos2+1);
|
cmd_part2=cmd.substring(ESPpos2+1);
|
||||||
}
|
}
|
||||||
//if command is a valid number then execute command
|
//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
|
//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
|
} 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
|
//feed watchdog
|
||||||
CONFIG::wait(0);
|
CONFIG::wait(0);
|
||||||
//it is a comment
|
//it is a comment
|
||||||
|
@ -221,7 +221,7 @@ bool sendLine2Serial (String & line, int32_t linenb, int32_t * newlinenb)
|
|||||||
return sendLine2Serial (line, line_number, newlinenb);
|
return sendLine2Serial (line, line_number, newlinenb);
|
||||||
} else {
|
} else {
|
||||||
//the line requested is not the current one so we stop
|
//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");
|
log_esp3d ("Wrong line requested");
|
||||||
count = 5;
|
count = 5;
|
||||||
}
|
}
|
||||||
|
@ -239,7 +239,10 @@ bool WIFI_CONFIG::Setup (bool force_ap)
|
|||||||
byte bflag = 0;
|
byte bflag = 0;
|
||||||
byte bmode = 0;
|
byte bmode = 0;
|
||||||
#ifdef ARDUINO_ARCH_ESP8266
|
#ifdef ARDUINO_ARCH_ESP8266
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||||
WiFi.onEvent(onWiFiEvent, WIFI_EVENT_ANY);
|
WiFi.onEvent(onWiFiEvent, WIFI_EVENT_ANY);
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
#else
|
#else
|
||||||
WiFi.onEvent(onWiFiEvent);
|
WiFi.onEvent(onWiFiEvent);
|
||||||
#endif
|
#endif
|
||||||
|
@ -444,7 +444,7 @@ void WebSockets::handleWebsocketPayloadCb(WSclient_t * client, bool ok, uint8_t
|
|||||||
if(header->payloadLen >= 2) {
|
if(header->payloadLen >= 2) {
|
||||||
reasonCode = payload[0] << 8 | payload[1];
|
reasonCode = payload[0] << 8 | payload[1];
|
||||||
}
|
}
|
||||||
|
(void)reasonCode;
|
||||||
DEBUG_WEBSOCKETS("[WS][%d][handleWebsocket] get ask for close. Code: %d", client->num, reasonCode);
|
DEBUG_WEBSOCKETS("[WS][%d][handleWebsocket] get ask for close. Code: %d", client->num, reasonCode);
|
||||||
if(header->payloadLen > 2) {
|
if(header->payloadLen > 2) {
|
||||||
DEBUG_WEBSOCKETS(" (%s)\n", (payload + 2));
|
DEBUG_WEBSOCKETS(" (%s)\n", (payload + 2));
|
||||||
|
@ -698,7 +698,8 @@ void WebSocketsClient::connectedCb() {
|
|||||||
|
|
||||||
#if (WEBSOCKETS_NETWORK_TYPE == NETWORK_ESP8266)
|
#if (WEBSOCKETS_NETWORK_TYPE == NETWORK_ESP8266)
|
||||||
_client.tcp->setNoDelay(true);
|
_client.tcp->setNoDelay(true);
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||||
if(_client.isSSL && _fingerprint.length()) {
|
if(_client.isSSL && _fingerprint.length()) {
|
||||||
if(!_client.ssl->verify(_fingerprint.c_str(), _host.c_str())) {
|
if(!_client.ssl->verify(_fingerprint.c_str(), _host.c_str())) {
|
||||||
DEBUG_WEBSOCKETS("[WS-Client] certificate mismatch\n");
|
DEBUG_WEBSOCKETS("[WS-Client] certificate mismatch\n");
|
||||||
@ -706,6 +707,7 @@ void WebSocketsClient::connectedCb() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// send Header to Server
|
// send Header to Server
|
||||||
|
@ -469,6 +469,7 @@ bool WebSocketsServer::newClient(WEBSOCKETS_NETWORK_CLASS * TCPclient) {
|
|||||||
client->status = WSC_HEADER;
|
client->status = WSC_HEADER;
|
||||||
#if (WEBSOCKETS_NETWORK_TYPE == NETWORK_ESP8266) || (WEBSOCKETS_NETWORK_TYPE == NETWORK_ESP8266_ASYNC) || (WEBSOCKETS_NETWORK_TYPE == NETWORK_ESP32)
|
#if (WEBSOCKETS_NETWORK_TYPE == NETWORK_ESP8266) || (WEBSOCKETS_NETWORK_TYPE == NETWORK_ESP8266_ASYNC) || (WEBSOCKETS_NETWORK_TYPE == NETWORK_ESP32)
|
||||||
IPAddress ip = client->tcp->remoteIP();
|
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]);
|
DEBUG_WEBSOCKETS("[WS-Server][%d] new client from %d.%d.%d.%d\n", client->num, ip[0], ip[1], ip[2], ip[3]);
|
||||||
#else
|
#else
|
||||||
DEBUG_WEBSOCKETS("[WS-Server][%d] new client\n", client->num);
|
DEBUG_WEBSOCKETS("[WS-Server][%d] new client\n", client->num);
|
||||||
@ -645,6 +646,7 @@ void WebSocketsServer::handleNewClients(void) {
|
|||||||
// no free space to handle client
|
// no free space to handle client
|
||||||
#if (WEBSOCKETS_NETWORK_TYPE == NETWORK_ESP8266) || (WEBSOCKETS_NETWORK_TYPE == NETWORK_ESP32)
|
#if (WEBSOCKETS_NETWORK_TYPE == NETWORK_ESP8266) || (WEBSOCKETS_NETWORK_TYPE == NETWORK_ESP32)
|
||||||
IPAddress ip = tcpClient->remoteIP();
|
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]);
|
DEBUG_WEBSOCKETS("[WS-Server] no free space new client from %d.%d.%d.%d\n", ip[0], ip[1], ip[2], ip[3]);
|
||||||
#else
|
#else
|
||||||
DEBUG_WEBSOCKETS("[WS-Server] no free space new client\n");
|
DEBUG_WEBSOCKETS("[WS-Server] no free space new client\n");
|
||||||
|
@ -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) {
|
void OLEDDisplay::drawXbm(int16_t xMove, int16_t yMove, int16_t width, int16_t height, const char *xbm) {
|
||||||
int16_t widthInXbm = (width + 7) / 8;
|
int16_t widthInXbm = (width + 7) / 8;
|
||||||
uint8_t data;
|
uint8_t data = 0;
|
||||||
|
|
||||||
for(int16_t y = 0; y < height; y++) {
|
for(int16_t y = 0; y < height; y++) {
|
||||||
for(int16_t x = 0; x < width; x++ ) {
|
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:
|
case TEXT_ALIGN_RIGHT:
|
||||||
xMove -= textWidth;
|
xMove -= textWidth;
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Don't draw anything if it is not on the screen.
|
// 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 xPos = xMove + (i / rasterHeight);
|
||||||
int16_t yPos = ((yMove >> 3) + (i % rasterHeight)) * DISPLAY_WIDTH;
|
int16_t yPos = ((yMove >> 3) + (i % rasterHeight)) * DISPLAY_WIDTH;
|
||||||
|
|
||||||
int16_t yScreenPos = yMove + yOffset;
|
//int16_t yScreenPos = yMove + yOffset;
|
||||||
int16_t dataPos = xPos + yPos;
|
int16_t dataPos = xPos + yPos;
|
||||||
|
|
||||||
if (dataPos >= 0 && dataPos < DISPLAY_BUFFER_SIZE &&
|
if (dataPos >= 0 && dataPos < DISPLAY_BUFFER_SIZE &&
|
||||||
|
@ -250,7 +250,7 @@ class OLEDDisplay : public Print {
|
|||||||
virtual void sendCommand(uint8_t com) {};
|
virtual void sendCommand(uint8_t com) {};
|
||||||
|
|
||||||
// Connect to the display
|
// Connect to the display
|
||||||
virtual bool connect() {};
|
virtual bool connect() {return false;};
|
||||||
|
|
||||||
// Send all the init commands
|
// Send all the init commands
|
||||||
void sendInitCommands();
|
void sendInitCommands();
|
||||||
|
@ -251,7 +251,10 @@ void OLEDDisplayUi::drawFrame(){
|
|||||||
switch (this->state.frameState){
|
switch (this->state.frameState){
|
||||||
case IN_TRANSITION: {
|
case IN_TRANSITION: {
|
||||||
float progress = (float) this->state.ticksSinceLastStateSwitch / (float) this->ticksPerTransition;
|
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){
|
switch(this->frameAnimationDirection){
|
||||||
case SLIDE_LEFT:
|
case SLIDE_LEFT:
|
||||||
x = -128 * progress;
|
x = -128 * progress;
|
||||||
@ -331,7 +334,7 @@ void OLEDDisplayUi::drawIndicator() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t posOfHighlightFrame;
|
uint8_t posOfHighlightFrame = 0;
|
||||||
float indicatorFadeProgress = 0;
|
float indicatorFadeProgress = 0;
|
||||||
|
|
||||||
// if the indicator needs to be slided in we want to
|
// if the indicator needs to be slided in we want to
|
||||||
@ -362,7 +365,8 @@ void OLEDDisplayUi::drawIndicator() {
|
|||||||
|
|
||||||
uint16_t frameStartPos = (12 * frameCount / 2);
|
uint16_t frameStartPos = (12 * frameCount / 2);
|
||||||
const char *image;
|
const char *image;
|
||||||
uint16_t x,y;
|
uint16_t x = 0;
|
||||||
|
uint16_t y = 0;
|
||||||
for (byte i = 0; i < this->frameCount; i++) {
|
for (byte i = 0; i < this->frameCount; i++) {
|
||||||
|
|
||||||
switch (this->indicatorPosition){
|
switch (this->indicatorPosition){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user