Revert font table split for now

This commit is contained in:
Ben V. Brown
2017-10-07 12:19:46 +11:00
parent ee9029703b
commit aec760e4e7
4 changed files with 16 additions and 26 deletions

View File

@@ -54,7 +54,6 @@ private:
bool inLeftHandedMode; // Whether the screen is in left or not (used for offsets in GRAM)
bool displayOnOffState; // If the display is on or not
uint8_t fontWidth, fontHeight;
uint16_t fontTableLength;
int16_t cursor_x, cursor_y;
uint8_t displayOffset;
};

View File

@@ -54,7 +54,6 @@ OLED::OLED(I2C_HandleTypeDef* i2cHandle) {
fontWidth = 12;
displayOffset = 0;
displayOnOffState = true;
fontTableLength = sizeof(FONT_12);
}
@@ -95,37 +94,35 @@ void OLED::drawChar(char c, char PrecursorCommand) {
if (c < ' ')
return;
//We are left with
uint8_t* charPointer = 0;
uint8_t* charPointer;
//Fonts are offset to start at the space char.
/*
* UTF font handling is done using the two input chars
* Precursor is the command char that is used to select the table
*
*/
uint16_t index = 0;
if (PrecursorCommand == 0)
charPointer = ((uint8_t*) currentFont) + ((fontWidth * (fontHeight / 8)) * (c - ' '));
index = (c - ' ');
else {
//This is for extended range
//We decode the precursor command to find the offset
//Latin stats at 96
c -= 0x80;
#ifdef INCLUDE_FONT_LATIN
if (PrecursorCommand == 0xC3)
charPointer = ((uint8_t*) FONT_12_LATIN) + ((fontWidth * (fontHeight / 8)) * (32 + c));
index = (128) + (c);
else if (PrecursorCommand == 0xC2)
charPointer = ((uint8_t*) FONT_12_LATIN) + ((fontWidth * (fontHeight / 8)) * (c));
#endif
#ifdef INCLUDE_FONT_CYRILLIC
if (PrecursorCommand == 0xD0)
charPointer = ((uint8_t*) FONT_12_Cyrillic) + ((fontWidth * (fontHeight / 8)) * (c));
index = (96) + (c);
else if (PrecursorCommand == 0xD0)
index = (192) + (c);
else if (PrecursorCommand == 0xD1)
charPointer = ((uint8_t*) FONT_12_Cyrillic) + ((fontWidth * (fontHeight / 8)) * (64 + c));
#endif
index = (256) + (c);
else
return;
}
charPointer = ((uint8_t*) currentFont) + ((fontWidth * (fontHeight / 8)) * index);
if (charPointer)
if (cursor_x >= 0 && cursor_x < 96)
drawArea(cursor_x, cursor_y, fontWidth, fontHeight, charPointer);
cursor_x += fontWidth;
@@ -182,17 +179,14 @@ void OLED::setFont(uint8_t fontNumber) {
currentFont = ASCII6x8;
fontHeight = 8;
fontWidth = 6;
fontTableLength = sizeof(ASCII6x8);
} else if (fontNumber == 2) {
currentFont = ExtraFontChars;
fontHeight = 16;
fontWidth = 12;
fontTableLength = sizeof(ExtraFontChars);
} else {
currentFont = FONT_12;
fontHeight = 16;
fontWidth = 12;
fontTableLength = sizeof(FONT_12);
}
}

View File

@@ -435,7 +435,7 @@ static int gui_SolderingSleepingMode() {
else
lcd.print("C");
lcd.print(" |");
lcd.print(" ");
lcd.printNumber(getInputVoltageX10(systemSettings.voltageDiv) / 10, 2);
lcd.drawChar('.');
lcd.printNumber(getInputVoltageX10(systemSettings.voltageDiv) % 10, 1);

View File

@@ -114,8 +114,7 @@ const uint8_t FONT_12[]={
0x00,0x00,0x03,0x03,0x03,0x07,0x7E,0xFC,0xC0,0x80,0x00,0x00,0x00,0x00,0x60,0x60,0x60,0x70,0x3F,0x1F,0x01,0x00,0x00,0x00,//}
0x00,0x10,0x18,0x0C,0x04,0x0C,0x18,0x10,0x18,0x0C,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//~
0x00,0x00,0x80,0xC0,0x60,0x30,0x30,0x60,0xC0,0x80,0x00,0x00,0x00,0x0F,0x0F,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0F,0x0F,0x00,//Up triangle
};
const uint8_t FONT_12_LATIN[] = {
/*Start extended Latin range*/
//V96
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//A0 (blank)
@@ -220,8 +219,6 @@ const uint8_t FONT_12_LATIN[] = {
0x00,0x00,0x03,0xFF,0xFF,0x1B,0x18,0x18,0xF8,0xF0,0x00,0x00,0x00,0x00,0x30,0x3F,0x3F,0x36,0x06,0x06,0x07,0x03,0x00,0x00,//FE//254
0x00,0x00,0x60,0xEC,0x8C,0x00,0x00,0x8C,0xEC,0x60,0x00,0x00,0x00,0x00,0x00,0x81,0xE7,0x7E,0x1E,0x07,0x01,0x00,0x00,0x00,//FF//255
//V192
};
const uint8_t FONT_12_Cyrillic[] = {
/* Cyrillic Glyphs */
0x00,0xFC,0xFC,0x8D,0x8F,0x8E,0x8C,0x8C,0x8C,0x0C,0x0C,0x00,0x00,0x3F,0x3F,0x31,0x31,0x31,0x31,0x31,0x31,0x30,0x30,0x00, // Ѐ d0 80
0x00,0xFE,0xFE,0xC7,0xC7,0xC6,0xC6,0xC7,0xC7,0x06,0x06,0x00,0x00,0x3F,0x3F,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x00, // Ё d0 81