UTF8 handling, Cyrillic font, bring over old translations

This commit is contained in:
Ben V. Brown
2017-09-27 21:14:18 +10:00
parent daa04d0c80
commit 43c5ca855c
5 changed files with 381 additions and 52 deletions

View File

@@ -27,7 +27,7 @@ public:
OLED(I2C_HandleTypeDef* i2cHandle); // Initialize Driver and store I2C pointer
void initialize(); // Startup the I2C coms (brings screen out of reset etc)
void refresh(); // Draw the buffer out to the LCD using the DMA Channel
void drawChar(char c); // Draw a character to a specific location
void drawChar(char c, char preCursorCommand = '\0'); // Draw a character to a specific location
void displayOnOff(bool on); // Turn the screen on or not
void setRotation(bool leftHanded); // Set the rotation for the screen
bool getRotation(); // Get the current rotation of the LCD

View File

@@ -8,9 +8,19 @@
#ifndef TRANSLATION_H_
#define TRANSLATION_H_
extern const char* SettingsLongNames[13];
extern const char* SettingsShortNames[13];
extern const char* SettingsCalibrationWarning;
extern const char* UVLOWarningString;
extern const char SettingTrueChar;
extern const char SettingFalseChar;
extern const char SettingSleepChar;
extern const char SettingFastChar;
extern const char SettingMediumChar;
extern const char SettingSlowChar;
extern const char SettingRightChar;
extern const char SettingLeftChar;
extern const char SettingAutoChar;
extern const char SettingTempCChar;
extern const char SettingTempFChar;
#endif /* TRANSLATION_H_ */

View File

@@ -71,7 +71,7 @@ void OLED::initialize() {
screenBuffer[4] = 0x80;
screenBuffer[5] = inLeftHandedMode ? 95 : 0x7F;
screenBuffer[6] = 0x80;//Set pages to rollover after 2
screenBuffer[6] = 0x80; //Set pages to rollover after 2
screenBuffer[7] = 0x22;
screenBuffer[8] = 0x80;
screenBuffer[9] = 0x00;
@@ -91,16 +91,42 @@ void OLED::refresh() {
}
void OLED::drawChar(char c) {
void OLED::drawChar(char c, char PrecursorCommand) {
//prints a char to the screen
if (c == '\n')
cursor_y += fontHeight;
if (c < ' ')
return;
//We are left with
uint8_t* charPointer;
c -= ' ';
//Fonts are offset to start at the space char.
charPointer = ((uint8_t*) currentFont) + ((fontWidth * (fontHeight / 8)) * c);
/*
* 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)
index = (c - ' ');
else {
//This is for extended range
//We decode the precursor command to find the offset
//Latin stats at 96
c -= 0x80;
if (PrecursorCommand == 0xC3)
index = (96 + 32) + (c);
else if (PrecursorCommand == 0xC2)
index = (96) + (c);
else if (PrecursorCommand == 0xD0)
index = (208) + (c);
else if (PrecursorCommand == 0xD1)
index = (272) + (c);
else
return;
index -=0x10;//offset removal
}
charPointer = ((uint8_t*) currentFont) + ((fontWidth * (fontHeight / 8)) * index);
if (cursor_x >= 0)
drawArea(cursor_x, cursor_y, fontWidth, fontHeight, charPointer);
cursor_x += fontWidth;
@@ -137,7 +163,11 @@ void OLED::setRotation(bool leftHanded) {
//print a string to the current cursor location
void OLED::print(const char* str) {
while (str[0]) {
drawChar(str[0]);
if (str[0] >= 0x80) {
drawChar(str[1], str[0]);
str++; //skip this marker
} else
drawChar(str[0]);
str++;
}
}

View File

@@ -4,47 +4,229 @@
* Created on: 31Aug.,2017
* Author: Ben V. Brown
*/
#ifndef LANG_EN
#include "Translation.h"
#ifndef LANG
#define LANG_EN
#define LANG
#endif
#ifndef LANG
#error NO LANGUAGE DEFINED
#endif
#ifdef LANG_EN
const char* SettingsLongNames[13] =
{
/*These are all the help text for all the settings.*/
/*No requirements on spacing or length*/
"Power source. Sets cutoff voltage. <DC 10V> <S 3.3V per cell>",
"Sleep Temperature <C>",
"Sleep Timeout <Minutes>",
"Shutdown Timeout <Minutes>",
"Motion Sensitivity <0.Off 1.least sensitive 9.most sensitive>",
"Display detailed information in a smaller font.",
"Display Orientation <A. Automatic L. Left Handed R. Right Handed>",
"Enable front key enters boost mode 450C mode when soldering",
"Temperature when in \"boost\" mode",
"Automatically starts the iron into soldering on power up. T=Soldering, S= Sleep mode,F=Off",
"Blink the temperature on the cooling screen while the tip is still hot.",
"Calibrate tip offset.",
"Reset all settings",
};
const char* SettingsLongNames[13] = {
/*These are all the help text for all the settings.*/
/*No requirements on spacing or length*/
"Power source. Sets cutoff voltage. <DC 10V> <S 3.3V per cell>", //
"Sleep Temperature <C>", //
"Sleep Timeout <Minutes>", //
"Shutdown Timeout <Minutes>", //
"Motion Sensitivity <0.Off 1.least sensitive 9.most sensitive>", //
"Display detailed information in a smaller font.", //
"Display Orientation <A. Automatic L. Left Handed R. Right Handed>", //
"Enable front key enters boost mode 450C mode when soldering", //
"Temperature when in \"boost\" mode", //
"Automatically starts the iron into soldering on power up. T=Soldering, S= Sleep mode,F=Off", //
"Blink the temperature on the cooling screen while the tip is still hot.", //
"Calibrate tip offset.", //s
"Reset all settings", };
const char* SettingsShortNames[13] = {
"PWRSC ",
"STMP ",
"STME ",
"SHTME ",
"MSENSE ",
"ADVDSP ",
"DSPROT ",
"BOOST ",
"BTMP ",
"ASTART ",
"CLBLNK ",
"TMP CAL?",
"RESET? "
};
const char* SettingsCalibrationWarning = "Please ensure the tip is at room temperature before continuing!";
const char* UVLOWarningString = "LOW VOLT"; //Fixed width 8 chars
const char SettingTrueChar = 'V';
const char SettingFalseChar = 'F';
const char SettingSleepChar = 'S';
const char SettingFastChar = 'R';
const char SettingMediumChar = 'M';
const char SettingSlowChar = 'L';
const char SettingRightChar = 'D';
const char SettingLeftChar = 'I';
const char SettingAutoChar = 'A';
const char SettingTempCChar = 'C';
const char SettingTempFChar = 'F';
#endif
#ifdef LANG_ES
const char* SettingsLongNames[13] = {
/*These are all the help text for all the settings.*/
/*All must start with 6 spaces so they come on screen nicely.*/
"Fuente de energía. Ajusta el límite inferior de voltaje. <DC=10V S=3.3V por celda>", //
"Temperatura en reposo. <C>",//
"Tiempo hasta activar reposo. <Minutos>",//
"Tiempo hasta apagado. <Minutos>",//
"Sensibilidad del movimiento. <0=Apagado 1=El menos sensible 9=El más sensible>",//
"Display detailed information in a smaller font.",//
"Orientación de la pantalla <A=Automático I=Mano izquierda D=Mano derecha>",//
"Activar el botón \"Boost\" en modo soldadura.",//
"Temperatura en modo \"Boost\". <C>",//
"Iniciar modo soldadura en el encendido. <V=Sí S=Modo reposo F=No>",//
"Parpadea la temperatura en el enfriamiento si la punta sigue caliente.",//
"Calibrate tip offset.",//
"Reset all settings",//
};
const char* SettingsCalibrationWarning = "Please ensure the tip is at room temperature before continuing!";
const char* UVLOWarningString = "LOW VOLT"; //Fixed width 8 chars
const char SettingTrueChar = 'V';
const char SettingFalseChar = 'F';
const char SettingSleepChar = 'S';
const char SettingFastChar = 'R';
const char SettingMediumChar = 'M';
const char SettingSlowChar = 'L';
const char SettingRightChar = 'D';
const char SettingLeftChar = 'I';
const char SettingAutoChar = 'A';
const char SettingTempCChar = 'C';
const char SettingTempFChar = 'F';
#endif
#ifdef LANG_DE
const char* SettingsLongNames[13] = {
/*These are all the help text for all the settings.*/
/*All must start with 6 spaces so they come on screen nicely.*/
"Stromversorgung. Setzt Abschaltspannung <DC=10V S=3.3V pro Zelle>",
"Ruhetemperatur <C>",
"Ruhemodus nach <Minuten>",
"Abschaltzeit <Minuten>",
"Bewegungsempfindlichkeit <0=Aus 1=Minimal 9=Maximal>",
"Display detailed information in a smaller font.", //
"Anzeigerichtung <A=Auto L=Linkshändig R=Rechtshändig>",
"Fronttaste für Temperaturboost einschalten",
"Temperatur im \"boost\"-Modus <C>",
"Automatischer Start beim Einschalten. <J=Löttemp R=Ruhemodus N=Aus>",
"Temperatur blinkt beim Abkühlen, solange noch heiß.",
"Calibrate tip offset.",//s
"Reset all settings",};
};
const char* UVLOWarningString = "V gering"; //Fixed width 8 chars
const char* CoolingPromptString = "Kalt ";//Fixed width 5 chars
const char SettingTrueChar = 'J';
const char SettingFalseChar = 'N';
const char SettingSleepChar = 'R';
const char SettingFastChar = 'S';
const char SettingMediumChar = 'M';
const char SettingSlowChar = 'L';
const char SettingRightChar = 'R';
const char SettingLeftChar = 'L';
const char SettingAutoChar = 'A';
const char SettingTempCChar = 'C';
const char SettingTempFChar = 'F';
#endif
#ifdef LANG_FR
const char* SettingsLongNames[13] = {
/*These are all the help text for all the settings.*/
/*All must start with 6 spaces so they come on screen nicely.*/
"Type d\'alimentation. Regle la tension de coupure. <DC=10V S=3.3V par cellules>",
"Temperature en veille. <C>",
"Temps avant mise en veille. <Minutes>",
"Temps avant extinction. <Minutes>",
"Sensibilitee du capteur de mouvement. <0=Inactif 1=Peu sensible 9=Tres sensible>",
"Display detailed information in a smaller font.", //
"Orientation de l\'affichage. <A=Automatique G=Gaucher D=Droitier>",
"Active le mode \"Boost\" 450C sur le bouton de devant pendant la soudure.",
"Temperature du mode \"Boost\". <C>",
"Demarre automatiquement la soudure a l\'allumage. <A=Active, V=Mode Veille, D=Desactive>",
"Fait clignotter la temperature pendant la phase de refroidissement quand la panne est chaude.",
"Calibrate tip offset.",//s
"Reset all settings",};
};
const char* SettingsCalibrationWarning = "Please ensure the tip is at room temperature before continuing!";
const char* UVLOWarningString = "Batt Bas"; //Fixed width 8 chars
const char* CoolingPromptString = "Etein";//Fixed width 5 chars
const char SettingTrueChar = 'A';
const char SettingFalseChar = 'D';
const char SettingSleepChar = 'V';
const char SettingFastChar = 'R';
const char SettingMediumChar = 'M';
const char SettingSlowChar = 'L';
const char SettingRightChar = 'D';
const char SettingLeftChar = 'G';
const char SettingAutoChar = 'A';
const char SettingTempCChar = 'C';
const char SettingTempFChar = 'F';
#endif
#ifdef LANG_IT
const char* SettingsLongNames[13] = {
/*These are all the help text for all the settings.*/
"Sorgente di alimentazione. Imposta il limite inferiore di tensione. <DC=10V S=3.3V per cella>",
"Temperatura modalità riposo <C>",
"Timeout per passaggio a modalità riposo <Minuti>",
"Timeout spegnimento <Minuti>",
"Sensibilità al movimento <0=Spento 1=Sensibilità minima 9=Sensibilità massima>",
"Display detailed information in a smaller font.", //
"Orientamento del display <A=Automatico S=Sinistrorso D=Destrorso>",
"Il tasto anteriore abilita modalità \"boost\" fino a 450C durante la saldatura",
"Temperatura in modalità \"boost\" <C>",
"Avvia automaticamente il saldatore quando viene alimentato. <S=Modalità saldatura R=Modalità riposo N=Spento>",
"Durante lo spegnimento la temperatura lampeggia sul display finché la punta è calda.",
"Calibrate tip offset.",//s
"Reset all settings",};
};
const char* SettingsCalibrationWarning = "Please ensure the tip is at room temperature before continuing!";
const char* UVLOWarningString = "LOW VOLT"; //Fixed width 8 chars
const char* CoolingPromptString = "Cool";//Fixed width 5 chars
const char SettingTrueChar = 'S';
const char SettingFalseChar = 'N';
const char SettingSleepChar = 'R';
const char SettingFastChar = 'V';
const char SettingMediumChar = 'M';
const char SettingSlowChar = 'L';
const char SettingRightChar = 'D';
const char SettingLeftChar = 'S';
const char SettingAutoChar = 'A';
const char SettingTempCChar = 'C';
const char SettingTempFChar = 'F';
#endif
#ifdef LANG_SE
const char* SettingsLongNames[13] = {
/*These are all the help text for all the settings.*/
"Stromforsorjning. Satt avstagningsvolt. <VX=10V S=3.3V per cell>",
"Vilolage Temperatur <C>",
"Vilolage Timeout <Minuter>",
"Avstagningstimeout <Minuter>",
"Rorelsekanslighet <0=Av 1=Minsta kanslighet 9=Hogsta kanslighet>",
"Display detailed information in a smaller font.", //
"Skarmorientation <A=Automatisk V=Vansterhant H=Hogerhant>",
"Aktivera boost-lage med framre knappen <P=Pa A=Av>",
"Temperatur i \"boostlage\" <C>",
"Startar i lodningslage direkt <L=Lodning V=Vilolage A=Av>",
"Blinka temperaturen medans jarnet fortfarande ar varmt. <P=Pa A=Av>",
"Calibrate tip offset.",//s
"Reset all settings",};
};
const char* SettingsCalibrationWarning = "Please ensure the tip is at room temperature before continuing!";
const char* UVLOWarningString = "Lag Volt"; //Fixed width 8 chars
const char* CoolingPromptString = "Sval ";//Fixed width 5 chars
const char SettingTrueChar = 'P';
const char SettingFalseChar = 'A';
const char SettingSleepChar = 'V';
const char SettingFastChar = 'S';
const char SettingMediumChar = 'M';
const char SettingSlowChar = 'L';
const char SettingRightChar = 'H';
const char SettingLeftChar = 'V';
const char SettingAutoChar = 'A';
const char SettingTempCChar = 'C';
const char SettingTempFChar = 'F';
#endif
const char* SettingsShortNames[13] = { /**/
"PWRSC ", // Power Source (DC or batt)
"STMP ", // Sleep Temperature
"STME ", // Sleep Timeout
"SHTME ", // Shutdown Temperature
"MSENSE ", // Motion sensitivity level
"ADVDSP ", // Advanced display mode enable
"DSPROT ", // Display rotation mode
"BOOST ", // Boost enabled
"BTMP ", // Boost temperature
"ASTART ", // Automatic Start mode
"CLBLNK ", // Cooldown blink
"TMP CAL?", // Temperature calibration enter menu
"RESET? " // Settings reset command
};