diff --git a/OLEDDisplay.cpp b/OLEDDisplay.cpp index f895dddaee3d33ffe7f5c5b7456871f5bff478ee..8c625438a5181cbc9bdcb45c9a60dc23799aeefc 100644 --- a/OLEDDisplay.cpp +++ b/OLEDDisplay.cpp @@ -347,11 +347,11 @@ void OLEDDisplay::drawProgressBar(uint16_t x, uint16_t y, uint16_t width, uint16 fillCircle(xRadius + maxProgressWidth, yRadius, innerRadius); } -void OLEDDisplay::drawFastImage(int16_t xMove, int16_t yMove, int16_t width, int16_t height, const char *image) { +void OLEDDisplay::drawFastImage(int16_t xMove, int16_t yMove, int16_t width, int16_t height, const uint8_t *image) { drawInternal(xMove, yMove, width, height, image, 0, 0); } -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 uint8_t *xbm) { int16_t widthInXbm = (width + 7) / 8; uint8_t data; @@ -525,7 +525,7 @@ void OLEDDisplay::setTextAlignment(OLEDDISPLAY_TEXT_ALIGNMENT textAlignment) { this->textAlignment = textAlignment; } -void OLEDDisplay::setFont(const char *fontData) { +void OLEDDisplay::setFont(const uint8_t *fontData) { this->fontData = fontData; } @@ -718,7 +718,7 @@ void OLEDDisplay::sendInitCommands(void) { sendCommand(DISPLAYON); } -void inline OLEDDisplay::drawInternal(int16_t xMove, int16_t yMove, int16_t width, int16_t height, const char *data, uint16_t offset, uint16_t bytesInData) { +void inline OLEDDisplay::drawInternal(int16_t xMove, int16_t yMove, int16_t width, int16_t height, const uint8_t *data, uint16_t offset, uint16_t bytesInData) { if (width < 0 || height < 0) return; if (yMove + height < 0 || yMove > displayHeight) return; if (xMove + width < 0 || xMove > displayWidth) return; diff --git a/OLEDDisplay.h b/OLEDDisplay.h index 6e9d0fcef908c2db948fb97ecced0c8e127d7977..34a59cd3c3bac7d08f0fa9c41382de278d9288fb 100644 --- a/OLEDDisplay.h +++ b/OLEDDisplay.h @@ -153,15 +153,15 @@ class OLEDDisplay : public Print { // Draw a lin vertically void drawVerticalLine(int16_t x, int16_t y, int16_t length); - // Draws a rounded progress bar with the outer dimensions given by width and height. Progress is + // Draws a rounded progress bar with the outer dimensions given by width and height. Progress is // a unsigned byte value between 0 and 100 void drawProgressBar(uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint8_t progress); // Draw a bitmap in the internal image format - void drawFastImage(int16_t x, int16_t y, int16_t width, int16_t height, const char *image); + void drawFastImage(int16_t x, int16_t y, int16_t width, int16_t height, const uint8_t *image); // Draw a XBM - void drawXbm(int16_t x, int16_t y, int16_t width, int16_t height, const char *xbm); + void drawXbm(int16_t x, int16_t y, int16_t width, int16_t height, const uint8_t *xbm); /* Text functions */ @@ -187,7 +187,7 @@ class OLEDDisplay : public Print { // Sets the current font. Available default fonts // ArialMT_Plain_10, ArialMT_Plain_16, ArialMT_Plain_24 - void setFont(const char *fontData); + void setFont(const uint8_t *fontData); // Set the function that will convert utf-8 to font table index void setFontTableLookupFunction(FontTableLookupFunction function); @@ -253,7 +253,7 @@ class OLEDDisplay : public Print { OLEDDISPLAY_TEXT_ALIGNMENT textAlignment = TEXT_ALIGN_LEFT; OLEDDISPLAY_COLOR color = WHITE; - const char *fontData = ArialMT_Plain_10; + const uint8_t *fontData = ArialMT_Plain_10; // State values for logBuffer uint16_t logBufferSize = 0; @@ -274,7 +274,7 @@ class OLEDDisplay : public Print { // converts utf8 characters to extended ascii char* utf8ascii(String s); - void inline drawInternal(int16_t xMove, int16_t yMove, int16_t width, int16_t height, const char *data, uint16_t offset, uint16_t bytesInData) __attribute__((always_inline)); + void inline drawInternal(int16_t xMove, int16_t yMove, int16_t width, int16_t height, const uint8_t *data, uint16_t offset, uint16_t bytesInData) __attribute__((always_inline)); void drawStringInternal(int16_t xMove, int16_t yMove, char* text, uint16_t textLength, uint16_t textWidth); diff --git a/OLEDDisplayFonts.h b/OLEDDisplayFonts.h index 6dd21ef60b9919ca2dd24935340f3a5f518735a8..3544edb80d1721237febea01c3f6389ee6e2ad60 100644 --- a/OLEDDisplayFonts.h +++ b/OLEDDisplayFonts.h @@ -1,7 +1,7 @@ #ifndef OLEDDISPLAYFONTS_h #define OLEDDISPLAYFONTS_h -const char ArialMT_Plain_10[] PROGMEM = { +const uint8_t ArialMT_Plain_10[] PROGMEM = { 0x0A, // Width: 10 0x0D, // Height: 13 0x20, // First Char: 32 @@ -425,7 +425,7 @@ const char ArialMT_Plain_10[] PROGMEM = { 0x20,0x00,0xC8,0x09,0x00,0x06,0xC8,0x01,0x20 // 255 }; -const char ArialMT_Plain_16[] PROGMEM = { +const uint8_t ArialMT_Plain_16[] PROGMEM = { 0x10, // Width: 16 0x13, // Height: 19 0x20, // First Char: 32 @@ -848,7 +848,7 @@ const char ArialMT_Plain_16[] PROGMEM = { 0x00,0x00,0x00,0xF8,0xFF,0x03,0x80,0x20,0x00,0x40,0x40,0x00,0x40,0x40,0x00,0x40,0x40,0x00,0x80,0x20,0x00,0x00,0x1F, // 254 0xC0,0x01,0x00,0x00,0x06,0x02,0x10,0x38,0x02,0x00,0xE0,0x01,0x10,0x38,0x00,0x00,0x07,0x00,0xC0 // 255 }; -const char ArialMT_Plain_24[] PROGMEM = { +const uint8_t ArialMT_Plain_24[] PROGMEM = { 0x18, // Width: 24 0x1C, // Height: 28 0x20, // First Char: 32 @@ -1271,4 +1271,4 @@ const char ArialMT_Plain_24[] PROGMEM = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0xFF,0xFF,0x07,0xE0,0xFF,0xFF,0x07,0x00,0x1C,0x18,0x00,0x00,0x06,0x30,0x00,0x00,0x06,0x30,0x00,0x00,0x06,0x30,0x00,0x00,0x0E,0x38,0x00,0x00,0x1C,0x1C,0x00,0x00,0xF8,0x0F,0x00,0x00,0xF0,0x03, // 254 0x00,0x00,0x00,0x00,0x00,0x0E,0x00,0x00,0x00,0x7E,0x00,0x06,0xC0,0xF0,0x01,0x06,0xC0,0x80,0x0F,0x07,0x00,0x00,0xFE,0x03,0x00,0x00,0xFC,0x00,0xC0,0xC0,0x1F,0x00,0xC0,0xF8,0x03,0x00,0x00,0x3E,0x00,0x00,0x00,0x06 // 255 }; -#endif +#endif diff --git a/OLEDDisplayUi.cpp b/OLEDDisplayUi.cpp index 51e026290174882f0293ee342eca9eb8753e6041..a41ae118017b5c97e6805c50fe6d44e4f52aac9a 100644 --- a/OLEDDisplayUi.cpp +++ b/OLEDDisplayUi.cpp @@ -90,10 +90,10 @@ void OLEDDisplayUi::setIndicatorPosition(IndicatorPosition pos) { void OLEDDisplayUi::setIndicatorDirection(IndicatorDirection dir) { this->indicatorDirection = dir; } -void OLEDDisplayUi::setActiveSymbol(const char* symbol) { +void OLEDDisplayUi::setActiveSymbol(const uint8_t* symbol) { this->activeSymbol = symbol; } -void OLEDDisplayUi::setInactiveSymbol(const char* symbol) { +void OLEDDisplayUi::setInactiveSymbol(const uint8_t* symbol) { this->inactiveSymbol = symbol; } @@ -367,7 +367,8 @@ void OLEDDisplayUi::drawIndicator() { } uint16_t frameStartPos = (indicatorSpacing * frameCount / 2); - const char *image; + const uint8_t *image; + uint16_t x,y; for (byte i = 0; i < this->frameCount; i++) { diff --git a/OLEDDisplayUi.h b/OLEDDisplayUi.h index 35a1e99bcf449c3d2f5f4405f223949005fce497..a5f6c90083de0b8281fca8787eff19446ebde65b 100644 --- a/OLEDDisplayUi.h +++ b/OLEDDisplayUi.h @@ -61,11 +61,11 @@ enum FrameState { }; -const char ANIMATION_activeSymbol[] PROGMEM = { +const uint8_t ANIMATION_activeSymbol[] PROGMEM = { 0x00, 0x18, 0x3c, 0x7e, 0x7e, 0x3c, 0x18, 0x00 }; -const char ANIMATION_inactiveSymbol[] PROGMEM = { +const uint8_t ANIMATION_inactiveSymbol[] PROGMEM = { 0x00, 0x0, 0x0, 0x18, 0x18, 0x0, 0x0, 0x00 }; @@ -106,8 +106,8 @@ class OLEDDisplayUi { IndicatorPosition indicatorPosition = BOTTOM; IndicatorDirection indicatorDirection = LEFT_RIGHT; - const char* activeSymbol = ANIMATION_activeSymbol; - const char* inactiveSymbol = ANIMATION_inactiveSymbol; + const uint8_t* activeSymbol = ANIMATION_activeSymbol; + const uint8_t* inactiveSymbol = ANIMATION_inactiveSymbol; bool shouldDrawIndicators = true; @@ -240,12 +240,12 @@ class OLEDDisplayUi { /** * Set the symbol to indicate an active frame in the indicator bar. */ - void setActiveSymbol(const char* symbol); + void setActiveSymbol(const uint8_t* symbol); /** * Set the symbol to indicate an inactive frame in the indicator bar. */ - void setInactiveSymbol(const char* symbol); + void setInactiveSymbol(const uint8_t* symbol); // Frame settings diff --git a/examples/SSD1306ClockDemo/images.h b/examples/SSD1306ClockDemo/images.h index a220a27c2b6637946f5df26f500f0eb88998a2c8..1889188fd489e49ef1a6dd8ce6a7ffaa4f956be0 100644 --- a/examples/SSD1306ClockDemo/images.h +++ b/examples/SSD1306ClockDemo/images.h @@ -1,4 +1,4 @@ -const char activeSymbol[] PROGMEM = { +const unsigned char activeSymbol[] PROGMEM = { B00000000, B00000000, B00011000, @@ -9,7 +9,7 @@ const char activeSymbol[] PROGMEM = { B00011000 }; -const char inactiveSymbol[] PROGMEM = { +const unsigned char inactiveSymbol[] PROGMEM = { B00000000, B00000000, B00000000, diff --git a/examples/SSD1306SimpleDemo/images.h b/examples/SSD1306SimpleDemo/images.h index 9daf8c1a25b9d006fc67f49c6868563d13c7ae77..50417990fd0d3d0854b4385afac1334d45223214 100644 --- a/examples/SSD1306SimpleDemo/images.h +++ b/examples/SSD1306SimpleDemo/images.h @@ -1,6 +1,6 @@ #define WiFi_Logo_width 60 #define WiFi_Logo_height 36 -const char WiFi_Logo_bits[] PROGMEM = { +const uint8_t WiFi_Logo_bits[] PROGMEM = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xFF, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF8, 0xFF, diff --git a/examples/SSD1306UiDemo/images.h b/examples/SSD1306UiDemo/images.h index 8b876a369e6f2609700798da9da47431e5e0db21..2489d1e5de658663f1bf16b456b18743193cf1c0 100644 --- a/examples/SSD1306UiDemo/images.h +++ b/examples/SSD1306UiDemo/images.h @@ -1,6 +1,6 @@ #define WiFi_Logo_width 60 #define WiFi_Logo_height 36 -const char WiFi_Logo_bits[] PROGMEM = { +const uint8_t WiFi_Logo_bits[] PROGMEM = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xFF, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF8, 0xFF, @@ -27,7 +27,7 @@ const char WiFi_Logo_bits[] PROGMEM = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; -const char activeSymbol[] PROGMEM = { +const uint8_t activeSymbol[] PROGMEM = { B00000000, B00000000, B00011000, @@ -38,7 +38,7 @@ const char activeSymbol[] PROGMEM = { B00011000 }; -const char inactiveSymbol[] PROGMEM = { +const uint8_t inactiveSymbol[] PROGMEM = { B00000000, B00000000, B00000000,