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

@ -53,11 +53,11 @@ typedef WiFiClientSecure TSecureClient;
#define PUSHOVERTIMEOUT 5000
#define PUSHOVERSERVER "api.pushover.net"
#define PUSHOVERPORT 443
#define PUSHOVERPORT 443
#define LINETIMEOUT 5000
#define LINESERVER "notify-api.line.me"
#define LINEPORT 443
#define LINEPORT 443
#define EMAILTIMEOUT 5000
@ -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));
@ -453,7 +453,7 @@ void WebSockets::handleWebsocketPayloadCb(WSclient_t * client, bool ok, uint8_t
}
clientDisconnect(client, 1000);
}
break;
break;
default:
clientDisconnect(client, 1002);
break;
@ -608,47 +608,47 @@ bool WebSockets::readCb(WSclient_t * client, uint8_t * out, size_t n, WSreadWait
* @return bytes send
*/
size_t WebSockets::write(WSclient_t * client, uint8_t *out, size_t n) {
if(out == NULL) return 0;
if(client == NULL) return 0;
unsigned long t = millis();
size_t len = 0;
size_t total = 0;
DEBUG_WEBSOCKETS("[write] n: %zu t: %lu\n", n, t);
while(n > 0) {
if(client->tcp == NULL) {
DEBUG_WEBSOCKETS("[write] tcp is null!\n");
break;
}
if(out == NULL) return 0;
if(client == NULL) return 0;
unsigned long t = millis();
size_t len = 0;
size_t total = 0;
DEBUG_WEBSOCKETS("[write] n: %zu t: %lu\n", n, t);
while(n > 0) {
if(client->tcp == NULL) {
DEBUG_WEBSOCKETS("[write] tcp is null!\n");
break;
}
if(!client->tcp->connected()) {
DEBUG_WEBSOCKETS("[write] not connected!\n");
break;
}
if(!client->tcp->connected()) {
DEBUG_WEBSOCKETS("[write] not connected!\n");
break;
}
if((millis() - t) > WEBSOCKETS_TCP_TIMEOUT) {
DEBUG_WEBSOCKETS("[write] write TIMEOUT! %lu\n", (millis() - t));
break;
}
if((millis() - t) > WEBSOCKETS_TCP_TIMEOUT) {
DEBUG_WEBSOCKETS("[write] write TIMEOUT! %lu\n", (millis() - t));
break;
}
len = client->tcp->write((const uint8_t*)out, n);
if(len) {
t = millis();
out += len;
n -= len;
total += len;
//DEBUG_WEBSOCKETS("write %d left %d!\n", len, n);
} else {
//DEBUG_WEBSOCKETS("write %d failed left %d!\n", len, n);
}
len = client->tcp->write((const uint8_t*)out, n);
if(len) {
t = millis();
out += len;
n -= len;
total += len;
//DEBUG_WEBSOCKETS("write %d left %d!\n", len, n);
} else {
//DEBUG_WEBSOCKETS("write %d failed left %d!\n", len, n);
}
#if (WEBSOCKETS_NETWORK_TYPE == NETWORK_ESP8266)
delay(0);
delay(0);
#endif
}
return total;
}
return total;
}
size_t WebSockets::write(WSclient_t * client, const char *out) {
if(client == NULL) return 0;
if(out == NULL) return 0;
return write(client, (uint8_t*)out, strlen(out));
if(client == NULL) return 0;
if(out == NULL) return 0;
return write(client, (uint8_t*)out, strlen(out));
}

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

@ -51,7 +51,7 @@ WebSocketsServer::WebSocketsServer(uint16_t port, String origin, String protocol
WebSocketsServer::~WebSocketsServer() {
// disconnect all clients
close();
close();
if (_mandatoryHttpHeaders)
delete[] _mandatoryHttpHeaders;
@ -110,8 +110,8 @@ void WebSocketsServer::begin(void) {
}
void WebSocketsServer::close(void) {
_runnning = false;
disconnect();
_runnning = false;
disconnect();
#if (WEBSOCKETS_NETWORK_TYPE == NETWORK_ESP8266)
_server->close();
@ -128,10 +128,10 @@ void WebSocketsServer::close(void) {
* called in arduino loop
*/
void WebSocketsServer::loop(void) {
if(_runnning) {
handleNewClients();
handleClientData();
}
if(_runnning) {
handleNewClients();
handleClientData();
}
}
#endif
@ -150,21 +150,21 @@ void WebSocketsServer::onEvent(WebSocketServerEvent cbEvent) {
* @param mandatoryHttpHeaderCount size_t ///< the number of items in the mandatoryHttpHeaders array
*/
void WebSocketsServer::onValidateHttpHeader(
WebSocketServerHttpHeaderValFunc validationFunc,
const char* mandatoryHttpHeaders[],
size_t mandatoryHttpHeaderCount)
WebSocketServerHttpHeaderValFunc validationFunc,
const char* mandatoryHttpHeaders[],
size_t mandatoryHttpHeaderCount)
{
_httpHeaderValidationFunc = validationFunc;
_httpHeaderValidationFunc = validationFunc;
if (_mandatoryHttpHeaders)
delete[] _mandatoryHttpHeaders;
if (_mandatoryHttpHeaders)
delete[] _mandatoryHttpHeaders;
_mandatoryHttpHeaderCount = mandatoryHttpHeaderCount;
_mandatoryHttpHeaders = new String[_mandatoryHttpHeaderCount];
_mandatoryHttpHeaderCount = mandatoryHttpHeaderCount;
_mandatoryHttpHeaders = new String[_mandatoryHttpHeaderCount];
for (size_t i = 0; i < _mandatoryHttpHeaderCount; i++) {
_mandatoryHttpHeaders[i] = mandatoryHttpHeaders[i];
}
for (size_t i = 0; i < _mandatoryHttpHeaderCount; i++) {
_mandatoryHttpHeaders[i] = mandatoryHttpHeaders[i];
}
}
/*
@ -410,14 +410,14 @@ void WebSocketsServer::setAuthorization(const char * auth) {
int WebSocketsServer::connectedClients(bool ping) {
WSclient_t * client;
int count = 0;
for(uint8_t i = 0; i < WEBSOCKETS_SERVER_CLIENT_MAX; i++) {
client = &_clients[i];
if(client->status == WSC_CONNECTED) {
if(ping != true || sendPing(i)) {
count++;
}
}
}
for(uint8_t i = 0; i < WEBSOCKETS_SERVER_CLIENT_MAX; i++) {
client = &_clients[i];
if(client->status == WSC_CONNECTED) {
if(ping != true || sendPing(i)) {
count++;
}
}
}
return count;
}
@ -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");
@ -700,11 +702,11 @@ void WebSocketsServer::handleClientData(void) {
* @param headerName String ///< the name of the header being checked
*/
bool WebSocketsServer::hasMandatoryHeader(String headerName) {
for (size_t i = 0; i < _mandatoryHttpHeaderCount; i++) {
if (_mandatoryHttpHeaders[i].equalsIgnoreCase(headerName))
return true;
}
return false;
for (size_t i = 0; i < _mandatoryHttpHeaderCount; i++) {
if (_mandatoryHttpHeaders[i].equalsIgnoreCase(headerName))
return true;
}
return false;
}
@ -715,62 +717,62 @@ bool WebSocketsServer::hasMandatoryHeader(String headerName) {
*/
void WebSocketsServer::handleHeader(WSclient_t * client, String * headerLine) {
static const char * NEW_LINE = "\r\n";
static const char * NEW_LINE = "\r\n";
headerLine->trim(); // remove \r
headerLine->trim(); // remove \r
if(headerLine->length() > 0) {
DEBUG_WEBSOCKETS("[WS-Server][%d][handleHeader] RX: %s\n", client->num, headerLine->c_str());
if(headerLine->length() > 0) {
DEBUG_WEBSOCKETS("[WS-Server][%d][handleHeader] RX: %s\n", client->num, headerLine->c_str());
// websocket requests always start with GET see rfc6455
if(headerLine->startsWith("GET ")) {
// websocket requests always start with GET see rfc6455
if(headerLine->startsWith("GET ")) {
// cut URL out
client->cUrl = headerLine->substring(4, headerLine->indexOf(' ', 4));
// cut URL out
client->cUrl = headerLine->substring(4, headerLine->indexOf(' ', 4));
//reset non-websocket http header validation state for this client
client->cHttpHeadersValid = true;
client->cMandatoryHeadersCount = 0;
//reset non-websocket http header validation state for this client
client->cHttpHeadersValid = true;
client->cMandatoryHeadersCount = 0;
} else if(headerLine->indexOf(':')) {
String headerName = headerLine->substring(0, headerLine->indexOf(':'));
String headerValue = headerLine->substring(headerLine->indexOf(':') + 1);
} else if(headerLine->indexOf(':')) {
String headerName = headerLine->substring(0, headerLine->indexOf(':'));
String headerValue = headerLine->substring(headerLine->indexOf(':') + 1);
// remove space in the beginning (RFC2616)
if(headerValue[0] == ' ') {
headerValue.remove(0, 1);
}
// remove space in the beginning (RFC2616)
if(headerValue[0] == ' ') {
headerValue.remove(0, 1);
}
if(headerName.equalsIgnoreCase(WEBSOCKETS_STRING("Connection"))) {
headerValue.toLowerCase();
if(headerValue.indexOf(WEBSOCKETS_STRING("upgrade")) >= 0) {
client->cIsUpgrade = true;
}
} else if(headerName.equalsIgnoreCase(WEBSOCKETS_STRING("Upgrade"))) {
if(headerValue.equalsIgnoreCase(WEBSOCKETS_STRING("websocket"))) {
client->cIsWebsocket = true;
}
} else if(headerName.equalsIgnoreCase(WEBSOCKETS_STRING("Sec-WebSocket-Version"))) {
client->cVersion = headerValue.toInt();
} else if(headerName.equalsIgnoreCase(WEBSOCKETS_STRING("Sec-WebSocket-Key"))) {
client->cKey = headerValue;
client->cKey.trim(); // see rfc6455
} else if(headerName.equalsIgnoreCase(WEBSOCKETS_STRING("Sec-WebSocket-Protocol"))) {
client->cProtocol = headerValue;
} else if(headerName.equalsIgnoreCase(WEBSOCKETS_STRING("Sec-WebSocket-Extensions"))) {
client->cExtensions = headerValue;
} else if(headerName.equalsIgnoreCase(WEBSOCKETS_STRING("Authorization"))) {
client->base64Authorization = headerValue;
} else {
client->cHttpHeadersValid &= execHttpHeaderValidation(headerName, headerValue);
if(_mandatoryHttpHeaderCount > 0 && hasMandatoryHeader(headerName)) {
client->cMandatoryHeadersCount++;
}
}
if(headerName.equalsIgnoreCase(WEBSOCKETS_STRING("Connection"))) {
headerValue.toLowerCase();
if(headerValue.indexOf(WEBSOCKETS_STRING("upgrade")) >= 0) {
client->cIsUpgrade = true;
}
} else if(headerName.equalsIgnoreCase(WEBSOCKETS_STRING("Upgrade"))) {
if(headerValue.equalsIgnoreCase(WEBSOCKETS_STRING("websocket"))) {
client->cIsWebsocket = true;
}
} else if(headerName.equalsIgnoreCase(WEBSOCKETS_STRING("Sec-WebSocket-Version"))) {
client->cVersion = headerValue.toInt();
} else if(headerName.equalsIgnoreCase(WEBSOCKETS_STRING("Sec-WebSocket-Key"))) {
client->cKey = headerValue;
client->cKey.trim(); // see rfc6455
} else if(headerName.equalsIgnoreCase(WEBSOCKETS_STRING("Sec-WebSocket-Protocol"))) {
client->cProtocol = headerValue;
} else if(headerName.equalsIgnoreCase(WEBSOCKETS_STRING("Sec-WebSocket-Extensions"))) {
client->cExtensions = headerValue;
} else if(headerName.equalsIgnoreCase(WEBSOCKETS_STRING("Authorization"))) {
client->base64Authorization = headerValue;
} else {
client->cHttpHeadersValid &= execHttpHeaderValidation(headerName, headerValue);
if(_mandatoryHttpHeaderCount > 0 && hasMandatoryHeader(headerName)) {
client->cMandatoryHeadersCount++;
}
}
} else {
DEBUG_WEBSOCKETS("[WS-Client][handleHeader] Header error (%s)\n", headerLine->c_str());
}
} else {
DEBUG_WEBSOCKETS("[WS-Client][handleHeader] Header error (%s)\n", headerLine->c_str());
}
(*headerLine) = "";
#if (WEBSOCKETS_NETWORK_TYPE == NETWORK_ESP8266_ASYNC)
@ -792,32 +794,32 @@ void WebSocketsServer::handleHeader(WSclient_t * client, String * headerLine) {
bool ok = (client->cIsUpgrade && client->cIsWebsocket);
if(ok) {
if(client->cUrl.length() == 0) {
ok = false;
}
if(client->cKey.length() == 0) {
if(ok) {
if(client->cUrl.length() == 0) {
ok = false;
}
if(client->cKey.length() == 0) {
ok = false;
}
if(client->cVersion != 13) {
ok = false;
}
if(!client->cHttpHeadersValid) {
ok = false;
ok = false;
}
if (client->cMandatoryHeadersCount != _mandatoryHttpHeaderCount) {
ok = false;
ok = false;
}
}
if(_base64Authorization.length() > 0) {
String auth = WEBSOCKETS_STRING("Basic ");
auth += _base64Authorization;
if(auth != client->base64Authorization) {
DEBUG_WEBSOCKETS("[WS-Server][%d][handleHeader] HTTP Authorization failed!\n", client->num);
handleAuthorizationFailed(client);
return;
}
String auth = WEBSOCKETS_STRING("Basic ");
auth += _base64Authorization;
if(auth != client->base64Authorization) {
DEBUG_WEBSOCKETS("[WS-Server][%d][handleHeader] HTTP Authorization failed!\n", client->num);
handleAuthorizationFailed(client);
return;
}
}
if(ok) {
@ -837,7 +839,7 @@ void WebSocketsServer::handleHeader(WSclient_t * client, String * headerLine) {
"Connection: Upgrade\r\n"
"Sec-WebSocket-Version: 13\r\n"
"Sec-WebSocket-Accept: ");
handshake += sKey + NEW_LINE;
handshake += sKey + NEW_LINE;
if(_origin.length() > 0) {
handshake += WEBSOCKETS_STRING("Access-Control-Allow-Origin: ");
@ -845,8 +847,8 @@ void WebSocketsServer::handleHeader(WSclient_t * client, String * headerLine) {
}
if(client->cProtocol.length() > 0) {
handshake += WEBSOCKETS_STRING("Sec-WebSocket-Protocol: ");
handshake +=_protocol + NEW_LINE;
handshake += WEBSOCKETS_STRING("Sec-WebSocket-Protocol: ");
handshake +=_protocol + NEW_LINE;
}
// header end

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){