1
0
forked from me/IronOS

Merge branch 'dev' into BLE

This commit is contained in:
Ben V. Brown
2023-01-23 17:22:06 +11:00
committed by GitHub
63 changed files with 9197 additions and 12868 deletions

View File

@@ -178,14 +178,9 @@ void OLED::drawChar(const uint16_t charCode, const FontStyle fontStyle) {
fontWidth = 12;
break;
}
for (uint32_t i = 0; i < FontSectionsCount; i++) {
const auto &section = FontSections[i];
if (charCode >= section.symbol_start && charCode < section.symbol_end) {
currentFont = fontStyle == FontStyle::SMALL ? section.font06_start_ptr : section.font12_start_ptr;
index = charCode - section.symbol_start;
break;
}
}
currentFont = fontStyle == FontStyle::SMALL ? FontSectionInfo.font06_start_ptr : FontSectionInfo.font12_start_ptr;
index = charCode - 2;
break;
}
const uint8_t *charPointer = currentFont + ((fontWidth * (fontHeight / 8)) * index);
@@ -368,8 +363,8 @@ void OLED::setRotation(bool leftHanded) {
// mode as driver ram is 128 wide
screenBuffer[7] = inLeftHandedMode ? 95 : 0x7F; // End address of the ram segment we are writing to (96 wide)
screenBuffer[9] = inLeftHandedMode ? 0xC8 : 0xC0;
//Force a screen refresh
const int len = FRAMEBUFFER_START + (OLED_WIDTH * 2);
// Force a screen refresh
const int len = FRAMEBUFFER_START + (OLED_WIDTH * 2);
I2C_CLASS::Transmit(DEVICEADDR_OLED, screenBuffer, len);
osDelay(TICKS_10MS);
checkDisplayBufferChecksum();
@@ -389,6 +384,10 @@ void OLED::setInverseDisplay(bool inverse) {
// print a string to the current cursor location
void OLED::print(const char *const str, FontStyle fontStyle) {
const uint8_t *next = reinterpret_cast<const uint8_t *>(str);
if (next[0] == 0x01) {
fontStyle = FontStyle::LARGE;
next++;
}
while (next[0]) {
uint16_t index;
if (next[0] <= 0xF0) {
@@ -430,7 +429,7 @@ inline void stripLeaderZeros(char *buffer, uint8_t places) {
// Stop 1 short so that we dont blank entire number if its zero
for (int i = 0; i < (places - 1); i++) {
if (buffer[i] == 2) {
buffer[i] = SymbolSpace[0];
buffer[i] = LargeSymbolSpace[0];
} else {
return;
}
@@ -479,14 +478,14 @@ void OLED::printNumber(uint16_t number, uint8_t places, FontStyle fontStyle, boo
void OLED::debugNumber(int32_t val, FontStyle fontStyle) {
if (abs(val) > 99999) {
OLED::print(SymbolSpace, fontStyle); // out of bounds
OLED::print(LargeSymbolSpace, fontStyle); // out of bounds
return;
}
if (val >= 0) {
OLED::print(SymbolSpace, fontStyle);
OLED::print(LargeSymbolSpace, fontStyle);
OLED::printNumber(val, 5, fontStyle);
} else {
OLED::print(SymbolMinus, fontStyle);
OLED::print(LargeSymbolMinus, fontStyle);
OLED::printNumber(-val, 5, fontStyle);
}
}

View File

@@ -7,28 +7,44 @@
#ifndef TRANSLATION_H_
#define TRANSLATION_H_
#include "stdint.h"
#include <stdbool.h>
#include <stdint.h>
extern const bool HasFahrenheit;
extern const char *SymbolPlus;
extern const char *SymbolMinus;
extern const char *SymbolSpace;
extern const char *SymbolAmps;
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;
extern const char *SymbolVersionNumber;
extern const char *SymbolPDDebug;
extern const char *SymbolState;
extern const char *SymbolNoVBus;
extern const char *SymbolVBus;
extern const char *SmallSymbolPlus;
extern const char *LargeSymbolPlus;
extern const char *SmallSymbolMinus;
extern const char *LargeSymbolMinus;
extern const char *SmallSymbolSpace;
extern const char *LargeSymbolSpace;
extern const char *SmallSymbolAmps;
extern const char *LargeSymbolAmps;
extern const char *SmallSymbolDot;
extern const char *LargeSymbolDot;
extern const char *SmallSymbolDegC;
extern const char *LargeSymbolDegC;
extern const char *SmallSymbolDegF;
extern const char *LargeSymbolDegF;
extern const char *LargeSymbolMinutes;
extern const char *SmallSymbolMinutes;
extern const char *LargeSymbolSeconds;
extern const char *SmallSymbolSeconds;
extern const char *LargeSymbolWatts;
extern const char *SmallSymbolWatts;
extern const char *LargeSymbolVolts;
extern const char *SmallSymbolVolts;
extern const char *LargeSymbolDC;
extern const char *SmallSymbolDC;
extern const char *LargeSymbolCellCount;
extern const char *SmallSymbolCellCount;
//
extern const char *SmallSymbolVersionNumber;
extern const char *SmallSymbolPDDebug;
extern const char *SmallSymbolState;
extern const char *SmallSymbolNoVBus;
extern const char *SmallSymbolVBus;
extern const char *DebugMenu[];
extern const char *AccelTypeNames[];
@@ -73,6 +89,16 @@ enum class SettingsItemIndex : uint8_t {
};
struct TranslationIndexTable {
uint16_t CJCCalibrationDone;
uint16_t ResetOKMessage;
uint16_t SettingsResetMessage;
uint16_t NoAccelerometerMessage;
uint16_t NoPowerDeliveryMessage;
uint16_t LockingKeysString;
uint16_t UnlockingKeysString;
uint16_t WarningKeysLockedString;
uint16_t WarningThermalRunaway;
uint16_t SettingsCalibrationWarning;
uint16_t CJCCalibrating;
uint16_t SettingsResetWarning;
@@ -86,16 +112,6 @@ struct TranslationIndexTable {
uint16_t OffString;
uint16_t DeviceFailedValidationWarning;
uint16_t CJCCalibrationDone;
uint16_t ResetOKMessage;
uint16_t SettingsResetMessage;
uint16_t NoAccelerometerMessage;
uint16_t NoPowerDeliveryMessage;
uint16_t LockingKeysString;
uint16_t UnlockingKeysString;
uint16_t WarningKeysLockedString;
uint16_t WarningThermalRunaway;
uint16_t SettingRightChar;
uint16_t SettingLeftChar;
uint16_t SettingAutoChar;
@@ -113,8 +129,8 @@ struct TranslationIndexTable {
uint16_t SettingsDescriptions[static_cast<uint32_t>(SettingsItemIndex::NUM_ITEMS)];
uint16_t SettingsShortNames[static_cast<uint32_t>(SettingsItemIndex::NUM_ITEMS)];
uint16_t SettingsMenuEntries[5];
uint16_t SettingsMenuEntriesDescriptions[5]; // unused
uint16_t SettingsMenuEntries[5];
};
extern const TranslationIndexTable *Tr;
@@ -130,16 +146,15 @@ struct TranslationData {
};
struct FontSection {
/// Start index of font section, inclusive
uint16_t symbol_start;
/// End index of font section, exclusive
uint16_t symbol_end;
const uint8_t *font12_start_ptr;
const uint8_t *font06_start_ptr;
uint16_t font12_decompressed_size;
uint16_t font06_decompressed_size;
const uint8_t *font12_compressed_source; // Pointer to compressed data or null
const uint8_t *font06_compressed_source; // Pointer to compressed data or null
};
extern const FontSection *const FontSections;
extern const uint8_t FontSectionsCount;
extern const FontSection FontSectionInfo;
constexpr uint8_t settings_item_index(const SettingsItemIndex i) { return static_cast<uint8_t>(i); }
// Use a constexpr function for type-checking.

View File

@@ -2,7 +2,7 @@
#define TRANSLATION_MULTI_H_
#include "Translation.h"
#include <stdbool.h>
// The compressed translation data will be decompressed to this buffer. These
// data may include:
// - TranslationData (translation index table and translation strings)
@@ -14,21 +14,6 @@
extern uint8_t translation_data_out_buffer[];
extern const uint16_t translation_data_out_buffer_size;
struct FontSectionDataInfo {
uint16_t symbol_start;
uint16_t symbol_count;
uint16_t data_size : 15;
bool data_is_compressed : 1;
// Font12x16 data followed by font6x8 data
const uint8_t *data_ptr;
};
extern const FontSectionDataInfo FontSectionDataInfos[];
extern const uint8_t FontSectionDataCount;
extern FontSection DynamicFontSections[];
struct LanguageMeta {
uint16_t uniqueID;
const uint8_t *translation_data;

View File

@@ -52,29 +52,14 @@ void prepareTranslations() {
Tr = &translationData->indices;
TranslationStrings = translationData->strings;
memset(DynamicFontSections, 0, FontSectionsCount * sizeof(DynamicFontSections[0]));
for (int i = 0; i < FontSectionDataCount; i++) {
const auto &fontSectionDataInfo = FontSectionDataInfos[i];
auto &fontSection = DynamicFontSections[i];
fontSection.symbol_start = fontSectionDataInfo.symbol_start;
fontSection.symbol_end = fontSection.symbol_start + fontSectionDataInfo.symbol_count;
const uint16_t font12_size = fontSectionDataInfo.symbol_count * (12 * 16 / 8);
uint16_t dataSize;
if (fontSectionDataInfo.data_is_compressed) {
unsigned int outsize;
outsize = blz_depack_srcsize(fontSectionDataInfo.data_ptr, buffer_next_ptr, fontSectionDataInfo.data_size);
// Font 12 can be compressed; if it is then we want to decompress it to ram
if (FontSectionInfo.font12_compressed_source != NULL) {
blz_depack(FontSectionInfo.font12_compressed_source, (uint8_t *)FontSectionInfo.font12_start_ptr, FontSectionInfo.font12_decompressed_size);
}
fontSection.font12_start_ptr = buffer_next_ptr;
dataSize = outsize;
buffer_remaining_size -= outsize;
buffer_next_ptr += outsize;
} else {
fontSection.font12_start_ptr = fontSectionDataInfo.data_ptr;
dataSize = fontSectionDataInfo.data_size;
}
if (dataSize > font12_size) {
fontSection.font06_start_ptr = fontSection.font12_start_ptr + font12_size;
}
// Font 06 can be compressed; if it is then we want to decompress it to ram
if (FontSectionInfo.font06_compressed_source != NULL) {
blz_depack(FontSectionInfo.font06_compressed_source, (uint8_t *)FontSectionInfo.font06_start_ptr, FontSectionInfo.font06_decompressed_size);
}
}

View File

@@ -161,12 +161,12 @@ const menuitem rootSettingsMenu[] {
#if defined(POW_DC) || defined(POW_QC) || defined(POW_PD)
const menuitem powerMenu[] = {
/*
* Power Source
* -Minimum Voltage
* QC Voltage
* PD Timeout
*/
/*
* Power Source
* -Minimum Voltage
* QC Voltage
* PD Timeout
*/
#ifdef POW_DC
{SETTINGS_DESC(SettingsItemIndex::DCInCutoff), nullptr, displayInputVRange, nullptr, SettingsOptions::MinDCVoltageCells, SettingsItemIndex::DCInCutoff, 6}, /*Voltage input*/
{SETTINGS_DESC(SettingsItemIndex::MinVolCell), nullptr, displayInputMinVRange, showInputVOptions, SettingsOptions::MinVoltageCells, SettingsItemIndex::MinVolCell, 5}, /*Minimum voltage input*/
@@ -264,7 +264,7 @@ const menuitem advancedMenu[] = {
* -Power Pulse Duration
* Factory Reset
*/
{SETTINGS_DESC(SettingsItemIndex::PowerLimit), nullptr, displayPowerLimit, nullptr, SettingsOptions::PowerLimit, SettingsItemIndex::PowerLimit, 5}, /*Power limit*/
{SETTINGS_DESC(SettingsItemIndex::PowerLimit), nullptr, displayPowerLimit, nullptr, SettingsOptions::PowerLimit, SettingsItemIndex::PowerLimit, 5}, /*Power limit*/
{SETTINGS_DESC(SettingsItemIndex::CalibrateCJC), setCalibrate, displayCalibrate, nullptr, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::CalibrateCJC,
7}, /*Calibrate Cold Junktion Compensation at next boot*/
{SETTINGS_DESC(SettingsItemIndex::VoltageCalibration), setCalibrateVIN, displayCalibrateVIN, nullptr, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::VoltageCalibration,
@@ -273,7 +273,7 @@ const menuitem advancedMenu[] = {
{SETTINGS_DESC(SettingsItemIndex::PowerPulseWait), nullptr, displayPowerPulseWait, showPowerPulseOptions, SettingsOptions::KeepAwakePulseWait, SettingsItemIndex::PowerPulseWait,
7}, /*Power Pulse Wait adjustment*/
{SETTINGS_DESC(SettingsItemIndex::PowerPulseDuration), nullptr, displayPowerPulseDuration, showPowerPulseOptions, SettingsOptions::KeepAwakePulseDuration, SettingsItemIndex::PowerPulseDuration,
7}, /*Power Pulse Duration adjustment*/
7}, /*Power Pulse Duration adjustment*/
{SETTINGS_DESC(SettingsItemIndex::SettingsReset), setResetSettings, displayResetSettings, nullptr, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::SettingsReset, 7}, /*Resets settings*/
{0, nullptr, nullptr, nullptr, SettingsOptions::SettingsOptionsLength, SettingsItemIndex::NUM_ITEMS, 0} // end of menu marker. DO NOT REMOVE
};
@@ -330,9 +330,9 @@ static void displayInputVRange(void) {
if (getSettingValue(SettingsOptions::MinDCVoltageCells)) {
OLED::printNumber(2 + getSettingValue(SettingsOptions::MinDCVoltageCells), 1, FontStyle::LARGE);
OLED::print(SymbolCellCount, FontStyle::LARGE);
OLED::print(LargeSymbolCellCount, FontStyle::LARGE);
} else {
OLED::print(SymbolDC, FontStyle::LARGE);
OLED::print(LargeSymbolDC, FontStyle::LARGE);
}
}
@@ -340,7 +340,7 @@ static bool showInputVOptions(void) { return getSettingValue(SettingsOptions::Mi
static void displayInputMinVRange(void) {
OLED::printNumber(getSettingValue(SettingsOptions::MinVoltageCells) / 10, 1, FontStyle::LARGE);
OLED::print(SymbolDot, FontStyle::LARGE);
OLED::print(LargeSymbolDot, FontStyle::LARGE);
OLED::printNumber(getSettingValue(SettingsOptions::MinVoltageCells) % 10, 1, FontStyle::LARGE);
}
#endif
@@ -352,7 +352,7 @@ static void displayQCInputV(void) {
// Allows setting the voltage negotiated for QC
auto voltage = getSettingValue(SettingsOptions::QCIdealVoltage);
OLED::printNumber(voltage / 10, 2, FontStyle::LARGE);
OLED::print(SymbolDot, FontStyle::LARGE);
OLED::print(LargeSymbolDot, FontStyle::LARGE);
OLED::printNumber(voltage % 10, 1, FontStyle::LARGE);
}
@@ -481,10 +481,10 @@ static void displaySleepTime(void) {
OLED::print(translatedString(Tr->OffString), FontStyle::LARGE);
} else if (getSettingValue(SettingsOptions::SleepTime) < 6) {
OLED::printNumber(getSettingValue(SettingsOptions::SleepTime) * 10, 2, FontStyle::LARGE);
OLED::print(SymbolSeconds, FontStyle::LARGE);
OLED::print(LargeSymbolSeconds, FontStyle::LARGE);
} else {
OLED::printNumber(getSettingValue(SettingsOptions::SleepTime) - 5, 2, FontStyle::LARGE);
OLED::print(SymbolMinutes, FontStyle::LARGE);
OLED::print(LargeSymbolMinutes, FontStyle::LARGE);
}
}
#endif
@@ -495,7 +495,7 @@ static void displayShutdownTime(void) {
OLED::print(translatedString(Tr->OffString), FontStyle::LARGE);
} else {
OLED::printNumber(getSettingValue(SettingsOptions::ShutdownTime), 2, FontStyle::LARGE);
OLED::print(SymbolMinutes, FontStyle::LARGE);
OLED::print(LargeSymbolMinutes, FontStyle::LARGE);
}
}
@@ -537,7 +537,7 @@ static bool setTempF(void) {
return res;
}
static void displayTempF(void) { OLED::print((getSettingValue(SettingsOptions::TemperatureInF)) ? SymbolDegF : SymbolDegC, FontStyle::LARGE); }
static void displayTempF(void) { OLED::print((getSettingValue(SettingsOptions::TemperatureInF)) ? LargeSymbolDegF : LargeSymbolDegC, FontStyle::LARGE); }
#ifndef NO_DISPLAY_ROTATE
static bool setDisplayRotation(void) {
@@ -626,7 +626,7 @@ static void displayLogoTime(void) {
OLED::drawArea(OLED_WIDTH - 24 - 2, 0, 24, 16, infinityIcon);
} else {
OLED::printNumber(getSettingValue(SettingsOptions::LOGOTime), 2, FontStyle::LARGE);
OLED::print(SymbolSeconds, FontStyle::LARGE);
OLED::print(LargeSymbolSeconds, FontStyle::LARGE);
}
}
@@ -640,7 +640,7 @@ static void displayPowerLimit(void) {
OLED::print(translatedString(Tr->OffString), FontStyle::LARGE);
} else {
OLED::printNumber(getSettingValue(SettingsOptions::PowerLimit), 2, FontStyle::LARGE);
OLED::print(SymbolWatts, FontStyle::LARGE);
OLED::print(LargeSymbolWatts, FontStyle::LARGE);
}
}
@@ -649,7 +649,7 @@ static bool setCalibrate(void) {
if (userConfirmation(translatedString(Tr->SettingsCalibrationWarning))) {
// User confirmed
// So we now set the tick
setSettingValue(SettingsOptions::CalibrateCJC, 1);
setSettingValue(SettingsOptions::CalibrateCJC, 1);
}
} else {
setSettingValue(SettingsOptions::CalibrateCJC, 0);
@@ -667,9 +667,9 @@ static bool setCalibrateVIN(void) {
OLED::setCursor(0, 0);
uint16_t voltage = getInputVoltageX10(getSettingValue(SettingsOptions::VoltageDiv), 0);
OLED::printNumber(voltage / 10, 2, FontStyle::LARGE);
OLED::print(SymbolDot, FontStyle::LARGE);
OLED::print(LargeSymbolDot, FontStyle::LARGE);
OLED::printNumber(voltage % 10, 1, FontStyle::LARGE, false);
OLED::print(SymbolVolts, FontStyle::LARGE);
OLED::print(LargeSymbolVolts, FontStyle::LARGE);
switch (getButtonState()) {
case BUTTON_F_SHORT:
@@ -705,7 +705,7 @@ static void displayPowerPulse(void) {
if (getSettingValue(SettingsOptions::KeepAwakePulse)) {
OLED::printNumber(getSettingValue(SettingsOptions::KeepAwakePulse) / 10, 1, FontStyle::LARGE);
OLED::print(SymbolDot, FontStyle::LARGE);
OLED::print(LargeSymbolDot, FontStyle::LARGE);
OLED::printNumber(getSettingValue(SettingsOptions::KeepAwakePulse) % 10, 1, FontStyle::LARGE);
} else {
OLED::print(translatedString(Tr->OffString), FontStyle::LARGE);

View File

@@ -19,9 +19,9 @@ void performCJCC(void) {
OLED::setCursor(0, 0);
OLED::print(translatedString(Tr->CJCCalibrating), FontStyle::SMALL);
OLED::setCursor(0, 8);
OLED::print(SymbolDot, FontStyle::SMALL);
OLED::print(SmallSymbolDot, FontStyle::SMALL);
for (uint8_t x = 0; x < (i / 4); x++)
OLED::print(SymbolDot, FontStyle::SMALL);
OLED::print(SmallSymbolDot, FontStyle::SMALL);
OLED::refresh();
osDelay(100);
}

View File

@@ -7,10 +7,10 @@ void showDebugMenu(void) {
uint8_t screen = 0;
ButtonState b;
for (;;) {
OLED::clearScreen(); // Ensure the buffer starts clean
OLED::setCursor(0, 0); // Position the cursor at the 0,0 (top left)
OLED::print(SymbolVersionNumber, FontStyle::SMALL); // Print version number
OLED::setCursor(0, 8); // second line
OLED::clearScreen(); // Ensure the buffer starts clean
OLED::setCursor(0, 0); // Position the cursor at the 0,0 (top left)
OLED::print(SmallSymbolVersionNumber, FontStyle::SMALL); // Print version number
OLED::setCursor(0, 8); // second line
OLED::print(DebugMenu[screen], FontStyle::SMALL);
switch (screen) {
case 0: // Build Date
@@ -74,7 +74,7 @@ void showDebugMenu(void) {
break;
case 6: // Handle Temp in °C
OLED::printNumber(getHandleTemperature(0) / 10, 6, FontStyle::SMALL);
OLED::print(SymbolDot, FontStyle::SMALL);
OLED::print(SmallSymbolDot, FontStyle::SMALL);
OLED::printNumber(getHandleTemperature(0) % 10, 1, FontStyle::SMALL);
break;
case 7: // Max Temp Limit in °C
@@ -88,7 +88,7 @@ void showDebugMenu(void) {
break;
case 10: // Tip Resistance in Ω
OLED::printNumber(getTipResistanceX10() / 10, 6, FontStyle::SMALL); // large to pad over so that we cover ID left overs
OLED::print(SymbolDot, FontStyle::SMALL);
OLED::print(SmallSymbolDot, FontStyle::SMALL);
OLED::printNumber(getTipResistanceX10() % 10, 1, FontStyle::SMALL);
break;
case 11: // Raw Tip in µV

View File

@@ -118,14 +118,14 @@ void drawHomeScreen(bool buttonLockout) {
}
uint32_t Vlt = getInputVoltageX10(getSettingValue(SettingsOptions::VoltageDiv), 0);
OLED::printNumber(Vlt / 10, 2, FontStyle::LARGE);
OLED::print(SymbolDot, FontStyle::LARGE);
OLED::print(LargeSymbolDot, FontStyle::LARGE);
OLED::printNumber(Vlt % 10, 1, FontStyle::LARGE);
if (OLED::getRotation()) {
OLED::setCursor(48, 8);
} else {
OLED::setCursor(91, 8);
}
OLED::print(SymbolVolts, FontStyle::SMALL);
OLED::print(SmallSymbolVolts, FontStyle::SMALL);
} else {
if (!(getSettingValue(SettingsOptions::CoolingTempBlink) && (tipTemp > 55) && (xTaskGetTickCount() % 1000 < 300)))
// Blink temp if setting enable and temp < 55°
@@ -139,16 +139,16 @@ void drawHomeScreen(bool buttonLockout) {
}
OLED::printNumber(getSettingValue(SettingsOptions::SolderingTemp), 3, FontStyle::SMALL); // draw set temp
if (getSettingValue(SettingsOptions::TemperatureInF))
OLED::print(SymbolDegF, FontStyle::SMALL);
OLED::print(SmallSymbolDegF, FontStyle::SMALL);
else
OLED::print(SymbolDegC, FontStyle::SMALL);
OLED::print(SmallSymbolDegC, FontStyle::SMALL);
if (OLED::getRotation()) {
OLED::setCursor(0, 8);
} else {
OLED::setCursor(67, 8); // bottom right
}
printVoltage(); // draw voltage then symbol (v)
OLED::print(SymbolVolts, FontStyle::SMALL);
OLED::print(SmallSymbolVolts, FontStyle::SMALL);
}
} else {

View File

@@ -32,14 +32,14 @@ int gui_SolderingSleepingMode(bool stayOff, bool autoStarted) {
OLED::print(translatedString(Tr->SleepingTipAdvancedString), FontStyle::SMALL);
OLED::printNumber(tipTemp, 3, FontStyle::SMALL);
if (getSettingValue(SettingsOptions::TemperatureInF))
OLED::print(SymbolDegF, FontStyle::SMALL);
OLED::print(SmallSymbolDegF, FontStyle::SMALL);
else {
OLED::print(SymbolDegC, FontStyle::SMALL);
OLED::print(SmallSymbolDegC, FontStyle::SMALL);
}
OLED::print(SymbolSpace, FontStyle::SMALL);
OLED::print(SmallSymbolSpace, FontStyle::SMALL);
printVoltage();
OLED::print(SymbolVolts, FontStyle::SMALL);
OLED::print(SmallSymbolVolts, FontStyle::SMALL);
} else {
OLED::print(translatedString(Tr->SleepingSimpleString), FontStyle::LARGE);
OLED::printNumber(tipTemp, 3, FontStyle::LARGE);

View File

@@ -119,7 +119,7 @@ void gui_solderingMode(uint8_t jumpToSleep) {
} else {
OLED::setCursor(55, 8);
}
OLED::print(SymbolPlus, FontStyle::SMALL);
OLED::print(SmallSymbolPlus, FontStyle::SMALL);
}
if (OLED::getRotation()) {
@@ -128,9 +128,9 @@ void gui_solderingMode(uint8_t jumpToSleep) {
OLED::setCursor(67, 0);
}
OLED::printNumber(x10WattHistory.average() / 10, 2, FontStyle::SMALL);
OLED::print(SymbolDot, FontStyle::SMALL);
OLED::print(SmallSymbolDot, FontStyle::SMALL);
OLED::printNumber(x10WattHistory.average() % 10, 1, FontStyle::SMALL);
OLED::print(SymbolWatts, FontStyle::SMALL);
OLED::print(SmallSymbolWatts, FontStyle::SMALL);
if (OLED::getRotation()) {
OLED::setCursor(0, 8);
@@ -138,22 +138,22 @@ void gui_solderingMode(uint8_t jumpToSleep) {
OLED::setCursor(67, 8);
}
printVoltage();
OLED::print(SymbolVolts, FontStyle::SMALL);
OLED::print(SmallSymbolVolts, FontStyle::SMALL);
} else {
OLED::setCursor(0, 0);
// We switch the layout direction depending on the orientation of the oled
if (OLED::getRotation()) {
// battery
gui_drawBatteryIcon();
OLED::print(SymbolSpace, FontStyle::LARGE); // Space out gap between battery <-> temp
gui_drawTipTemp(true, FontStyle::LARGE); // Draw current tip temp
OLED::print(LargeSymbolSpace, FontStyle::LARGE); // Space out gap between battery <-> temp
gui_drawTipTemp(true, FontStyle::LARGE); // Draw current tip temp
// We draw boost arrow if boosting, or else gap temp <-> heat
// indicator
if (boostModeOn)
OLED::drawSymbol(2);
else
OLED::print(SymbolSpace, FontStyle::LARGE);
OLED::print(LargeSymbolSpace, FontStyle::LARGE);
// Draw heating/cooling symbols
OLED::drawHeatSymbol(X10WattsToPWM(x10WattHistory.average()));
@@ -165,10 +165,10 @@ void gui_solderingMode(uint8_t jumpToSleep) {
if (boostModeOn)
OLED::drawSymbol(2);
else
OLED::print(SymbolSpace, FontStyle::LARGE);
OLED::print(LargeSymbolSpace, FontStyle::LARGE);
gui_drawTipTemp(true, FontStyle::LARGE); // Draw current tip temp
OLED::print(SymbolSpace, FontStyle::LARGE); // Space out gap between battery <-> temp
OLED::print(LargeSymbolSpace, FontStyle::LARGE); // Space out gap between battery <-> temp
gui_drawBatteryIcon();
}

View File

@@ -87,23 +87,23 @@ void gui_solderingTempAdjust(void) {
return; // exit if user just doesn't press anything for a bit
if (OLED::getRotation()) {
OLED::print(getSettingValue(SettingsOptions::ReverseButtonTempChangeEnabled) ? SymbolPlus : SymbolMinus, FontStyle::LARGE);
OLED::print(getSettingValue(SettingsOptions::ReverseButtonTempChangeEnabled) ? LargeSymbolPlus : LargeSymbolMinus, FontStyle::LARGE);
} else {
OLED::print(getSettingValue(SettingsOptions::ReverseButtonTempChangeEnabled) ? SymbolMinus : SymbolPlus, FontStyle::LARGE);
OLED::print(getSettingValue(SettingsOptions::ReverseButtonTempChangeEnabled) ? LargeSymbolMinus : LargeSymbolPlus, FontStyle::LARGE);
}
OLED::print(SymbolSpace, FontStyle::LARGE);
OLED::print(LargeSymbolSpace, FontStyle::LARGE);
OLED::printNumber(getSettingValue(SettingsOptions::SolderingTemp), 3, FontStyle::LARGE);
if (getSettingValue(SettingsOptions::TemperatureInF))
OLED::drawSymbol(0);
else {
OLED::drawSymbol(1);
}
OLED::print(SymbolSpace, FontStyle::LARGE);
OLED::print(LargeSymbolSpace, FontStyle::LARGE);
if (OLED::getRotation()) {
OLED::print(getSettingValue(SettingsOptions::ReverseButtonTempChangeEnabled) ? SymbolMinus : SymbolPlus, FontStyle::LARGE);
OLED::print(getSettingValue(SettingsOptions::ReverseButtonTempChangeEnabled) ? LargeSymbolMinus : LargeSymbolPlus, FontStyle::LARGE);
} else {
OLED::print(getSettingValue(SettingsOptions::ReverseButtonTempChangeEnabled) ? SymbolPlus : SymbolMinus, FontStyle::LARGE);
OLED::print(getSettingValue(SettingsOptions::ReverseButtonTempChangeEnabled) ? LargeSymbolPlus : LargeSymbolMinus, FontStyle::LARGE);
}
OLED::refresh();
GUIDelay();

View File

@@ -8,23 +8,23 @@ void showPDDebug(void) {
uint8_t screen = 0;
ButtonState b;
for (;;) {
OLED::clearScreen(); // Ensure the buffer starts clean
OLED::setCursor(0, 0); // Position the cursor at the 0,0 (top left)
OLED::print(SymbolPDDebug, FontStyle::SMALL); // Print Title
OLED::setCursor(0, 8); // second line
OLED::clearScreen(); // Ensure the buffer starts clean
OLED::setCursor(0, 0); // Position the cursor at the 0,0 (top left)
OLED::print(SmallSymbolPDDebug, FontStyle::SMALL); // Print Title
OLED::setCursor(0, 8); // second line
if (screen == 0) {
// Print the PD state machine
OLED::print(SymbolState, FontStyle::SMALL);
OLED::print(SymbolSpace, FontStyle::SMALL);
OLED::print(SmallSymbolState, FontStyle::SMALL);
OLED::print(SmallSymbolSpace, FontStyle::SMALL);
OLED::printNumber(USBPowerDelivery::getStateNumber(), 2, FontStyle::SMALL, true);
OLED::print(SymbolSpace, FontStyle::SMALL);
OLED::print(SmallSymbolSpace, FontStyle::SMALL);
// Also print vbus mod status
if (USBPowerDelivery::fusbPresent()) {
if (USBPowerDelivery::negotiationComplete() || (xTaskGetTickCount() > (TICKS_SECOND * 10))) {
if (!USBPowerDelivery::isVBUSConnected()) {
OLED::print(SymbolNoVBus, FontStyle::SMALL);
OLED::print(SmallSymbolNoVBus, FontStyle::SMALL);
} else {
OLED::print(SymbolVBus, FontStyle::SMALL);
OLED::print(SmallSymbolVBus, FontStyle::SMALL);
}
}
}
@@ -56,22 +56,22 @@ void showPDDebug(void) {
} else {
// print out this entry of the proposal
OLED::printNumber(screen, 2, FontStyle::SMALL, true); // print the entry number
OLED::print(SymbolSpace, FontStyle::SMALL);
OLED::print(SmallSymbolSpace, FontStyle::SMALL);
if (min_voltage > 0) {
OLED::printNumber(min_voltage / 1000, 2, FontStyle::SMALL, true); // print the voltage
OLED::print(SymbolMinus, FontStyle::SMALL);
OLED::print(SmallSymbolMinus, FontStyle::SMALL);
}
OLED::printNumber(voltage_mv / 1000, 2, FontStyle::SMALL, true); // print the voltage
OLED::print(SymbolVolts, FontStyle::SMALL);
OLED::print(SymbolSpace, FontStyle::SMALL);
OLED::print(SmallSymbolVolts, FontStyle::SMALL);
OLED::print(SmallSymbolSpace, FontStyle::SMALL);
if (wattage) {
OLED::printNumber(wattage, 3, FontStyle::SMALL, true); // print the current in 0.1A res
OLED::print(SymbolWatts, FontStyle::SMALL);
OLED::print(SmallSymbolWatts, FontStyle::SMALL);
} else {
OLED::printNumber(current_a_x100 / 100, 2, FontStyle::SMALL, true); // print the current in 0.1A res
OLED::print(SymbolDot, FontStyle::SMALL);
OLED::print(SmallSymbolDot, FontStyle::SMALL);
OLED::printNumber(current_a_x100 % 100, 2, FontStyle::SMALL, true); // print the current in 0.1A res
OLED::print(SymbolAmps, FontStyle::SMALL);
OLED::print(SmallSymbolAmps, FontStyle::SMALL);
}
}
} else {

View File

@@ -21,9 +21,9 @@ void gui_drawTipTemp(bool symbol, const FontStyle font) {
} else {
// Otherwise fall back to chars
if (getSettingValue(SettingsOptions::TemperatureInF))
OLED::print(SymbolDegF, FontStyle::SMALL);
OLED::print(SmallSymbolDegF, FontStyle::SMALL);
else
OLED::print(SymbolDegC, FontStyle::SMALL);
OLED::print(SmallSymbolDegC, FontStyle::SMALL);
}
}
}

View File

@@ -3,6 +3,6 @@
void printVoltage(void) {
uint32_t volt = getInputVoltageX10(getSettingValue(SettingsOptions::VoltageDiv), 0);
OLED::printNumber(volt / 10, 2, FontStyle::SMALL);
OLED::print(SymbolDot, FontStyle::SMALL);
OLED::print(SmallSymbolDot, FontStyle::SMALL);
OLED::printNumber(volt % 10, 1, FontStyle::SMALL);
}

View File

@@ -22,7 +22,7 @@ bool checkForUnderVoltage(void) {
OLED::setCursor(0, 8);
OLED::print(translatedString(Tr->InputVoltageString), FontStyle::SMALL);
printVoltage();
OLED::print(SymbolVolts, FontStyle::SMALL);
OLED::print(SmallSymbolVolts, FontStyle::SMALL);
} else {
OLED::print(translatedString(Tr->UVLOWarningString), FontStyle::LARGE);
}

View File

@@ -11,10 +11,10 @@ void printCountdownUntilSleep(int sleepThres) {
TickType_t downCount = sleepThres - xTaskGetTickCount() + lastEventTime;
if (downCount > (99 * TICKS_SECOND)) {
OLED::printNumber(downCount / 60000 + 1, 2, FontStyle::SMALL);
OLED::print(SymbolMinutes, FontStyle::SMALL);
OLED::print(SmallSymbolMinutes, FontStyle::SMALL);
} else {
OLED::printNumber(downCount / 1000 + 1, 2, FontStyle::SMALL);
OLED::print(SymbolSeconds, FontStyle::SMALL);
OLED::print(SmallSymbolSeconds, FontStyle::SMALL);
}
}
#endif

View File

@@ -606,7 +606,7 @@ $(OUT_OBJS_S): $(OUTPUT_DIR)/%.o: %.S Makefile
Core/Gen/Translation.%.cpp $(OUTPUT_DIR)/Core/Gen/translation.files/%.pickle: ../Translations/translation_%.json \
../Translations/make_translation.py \
../Translations/translations_def.js \
../Translations/translations_definitions.json \
../Translations/font_tables.py \
Makefile ../Translations/wqy-bitmapsong/wenquanyi_9pt.bdf
@test -d Core/Gen || mkdir -p Core/Gen
@@ -687,7 +687,7 @@ $(HEXFILE_DIR)/$(model)_multi_compressed_$(2).elf : \
Core/Gen/Translation_multi.$(1).cpp: $(patsubst %,../Translations/translation_%.json,$(3)) \
../Translations/make_translation.py \
../Translations/translations_def.js \
../Translations/translations_definitions.json \
../Translations/font_tables.py \
Makefile ../Translations/wqy-bitmapsong/wenquanyi_9pt.bdf
@test -d Core/Gen || mkdir -p Core/Gen

View File

@@ -22,10 +22,8 @@ OutputJSONPath = os.path.join(HexFileFolder, sys.argv[1])
TranslationsFilesPath = os.path.join(HERE.parent, "Translations")
def load_json(filename: str, skip_first_line: bool):
def load_json(filename: str):
with open(filename) as f:
if skip_first_line:
f.readline()
return json.loads(f.read())
@@ -49,7 +47,7 @@ output_files = [os.path.join(HexFileFolder, f) for f in os.listdir(HexFileFolder
parsed_languages = {}
for path in translation_files:
lang: dict = load_json(path, skip_first_line=False)
lang: dict = load_json(path)
code = lang.get("languageCode", None)
if code is not None:
parsed_languages[code] = lang