mirror of
https://github.com/Ralim/IronOS.git
synced 2025-02-26 07:53:55 +00:00
Convert over C constants to python aware strings for translation
This commit is contained in:
@@ -38,7 +38,6 @@ public:
|
||||
//or we need to goto double buffering
|
||||
}
|
||||
|
||||
static void drawChar(char c); // Draw a character to a specific location
|
||||
// Turn the screen on or not
|
||||
static void displayOnOff(bool on) {
|
||||
displayOnOffState = on;
|
||||
@@ -92,9 +91,7 @@ public:
|
||||
bool clear);
|
||||
static void drawHeatSymbol(uint8_t state);
|
||||
private:
|
||||
|
||||
//Draw a buffer to the screen buffer
|
||||
|
||||
static void drawChar(char c); // Draw a character to a specific location
|
||||
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
|
||||
static uint8_t* secondStripPtr; //Pointers to the strips
|
||||
|
||||
@@ -9,8 +9,7 @@
|
||||
#define TRANSLATION_H_
|
||||
#include "stm32f1xx_hal.h"
|
||||
enum ShortNameType {
|
||||
SHORT_NAME_SINGLE_LINE = 1,
|
||||
SHORT_NAME_DOUBLE_LINE = 2,
|
||||
SHORT_NAME_SINGLE_LINE = 1, SHORT_NAME_DOUBLE_LINE = 2,
|
||||
};
|
||||
extern const uint8_t USER_FONT_12[];
|
||||
extern const uint8_t USER_FONT_6x8[];
|
||||
@@ -42,7 +41,7 @@ extern const char* IdleSetString;
|
||||
extern const char* TipDisconnectedString;
|
||||
extern const char* SolderingAdvancedPowerPrompt;
|
||||
extern const char* OffString;
|
||||
|
||||
extern const char* ResetOKMessage;
|
||||
extern const char* SettingTrueChar;
|
||||
extern const char* SettingFalseChar;
|
||||
extern const char* SettingRightChar;
|
||||
@@ -51,5 +50,18 @@ extern const char* SettingAutoChar;
|
||||
|
||||
extern const char* SettingFastChar;
|
||||
extern const char* SettingSlowChar;
|
||||
extern const char* TipModelStrings[];
|
||||
extern const char* SymbolPlus;
|
||||
extern const char* SymbolMinus;
|
||||
extern const char* SymbolSpace;
|
||||
extern const char* SymbolDot;
|
||||
extern const char* SymbolDegC;
|
||||
extern const char* SymbolDegF;
|
||||
extern const char* SymbolMinutes;
|
||||
extern const char* SymbolSeconds;
|
||||
extern const char* SymbolWatts;
|
||||
extern const char* SymbolVolts;
|
||||
extern const char* SymbolDC;
|
||||
extern const char* SymbolCellCount;
|
||||
|
||||
#endif /* TRANSLATION_H_ */
|
||||
|
||||
@@ -106,7 +106,7 @@ enum TipType {
|
||||
#endif
|
||||
#ifdef MODEL_TS80
|
||||
enum TipType {
|
||||
TS_B02 = 0, TS_D25 = 1, Tip_MiniWare = 2, Tip_Custom = 2,
|
||||
TS_B02 = 0, TS_D25 = 1, Tip_MiniWare = 2, Tip_Custom = 3,
|
||||
};
|
||||
#endif
|
||||
extern uint16_t tipGainCalValue ;
|
||||
|
||||
@@ -88,11 +88,14 @@ void OLED::initialize() {
|
||||
* Precursor is the command char that is used to select the table.
|
||||
*/
|
||||
void OLED::drawChar(char c) {
|
||||
if (c == '\n' && cursor_y == 0) {
|
||||
if (c == '\x01' && cursor_y == 0) { // 0x01 is used as new line char
|
||||
cursor_x = 0;
|
||||
cursor_y = 8;
|
||||
return;
|
||||
} else if (c == 0) {
|
||||
return;
|
||||
}
|
||||
uint16_t index = c-1;
|
||||
uint16_t index = c - 2; //First index is \x02
|
||||
uint8_t* charPointer;
|
||||
charPointer = ((uint8_t*) currentFont)
|
||||
+ ((fontWidth * (fontHeight / 8)) * index);
|
||||
@@ -156,44 +159,44 @@ void OLED::printNumber(uint16_t number, uint8_t places) {
|
||||
char buffer[7] = { 0 };
|
||||
|
||||
if (places >= 5) {
|
||||
buffer[5] = 1 + number % 10;
|
||||
buffer[5] = 2 + number % 10;
|
||||
number /= 10;
|
||||
}
|
||||
if (places > 4) {
|
||||
buffer[4] = 1 + number % 10;
|
||||
buffer[4] = 2 + number % 10;
|
||||
number /= 10;
|
||||
}
|
||||
|
||||
if (places > 3) {
|
||||
buffer[3] = 1 + number % 10;
|
||||
buffer[3] = 2 + number % 10;
|
||||
number /= 10;
|
||||
}
|
||||
|
||||
if (places > 2) {
|
||||
buffer[2] = 1 + number % 10;
|
||||
buffer[2] = 2 + number % 10;
|
||||
number /= 10;
|
||||
}
|
||||
|
||||
if (places > 1) {
|
||||
buffer[1] = 1 + number % 10;
|
||||
buffer[1] = 2 + number % 10;
|
||||
number /= 10;
|
||||
}
|
||||
|
||||
buffer[0] = 1 + number % 10;
|
||||
buffer[0] = 2 + number % 10;
|
||||
number /= 10;
|
||||
print(buffer);
|
||||
}
|
||||
|
||||
void OLED::debugNumber(int32_t val) {
|
||||
if (abs(val) > 99999) {
|
||||
OLED::print(" OoB"); // out of bounds
|
||||
OLED::print(SymbolSpace); // out of bounds
|
||||
return;
|
||||
}
|
||||
if (val >= 0) {
|
||||
OLED::drawChar(' ');
|
||||
OLED::print(SymbolSpace);
|
||||
OLED::printNumber(val, 5);
|
||||
} else {
|
||||
OLED::drawChar('-');
|
||||
OLED::print(SymbolMinus);
|
||||
OLED::printNumber(-val, 5);
|
||||
}
|
||||
}
|
||||
@@ -201,8 +204,7 @@ void OLED::debugNumber(int32_t val) {
|
||||
void OLED::drawSymbol(uint8_t symbolID) {
|
||||
// draw a symbol to the current cursor location
|
||||
setFont(2);
|
||||
drawChar(' ' + symbolID); // space offset is in all fonts, so we pad it here
|
||||
// and remove it later
|
||||
drawChar(symbolID + 2);
|
||||
setFont(0);
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -305,10 +305,10 @@ static void settings_displayInputVRange(void) {
|
||||
printShortDescription(0, 6);
|
||||
|
||||
if (systemSettings.cutoutSetting) {
|
||||
OLED::drawChar('0' + 2 + systemSettings.cutoutSetting);
|
||||
OLED::drawChar('S');
|
||||
OLED::printNumer(2 + systemSettings.cutoutSetting,1);
|
||||
OLED::print(SymbolCellCount);
|
||||
} else {
|
||||
OLED::print("DC");
|
||||
OLED::print(SymbolDC);
|
||||
}
|
||||
}
|
||||
#else
|
||||
@@ -321,10 +321,12 @@ static void settings_displayInputPRange(void) {
|
||||
//0 = 18W, 1=24W
|
||||
switch (systemSettings.cutoutSetting) {
|
||||
case 0:
|
||||
OLED::print("18W");
|
||||
OLED::printNumber(18, 2);
|
||||
OLED::print(SymbolWatts);
|
||||
break;
|
||||
case 1:
|
||||
OLED::print("24W");
|
||||
OLED::printNumber(24, 2);
|
||||
OLED::print(SymbolWatts);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -367,10 +369,10 @@ static void settings_displaySleepTime(void) {
|
||||
OLED::print(OffString);
|
||||
} else if (systemSettings.SleepTime < 6) {
|
||||
OLED::printNumber(systemSettings.SleepTime * 10, 2);
|
||||
OLED::drawChar('S');
|
||||
OLED::print(SymbolSeconds);
|
||||
} else {
|
||||
OLED::printNumber(systemSettings.SleepTime - 5, 2);
|
||||
OLED::drawChar('M');
|
||||
OLED::print(SymbolMinutes);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -389,7 +391,7 @@ static void settings_displayShutdownTime(void) {
|
||||
OLED::print(OffString);
|
||||
} else {
|
||||
OLED::printNumber(systemSettings.ShutdownTime, 2);
|
||||
OLED::drawChar('M');
|
||||
OLED::print(SymbolMinutes);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -422,7 +424,7 @@ static void settings_setTempF(void) {
|
||||
static void settings_displayTempF(void) {
|
||||
printShortDescription(5, 7);
|
||||
|
||||
OLED::drawChar((systemSettings.temperatureInF) ? 'F' : 'C');
|
||||
OLED::print((systemSettings.temperatureInF) ? SymbolDegF : SymbolDegC);
|
||||
}
|
||||
|
||||
static void settings_setSensitivity(void) {
|
||||
@@ -559,7 +561,7 @@ static void settings_setResetSettings(void) {
|
||||
|
||||
OLED::setFont(0);
|
||||
OLED::setCursor(0, 0);
|
||||
OLED::print("RESET OK");
|
||||
OLED::print(ResetOKMessage);
|
||||
OLED::refresh();
|
||||
|
||||
waitForButtonPressOrTimeout(200); // 2 second timeout
|
||||
@@ -582,63 +584,21 @@ static void settings_displayTipModel(void) {
|
||||
// Print the mfg
|
||||
OLED::setCursor(55, 0);
|
||||
if (systemSettings.tipType < Tip_MiniWare) {
|
||||
#ifdef MODEL_TS100
|
||||
OLED::print("TS100");
|
||||
#else
|
||||
OLED::print("TS80");
|
||||
#endif
|
||||
OLED::print(TipModelStrings[Tip_MiniWare]);
|
||||
}
|
||||
#ifdef MODEL_TS100
|
||||
else if (systemSettings.tipType < Tip_Hakko) {
|
||||
OLED::print("HAKKO");
|
||||
OLED::print(TipModelStrings[Tip_Hakko]);
|
||||
}
|
||||
#endif
|
||||
else if (systemSettings.tipType == Tip_Custom) {
|
||||
OLED::print("User");
|
||||
OLED::print(TipModelStrings[Tip_Custom]);
|
||||
}
|
||||
OLED::setCursor(55, 8);
|
||||
#ifdef MODEL_TS100
|
||||
switch ((enum TipType)systemSettings.tipType) {
|
||||
case TS_B2:
|
||||
OLED::print(" B2 ");
|
||||
break;
|
||||
case TS_D24:
|
||||
OLED::print(" D24 ");
|
||||
break;
|
||||
case TS_BC2:
|
||||
OLED::print(" BC2 ");
|
||||
break;
|
||||
case TS_C1:
|
||||
OLED::print(" C1 ");
|
||||
break;
|
||||
case HAKKO_BC2:
|
||||
OLED::print(" BC2 ");
|
||||
break;
|
||||
case Tip_Custom:
|
||||
OLED::print("Tuned");
|
||||
break;
|
||||
default:
|
||||
OLED::print("????");
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
#ifdef MODEL_TS80
|
||||
// only 2 tips atm
|
||||
switch ((enum TipType) systemSettings.tipType) {
|
||||
case TS_B02:
|
||||
OLED::print(" B02 ");
|
||||
break;
|
||||
case TS_D25:
|
||||
OLED::print(" D25 ");
|
||||
break;
|
||||
case Tip_Custom:
|
||||
OLED::print("Tuned");
|
||||
break;
|
||||
default:
|
||||
OLED::print("????");
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
if (systemSettings.tipType != Tip_Custom)
|
||||
if (systemSettings.tipType != Tip_MiniWare)
|
||||
OLED::print(TipModelStrings[systemSettings.tipType]);
|
||||
|
||||
}
|
||||
static void calibration_displaySimpleCal(void) {
|
||||
printShortDescription(18, 5);
|
||||
@@ -771,17 +731,17 @@ static void calibration_enterAdvancedCal(void) {
|
||||
OLED::clearScreen();
|
||||
OLED::setFont(0);
|
||||
if (OLED::getRotation())
|
||||
OLED::drawChar('-');
|
||||
OLED::print(SymbolMinus);
|
||||
else
|
||||
OLED::drawChar('+');
|
||||
OLED::print(SymbolPlus);
|
||||
|
||||
OLED::drawChar(' ');
|
||||
OLED::print(SymbolSpace);
|
||||
OLED::printNumber(systemSettings.customTipGain, 4);
|
||||
OLED::drawChar(' ');
|
||||
OLED::print(SymbolSpace);
|
||||
if (OLED::getRotation())
|
||||
OLED::drawChar('+');
|
||||
OLED::print(SymbolPlus);
|
||||
else
|
||||
OLED::drawChar('-');
|
||||
OLED::print(SymbolMinus);
|
||||
OLED::refresh();
|
||||
GUIDelay();
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ int main(void) {
|
||||
void printVoltage() {
|
||||
uint32_t volt = getInputVoltageX10(systemSettings.voltageDiv, 0);
|
||||
OLED::printNumber(volt / 10, 2);
|
||||
OLED::drawChar('.');
|
||||
OLED::print(SymbolDot);
|
||||
OLED::printNumber(volt % 10, 1);
|
||||
}
|
||||
void GUIDelay() {
|
||||
@@ -374,25 +374,25 @@ static void gui_solderingTempAdjust() {
|
||||
#else
|
||||
if (OLED::getRotation())
|
||||
#endif
|
||||
OLED::drawChar('-');
|
||||
OLED::print(SymbolMinus);
|
||||
else
|
||||
OLED::drawChar('+');
|
||||
OLED::print(SymbolPlus);
|
||||
|
||||
OLED::drawChar(' ');
|
||||
OLED::print(SymbolSpace);
|
||||
OLED::printNumber(systemSettings.SolderingTemp, 3);
|
||||
if (systemSettings.temperatureInF)
|
||||
OLED::drawSymbol(0);
|
||||
else
|
||||
OLED::drawSymbol(1);
|
||||
OLED::drawChar(' ');
|
||||
OLED::print(SymbolSpace);
|
||||
#ifdef MODEL_TS80
|
||||
if (!OLED::getRotation())
|
||||
#else
|
||||
if (OLED::getRotation())
|
||||
#endif
|
||||
OLED::drawChar('+');
|
||||
OLED::print(SymbolPlus);
|
||||
else
|
||||
OLED::drawChar('-');
|
||||
OLED::print(SymbolMinus);
|
||||
OLED::refresh();
|
||||
GUIDelay();
|
||||
}
|
||||
@@ -443,13 +443,13 @@ static int gui_SolderingSleepingMode() {
|
||||
OLED::print(SleepingTipAdvancedString);
|
||||
OLED::printNumber(tipTemp, 3);
|
||||
if (systemSettings.temperatureInF)
|
||||
OLED::print("F");
|
||||
OLED::print(SymbolDegF);
|
||||
else
|
||||
OLED::print("C");
|
||||
OLED::print(SymbolDegC);
|
||||
|
||||
OLED::print(" ");
|
||||
OLED::print(SymbolSpace);
|
||||
printVoltage();
|
||||
OLED::drawChar('V');
|
||||
OLED::print(SymbolVolts);
|
||||
} else {
|
||||
OLED::setFont(0);
|
||||
OLED::print(SleepingSimpleString);
|
||||
@@ -565,28 +565,28 @@ static void gui_solderingMode(uint8_t jumpToSleep) {
|
||||
OLED::setFont(1);
|
||||
OLED::print(SolderingAdvancedPowerPrompt); // Power:
|
||||
OLED::printNumber(milliWattHistory[0] / 1000, 2);
|
||||
OLED::drawChar('.');
|
||||
OLED::print(SymbolDot);
|
||||
OLED::printNumber(milliWattHistory[0] / 100 % 10, 1);
|
||||
OLED::drawChar('W');
|
||||
OLED::print(SymbolWatts);
|
||||
|
||||
if (systemSettings.sensitivity && systemSettings.SleepTime) {
|
||||
OLED::print(" ");
|
||||
OLED::print(SymbolSpace);
|
||||
display_countdown(sleepThres);
|
||||
}
|
||||
|
||||
OLED::setCursor(0, 8);
|
||||
OLED::print(SleepingTipAdvancedString);
|
||||
gui_drawTipTemp(true);
|
||||
OLED::print(" ");
|
||||
OLED::print(SymbolSpace);
|
||||
printVoltage();
|
||||
OLED::drawChar('V');
|
||||
OLED::print(SymbolVolts);
|
||||
} else {
|
||||
// We switch the layout direction depending on the orientation of the
|
||||
// OLED::
|
||||
if (OLED::getRotation()) {
|
||||
// battery
|
||||
gui_drawBatteryIcon();
|
||||
OLED::drawChar(' '); // Space out gap between battery <-> temp
|
||||
OLED::print(SymbolSpace); // Space out gap between battery <-> temp
|
||||
gui_drawTipTemp(true); // Draw current tip temp
|
||||
|
||||
// We draw boost arrow if boosting, or else gap temp <-> heat
|
||||
@@ -594,7 +594,7 @@ static void gui_solderingMode(uint8_t jumpToSleep) {
|
||||
if (boostModeOn)
|
||||
OLED::drawSymbol(2);
|
||||
else
|
||||
OLED::drawChar(' ');
|
||||
OLED::print(SymbolSpace);
|
||||
|
||||
// Draw heating/cooling symbols
|
||||
OLED::drawHeatSymbol(
|
||||
@@ -610,10 +610,10 @@ static void gui_solderingMode(uint8_t jumpToSleep) {
|
||||
if (boostModeOn)
|
||||
OLED::drawSymbol(2);
|
||||
else
|
||||
OLED::drawChar(' ');
|
||||
OLED::print(SymbolSpace);
|
||||
gui_drawTipTemp(true); // Draw current tip temp
|
||||
|
||||
OLED::drawChar(' '); // Space out gap between battery <-> temp
|
||||
OLED::print(SymbolSpace); // Space out gap between battery <-> temp
|
||||
|
||||
gui_drawBatteryIcon();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user