Expand drawChar for larger offset
This commit is contained in:
@@ -117,15 +117,16 @@ void OLED::setFramebuffer(uint8_t *buffer) {
|
||||
* UTF font handling is done using the two input chars.
|
||||
* Precursor is the command char that is used to select the table.
|
||||
*/
|
||||
void OLED::drawChar(char c) {
|
||||
if (c == '\x01' && cursor_y == 0) { // 0x01 is used as new line char
|
||||
void OLED::drawChar(const uint16_t charCode) {
|
||||
if (charCode == '\x01' && cursor_y == 0) { // 0x01 is used as new line char
|
||||
cursor_x = 0;
|
||||
cursor_y = 8;
|
||||
return;
|
||||
} else if (c == 0) {
|
||||
} else if (charCode <=0x01) {
|
||||
return;
|
||||
}
|
||||
uint16_t index = static_cast<unsigned char>(c) - 2; // First index is \x02
|
||||
// First index is \x02
|
||||
uint16_t index = charCode-2;
|
||||
uint8_t *charPointer;
|
||||
charPointer = ((uint8_t *)currentFont) + ((fontWidth * (fontHeight / 8)) * index);
|
||||
drawArea(cursor_x, cursor_y, fontWidth, fontHeight, charPointer);
|
||||
|
||||
@@ -83,7 +83,7 @@ public:
|
||||
static void useSecondaryFramebuffer(bool useSecondary);
|
||||
|
||||
private:
|
||||
static void drawChar(char c); // Draw a character to a specific location
|
||||
static void drawChar(const uint16_t charCode); // Draw a character to the current cursor location
|
||||
static void setFramebuffer(uint8_t *buffer);
|
||||
static const uint8_t *currentFont; // Pointer to the current font used for rendering to the buffer
|
||||
static uint8_t * firstStripPtr; // Pointers to the strips to allow for buffer having extra content
|
||||
|
||||
Reference in New Issue
Block a user