1
0
forked from me/IronOS

Merge branch 'dev' into BLE

This commit is contained in:
Ben V. Brown
2022-12-28 14:24:49 +11:00
committed by GitHub
65 changed files with 11784 additions and 11798 deletions

25
.github/workflows/weblate.yml vendored Normal file
View File

@@ -0,0 +1,25 @@
name: Weblate PR
on:
create:
branches: ["^translations$"]
jobs:
pull-request:
name: Open PR to dev
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
name: checkout
- uses: repo-sync/pull-request@v2
name: pull-request
with:
destination_branch: "dev"
pr_title: "Merging newest translations into dev" # Title of pull request
pr_body: | # Full markdown support, requires pr_title to be set
Translations automatically submitted by Weblate
_Translations from [Weblate](https://hosted.weblate.org/projects/ironos/main-firmware/)_
pr_reviewer: "ralim"
pr_draft: false
github_token: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -989,6 +989,14 @@ NAME_CYRILLIC: Final = "cyrillic"
NAME_CJK: Final = "cjk"
NAME_GREEK: Final = "greek"
ALL_FONTS = [
NAME_ASCII_BASIC,
NAME_LATIN_EXTENDED,
NAME_CYRILLIC,
NAME_GREEK,
NAME_CJK, # CJK must come last
]
def get_font_maps_for_name(
font_name: str,

View File

@@ -356,16 +356,11 @@ class FontMapsPerFont:
sym_lists: Dict[str, List[str]]
def get_font_map_per_font(text_list: List[str], fonts: List[str]) -> FontMapsPerFont:
def get_font_map_per_font(text_list: List[str]) -> FontMapsPerFont:
pending_sym_set = set(text_list)
if len(pending_sym_set) != len(text_list):
raise ValueError("`text_list` contains duplicated symbols")
if fonts[0] != font_tables.NAME_ASCII_BASIC:
raise ValueError(
f'First item in `fonts` must be "{font_tables.NAME_ASCII_BASIC}"'
)
total_symbol_count = len(text_list)
# \x00 is for NULL termination and \x01 is for newline, so the maximum
# number of symbols allowed is as follow (see also the comments in
@@ -381,7 +376,7 @@ def get_font_map_per_font(text_list: List[str], fonts: List[str]) -> FontMapsPer
font12_maps: Dict[str, Dict[str, bytes]] = {}
font06_maps: Dict[str, Dict[str, Optional[bytes]]] = {}
sym_lists: Dict[str, List[str]] = {}
for font in fonts:
for font in font_tables.ALL_FONTS:
font12_maps[font] = {}
font12_map = font12_maps[font]
font06_maps[font] = {}
@@ -389,12 +384,6 @@ def get_font_map_per_font(text_list: List[str], fonts: List[str]) -> FontMapsPer
sym_lists[font] = []
sym_list = sym_lists[font]
if len(pending_sym_set) == 0:
logging.warning(
f"Font {font} not used because all symbols already have font bitmaps"
)
continue
if font == font_tables.NAME_CJK:
is_cjk = True
else:
@@ -422,10 +411,8 @@ def get_font_map_per_font(text_list: List[str], fonts: List[str]) -> FontMapsPer
sym_list.append(sym)
pending_sym_set.remove(sym)
if len(sym_list) == 0:
logging.warning(f"Font {font} not used by any symbols on the list")
if len(pending_sym_set) > 0:
raise KeyError(f"Symbols not found in specified fonts: {pending_sym_set}")
raise KeyError(f"Symbols not found in our fonts: {pending_sym_set}")
return FontMapsPerFont(font12_maps, font06_maps, sym_lists)
@@ -453,16 +440,16 @@ def get_forced_first_symbols() -> List[str]:
def get_sym_list_and_font_map(
text_list: List[str], fonts: List[str]
text_list: List[str],
) -> Tuple[List[str], Dict[str, List[str]], FontMap]:
font_maps = get_font_map_per_font(text_list, fonts)
font_maps = get_font_map_per_font(text_list)
font12_maps = font_maps.font12_maps
font06_maps = font_maps.font06_maps
# Build the full font maps
font12_map = {}
font06_map = {}
for font in fonts:
for font in font_tables.ALL_FONTS:
font12_map.update(font12_maps[font])
font06_map.update(font06_maps[font])
@@ -588,7 +575,6 @@ def prepare_language(lang: dict, defs: dict, build_version: str) -> LanguageData
# Iterate over all of the text to build up the symbols & counts
text_list, _ = get_letter_counts(defs, lang, build_version)
# From the letter counts, need to make a symbol translator & write out the font
fonts = lang["fonts"]
forced_first_symbols = get_forced_first_symbols()
@@ -597,7 +583,7 @@ def prepare_language(lang: dict, defs: dict, build_version: str) -> LanguageData
x for x in text_list if x not in forced_first_symbols
]
sym_list, sym_lists_by_font, font_map = get_sym_list_and_font_map(text_list, fonts)
sym_list, sym_lists_by_font, font_map = get_sym_list_and_font_map(text_list)
return LanguageData(
[lang], defs, build_version, sym_list, sym_lists_by_font, font_map
)
@@ -611,13 +597,6 @@ def prepare_languages(
forced_first_symbols = get_forced_first_symbols()
all_fonts = [
font_tables.NAME_ASCII_BASIC,
font_tables.NAME_LATIN_EXTENDED,
font_tables.NAME_CYRILLIC,
font_tables.NAME_CJK,
]
# Build the full font maps
font12_map = {}
font06_map = {}
@@ -625,12 +604,11 @@ def prepare_languages(
total_sym_counts: Dict[str, Dict[str, int]] = {}
for lang in langs:
text_list, sym_counts = get_letter_counts(defs, lang, build_version)
fonts = lang["fonts"]
text_list = forced_first_symbols + [
x for x in text_list if x not in forced_first_symbols
]
font_maps = get_font_map_per_font(text_list, fonts)
for font in fonts:
font_maps = get_font_map_per_font(text_list)
for font in font_tables.ALL_FONTS:
font12_map.update(font_maps.font12_maps[font])
font06_map.update(font_maps.font06_maps[font])
for font, font_sym_list in font_maps.sym_lists.items():
@@ -643,7 +621,7 @@ def prepare_languages(
sym_lists_by_font: Dict[str, List[str]] = {}
combined_sym_list = []
for font in all_fonts:
for font in font_tables.ALL_FONTS:
if font not in total_sym_counts:
continue
# swap to Big -> little sort order
@@ -874,6 +852,9 @@ def write_languages(
"const FontSectionDataInfo FontSectionDataInfos[] = {\n"
)
for font, current_sym_list in sym_lists_by_font.items():
print(font, current_sym_list)
if len(current_sym_list) == 0:
continue
current_sym_start = combined_sym_list.index(current_sym_list[0]) + 2
font_uncompressed = bytearray()
for sym in current_sym_list:

View File

@@ -1,11 +1,6 @@
{
"languageCode": "BE",
"languageLocalName": "Беларуская",
"fonts": [
"ascii_basic",
"latin_extended",
"cyrillic"
],
"tempUnitFahrenheit": false,
"messages": {
"SettingsCalibrationWarning": "Пераканайцеся, што пры наступнай загрузцы наканечнік і ручка маюць пакаёвую тэмпературу!",

View File

@@ -1,10 +1,6 @@
{
"languageCode": "BG",
"languageLocalName": "Български",
"fonts": [
"ascii_basic",
"cyrillic"
],
"tempUnitFahrenheit": false,
"messages": {
"SettingsCalibrationWarning": "Before rebooting, make sure tip & handle are at room temperature!",

View File

@@ -1,10 +1,6 @@
{
"languageCode": "CS",
"languageLocalName": "Český",
"fonts": [
"ascii_basic",
"latin_extended"
],
"tempUnitFahrenheit": false,
"messages": {
"SettingsCalibrationWarning": "Before rebooting, make sure tip & handle are at room temperature!",

View File

@@ -1,10 +1,6 @@
{
"languageCode": "DA",
"languageLocalName": "Dansk",
"fonts": [
"ascii_basic",
"latin_extended"
],
"tempUnitFahrenheit": false,
"messages": {
"SettingsCalibrationWarning": "Before rebooting, make sure tip & handle are at room temperature!",

View File

@@ -1,10 +1,6 @@
{
"languageCode": "DE",
"languageLocalName": "Deutsch",
"fonts": [
"ascii_basic",
"latin_extended"
],
"tempUnitFahrenheit": false,
"messages": {
"SettingsCalibrationWarning": "Vor dem Neustart bitte sicherstellen, dass Lötspitze & Gerät Raumtemperatur haben!",

View File

@@ -1,10 +1,6 @@
{
"languageCode": "EL",
"languageLocalName": "Greek",
"fonts": [
"ascii_basic",
"greek"
],
"tempUnitFahrenheit": true,
"messages": {
"SettingsCalibrationWarning": "Before rebooting, make sure tip & handle are at room temperature!",

View File

@@ -1,10 +1,6 @@
{
"languageCode": "EN",
"languageLocalName": "English",
"fonts": [
"ascii_basic",
"latin_extended"
],
"tempUnitFahrenheit": true,
"messages": {
"SettingsCalibrationWarning": "Before rebooting, make sure tip & handle are at room temperature!",
@@ -27,7 +23,7 @@
"ResetOKMessage": "Reset OK",
"SettingsResetMessage": [
"Certain settings",
"were changed!"
"changed!"
],
"NoAccelerometerMessage": [
"No accelerometer",
@@ -71,35 +67,35 @@
"Power",
"settings"
],
"desc": ""
"desc": "Settings for Power Supply (Batteries, Quick Charge, PD etc)"
},
"SolderingMenu": {
"text2": [
"Soldering",
"settings"
],
"desc": ""
"desc": "Soldering settings, boost modes; how the iron operates"
},
"PowerSavingMenu": {
"text2": [
"Sleep",
"mode"
],
"desc": ""
"desc": "Sleep modes; methods we use to save power on the device by shutting down"
},
"UIMenu": {
"text2": [
"User",
"interface"
],
"desc": ""
"desc": "User interactions (how it looks, animations, units etc)"
},
"AdvancedMenu": {
"text2": [
"Advanced",
"settings"
],
"desc": ""
"desc": "Advanced or Misc options."
}
},
"menuOptions": {
@@ -339,7 +335,7 @@
"Language:",
" EN English"
],
"desc": ""
"desc": "Toggle active language"
}
}
}

View File

@@ -1,10 +1,6 @@
{
"languageCode": "ES",
"languageLocalName": "Castellano",
"fonts": [
"ascii_basic",
"latin_extended"
],
"tempUnitFahrenheit": false,
"messages": {
"SettingsCalibrationWarning": "Before rebooting, make sure tip & handle are at room temperature!",

View File

@@ -1,10 +1,6 @@
{
"languageCode": "FI",
"languageLocalName": "Suomi",
"fonts": [
"ascii_basic",
"latin_extended"
],
"tempUnitFahrenheit": false,
"messages": {
"SettingsCalibrationWarning": "Before rebooting, make sure tip & handle are at room temperature!",

View File

@@ -1,10 +1,6 @@
{
"languageCode": "FR",
"languageLocalName": "Français",
"fonts": [
"ascii_basic",
"latin_extended"
],
"tempUnitFahrenheit": false,
"messages": {
"SettingsCalibrationWarning": "Before rebooting, make sure tip & handle are at room temperature!",

View File

@@ -1,105 +1,101 @@
{
"languageCode": "HR",
"languageLocalName": "Hrvatski",
"fonts": [
"ascii_basic",
"latin_extended"
],
"tempUnitFahrenheit": false,
"messages": {
"SettingsCalibrationWarning": "Before rebooting, make sure tip & handle are at room temperature!",
"CJCCalibrating": "calibrating",
"SettingsCalibrationWarning": "Prije restarta provjerite da su vrh i ručka na sobnoj temperaturi!",
"CJCCalibrating": "kalibriram",
"SettingsResetWarning": "Jeste li sigurni da želite sve postavke vratiti na tvorničke vrijednosti?",
"UVLOWarningString": "BATERIJA",
"UVLOWarningString": "BAT!!!",
"UndervoltageString": "PRENIZAK NAPON",
"InputVoltageString": "Napajanje: ",
"InputVoltageString": "Napon V: ",
"SleepingSimpleString": "Zzz ",
"SleepingAdvancedString": "SPAVANJE...",
"SleepingAdvancedString": "SPAVAM...",
"SleepingTipAdvancedString": "Vrh: ",
"OffString": "Off",
"DeviceFailedValidationWarning": "Your device is most likely a counterfeit!"
"DeviceFailedValidationWarning": "Vaš uređaj je najvjerojatnije krivotvoren!"
},
"messagesWarn": {
"CJCCalibrationDone": [
"Calibration",
"done!"
"Kalibracija",
"dovršena!"
],
"ResetOKMessage": "Reset OK",
"SettingsResetMessage": [
"Certain settings",
"were changed!"
"Neke postavke",
"su izmijenjene!"
],
"NoAccelerometerMessage": [
"No accelerometer",
"detected!"
"Akcelerometar",
"nije pronađen!"
],
"NoPowerDeliveryMessage": [
"No USB-PD IC",
"detected!"
"USB-PD IC",
"nije pronađen!"
],
"LockingKeysString": "LOCKED",
"UnlockingKeysString": "UNLOCKED",
"WarningKeysLockedString": "!LOCKED!",
"LockingKeysString": "ZAKLJUČ",
"UnlockingKeysString": "OTKLJUČ",
"WarningKeysLockedString": "ZAKLJUČ!",
"WarningThermalRunaway": [
"Thermal",
"Runaway"
"Neispravan",
"grijač"
]
},
"characters": {
"SettingRightChar": "D",
"SettingLeftChar": "L",
"SettingAutoChar": "A",
"SettingOffChar": "O",
"SettingOffChar": "U",
"SettingSlowChar": "S",
"SettingMediumChar": "M",
"SettingFastChar": "B",
"SettingStartNoneChar": "I",
"SettingStartNoneChar": "U",
"SettingStartSolderingChar": "L",
"SettingStartSleepChar": "R",
"SettingStartSleepOffChar": "S",
"SettingSensitivityOff": "O",
"SettingSensitivityLow": "L",
"SettingSensitivityMedium": "M",
"SettingSensitivityHigh": "H",
"SettingLockDisableChar": "D",
"SettingStartSleepChar": "T",
"SettingStartSleepOffChar": "H",
"SettingSensitivityOff": "U",
"SettingSensitivityLow": "N",
"SettingSensitivityMedium": "S",
"SettingSensitivityHigh": "V",
"SettingLockDisableChar": "O",
"SettingLockBoostChar": "B",
"SettingLockFullChar": "F"
"SettingLockFullChar": "Z"
},
"menuGroups": {
"PowerMenu": {
"text2": [
"Power",
"settings"
"Postavke",
"napajanja"
],
"desc": ""
"desc": "Postavke napajanja (baterije, punjač, USB-PD itd.)"
},
"SolderingMenu": {
"text2": [
"Postavke",
"lemljenja"
],
"desc": ""
"desc": "Postavke lemljenja, pojačani način, kako se lemilica ponaša"
},
"PowerSavingMenu": {
"text2": [
"Ušteda",
"energije"
],
"desc": ""
"desc": "Spavanje, načini uštede energije gašenjem uređaja"
},
"UIMenu": {
"text2": [
"Korisničko",
"sučelje"
],
"desc": ""
"desc": "Interakcija s korisnikom (izgled, animacije, jedinice itd.)"
},
"AdvancedMenu": {
"text2": [
"Napredne",
"opcije"
],
"desc": ""
"desc": "Napredne i ostale opcije"
}
},
"menuOptions": {
@@ -112,10 +108,10 @@
},
"MinVolCell": {
"text2": [
"Minimum",
"voltage"
"Najniži",
"napon"
],
"desc": "Minimum allowed voltage per battery cell (3S: 3 - 3.7V | 4-6S: 2.4 - 3.7V)"
"desc": "Najniži dozvoljeni napon po ćeliji baterije (3S: 3 - 3.7V | 4-6S: 2.4 - 3.7V)"
},
"QCMaxVoltage": {
"text2": [
@@ -126,10 +122,10 @@
},
"PDNegTimeout": {
"text2": [
"PD",
"USB-PD",
"timeout"
],
"desc": "PD negotiation timeout in 100ms steps for compatibility with some QC chargers"
"desc": "Timeout za USB-Power Delivery u koracima od 100ms za kompatibilnost s nekim QC punjačima"
},
"BoostTemperature": {
"text2": [
@@ -143,42 +139,42 @@
"Auto",
"start"
],
"desc": "Ako je aktivno, lemilica po uključivanju napajanja odmah počinje grijati. (I=isključeno | L=lemljenje | R=rezervni | S=rezervni sobna temperatura)"
"desc": "Ako je aktivno, lemilica po uključivanju napajanja odmah počinje grijati. (U=ugašeno | L=lemljenje | T=spavanje toplo | H=spavanje hladno)"
},
"TempChangeShortStep": {
"text2": [
"Temp change",
"short"
"Korak temp",
"kratki pritisak"
],
"desc": "Temperature-change-increment on short button press"
"desc": "Korak temperature pri kratkom pritisku tipke"
},
"TempChangeLongStep": {
"text2": [
"Temp change",
"long"
"Korak temp",
"dugi pritisak"
],
"desc": "Temperature-change-increment on long button press"
"desc": "Korak temperature pri dugačkom pritisku tipke"
},
"LockingMode": {
"text2": [
"Allow locking",
"buttons"
"Zaključavanje",
"tipki"
],
"desc": "While soldering, hold down both buttons to toggle locking them (D=disable | B=boost mode only | F=full locking)"
"desc": "Tokom lemljenja, držite obje tipke kako biste ih zaključali ili otključali (O=otključano | B=zaključan boost | Z=zaključano sve)"
},
"MotionSensitivity": {
"text2": [
"Osjetljivost",
"pokreta"
],
"desc": "Osjetljivost prepoznavanja pokreta. (0=Ugašeno | 1=Najmanje osjetljivo | ... | 9=Najosjetljivije)"
"desc": "Osjetljivost prepoznavanja pokreta. (0=ugašeno | 1=najmanje osjetljivo | ... | 9=najosjetljivije)"
},
"SleepTemperature": {
"text2": [
"Temp",
"spavanja"
],
"desc": "Temperatura na koju se spušta lemilica nakon određenog vremena mirovanja. (C | F)"
"desc": "Temperatura na koju se spušta lemilica nakon određenog vremena mirovanja (C | F)"
},
"SleepTimeout": {
"text2": [
@@ -192,154 +188,157 @@
"Vrijeme",
"gašenja"
],
"desc": "Vrijeme mirovanja nakon kojega će se lemilica ugasiti. (Minute)"
"desc": "Vrijeme mirovanja nakon kojega će se lemilica ugasiti (Minute)"
},
"HallEffSensitivity": {
"text2": [
"Hall sensor",
"sensitivity"
"Osjetljivost",
"Hall senzora"
],
"desc": "Sensitivity of the Hall effect sensor to detect sleep (0=Ugašeno | 1=Najmanje osjetljivo | ... | 9=Najosjetljivije)"
"desc": "Osjetljivost senzora magnetskog polja za detekciju spavanja (U=Ugašeno | N=Najmanja | S=Srednja | V=Visoka)"
},
"TemperatureUnit": {
"text2": [
"Jedinica",
"temperature"
],
"desc": "Jedinica temperature. (C=Celzij | F=Fahrenheit)"
"desc": "Jedinica temperature (C=Celzij | F=Fahrenheit)"
},
"DisplayRotation": {
"text2": [
"Rotacija",
"ekrana"
],
"desc": "Orijentacija ekrana. (D=Desnoruki | L=Ljevoruki | A=Automatski)"
"desc": "Orijentacija ekrana (D=desnoruki | L=ljevoruki | A=automatski)"
},
"CooldownBlink": {
"text2": [
"Upozorenje",
"pri hlađenju"
],
"desc": "Bljeskanje temperature prilikom hlađenja, ako je lemilica vruća."
"desc": "Bljeskanje temperature prilikom hlađenja, ako je lemilica vruća"
},
"ScrollingSpeed": {
"text2": [
"Brzina",
"poruka"
],
"desc": "Brzina kretanja dugačkih poruka. (B=brzo | S=sporo)"
"desc": "Brzina kretanja dugačkih poruka (B=brzo | S=sporo)"
},
"ReverseButtonTempChange": {
"text2": [
"Swap",
"+ - keys"
"Zamjena",
"+ - tipki"
],
"desc": "Reverse assignment of buttons for temperature adjustment"
"desc": "Zamjenjuje funkciju gornje i donje tipke za podešavanje temperature"
},
"AnimSpeed": {
"text2": [
"Anim.",
"speed"
"Brzina",
"animacije"
],
"desc": "Pace of icon animations in menu (O=off | S=slow | M=medium | B=fast)"
"desc": "Brzina animacije ikona u menijima (U=ugašeno | S=sporo | M=srednje | B=brzo)"
},
"AnimLoop": {
"text2": [
"Anim.",
"loop"
"Ponavljanje",
"animacije"
],
"desc": "Loop icon animations in main menu"
"desc": "Hoće li se animacije menija vrtiti u petlji - samo ako brzina animacije nije na \"Ugašeno\""
},
"Brightness": {
"text2": [
"Screen",
"brightness"
"Svjetlina",
"ekrana"
],
"desc": "Adjust the OLED screen brightness"
"desc": "Podešavanje svjetline OLED ekrana. Veća svjetlina može dugotrajno dovesti do pojave duhova na ekranu."
},
"ColourInversion": {
"text2": [
"Invert",
"screen"
"Inverzija",
"ekrana"
],
"desc": "Invert the OLED screen colors"
"desc": "Inverzan prikaz slike na ekranu"
},
"LOGOTime": {
"text2": [
"Boot logo",
"duration"
"Trajanje",
"boot logotipa"
],
"desc": "Set boot logo duration (s=seconds)"
"desc": "Trajanje prikaza boot logotipa (s=seconds)"
},
"AdvancedIdle": {
"text2": [
"Detalji",
"pri čekanju"
],
"desc": "Prikazivanje detaljnih informacija tijekom čekanja."
"desc": "Prikazivanje detaljnih informacija tijekom čekanja"
},
"AdvancedSoldering": {
"text2": [
"Detalji",
"pri lemljenju"
],
"desc": "Prikazivanje detaljnih informacija tijekom lemljenja."
"desc": "Prikazivanje detaljnih informacija tijekom lemljenja"
},
"PowerLimit": {
"text2": [
"Power",
"limit"
"Ograničenje",
"snage"
],
"desc": "Maximum power the iron can use (W=watt)"
"desc": "Najveća snaga koju lemilica smije vući iz napajanja (W=watt)"
},
"CalibrateCJC": {
"text2": [
"Calibrate CJC",
"at next boot"
"Kalibracija kod",
"sljed. starta"
],
"desc": "At next boot tip Cold Junction Compensation will be calibrated (not required if Delta T is < 5°C)"
"desc": "Kod sljedećeg starta izvršit će se kalibracija (nije potrebno ako je pogreška manja od 5°C)"
},
"VoltageCalibration": {
"text2": [
"Kalibracija",
"napona napajanja"
"napajanja"
],
"desc": "Kalibracija ulaznog napona. Podešavanje gumbima, dugački pritisak za kraj."
"desc": "Kalibracija ulaznog napona napajanja (Podešavanje tipkama, dugački pritisak za kraj)"
},
"PowerPulsePower": {
"text2": [
"Power",
"pulse"
"Snaga period.",
"pulsa napajanja"
],
"desc": "Intensity of power of keep-awake-pulse (W=watt)"
"desc": "Intenzitet periodičkog pulsa kojega lemilica povlači kako se USB napajanje ne bi ugasilo (W=watt)"
},
"PowerPulseWait": {
"text2": [
"Power pulse",
"delay"
"Interval per.",
"pulsa nap."
],
"desc": "Delay before keep-awake-pulse is triggered (x 2.5s)"
"desc": "Razmak periodičkih pulseva koje lemilica povlači kako se USB napajanje ne bi ugasilo (x 2.5s)"
},
"PowerPulseDuration": {
"text2": [
"Power pulse",
"duration"
"Trajanje per.",
"pulsa nap."
],
"desc": "Keep-awake-pulse duration (x 250ms)"
"desc": "Trajanje periodičkog pulsa kojega lemilica povlači kako se USB napajanje ne bi ugasilo (x 250ms)"
},
"SettingsReset": {
"text2": [
"Tvorničke",
"postavke"
],
"desc": "Vraćanje svih postavki na tvorničke vrijednosti."
"desc": "Vraćanje svih postavki na tvorničke vrijednosti"
},
"LanguageSwitch": {
"text2": [
"Jezik:",
" HR Hrvatski"
],
"desc": ""
}
"desc": "Promjena jezika"
}
},
"fonts": [
"ascii_basic"
]
}

View File

@@ -1,28 +1,24 @@
{
"languageCode": "HU",
"languageLocalName": "Magyar",
"fonts": [
"ascii_basic",
"latin_extended"
],
"tempUnitFahrenheit": false,
"messages": {
"SettingsCalibrationWarning": "Before rebooting, make sure tip & handle are at room temperature!",
"CJCCalibrating": "calibrating",
"SettingsCalibrationWarning": "Újraindítás előtt a hegy és az eszköz legyen szobahőmérsékletű!",
"CJCCalibrating": "Kalibrálás",
"SettingsResetWarning": "Biztos visszaállítja a beállításokat alapértékekre?",
"UVLOWarningString": "DC TÚL KEVÉS",
"UVLOWarningString": "DC túl alacsony",
"UndervoltageString": "Alulfeszültség",
"InputVoltageString": "Bemenet V: ",
"SleepingSimpleString": "Zzzz",
"SleepingAdvancedString": "Alvás...",
"SleepingTipAdvancedString": "Hegy:",
"OffString": "Ki",
"DeviceFailedValidationWarning": "Your device is most likely a counterfeit!"
"DeviceFailedValidationWarning": "Az eszköz valószínűleg nem eredeti!"
},
"messagesWarn": {
"CJCCalibrationDone": [
"Calibration",
"done!"
"Kalibráció",
"kész!"
],
"ResetOKMessage": "Törlés OK",
"SettingsResetMessage": [
@@ -267,9 +263,9 @@
"LOGOTime": {
"text2": [
"Boot logo",
"duration"
"megjelenítés"
],
"desc": "Set boot logo duration (s=seconds)"
"desc": "Boot logo megjelenítési idejének beállítása (s=seconds)"
},
"AdvancedIdle": {
"text2": [
@@ -295,9 +291,9 @@
"CalibrateCJC": {
"text2": [
"Calibrate CJC",
"at next boot"
"köv. indításnál"
],
"desc": "At next boot tip Cold Junction Compensation will be calibrated (not required if Delta T is < 5°C)"
"desc": "Következő indításnál a hegy Cold Junction Compensation kalibrálása (nem szükséges ha Delta T kisebb mint 5°C)"
},
"VoltageCalibration": {
"text2": [

View File

@@ -1,15 +1,11 @@
{
"languageCode": "IT",
"languageLocalName": "Italiano",
"fonts": [
"ascii_basic",
"latin_extended"
],
"tempUnitFahrenheit": false,
"messages": {
"SettingsCalibrationWarning": "Before rebooting, make sure tip & handle are at room temperature!",
"CJCCalibrating": "calibrating",
"SettingsResetWarning": "Ripristinare le impostazioni iniziali?",
"SettingsCalibrationWarning": "Prima di riavviare assicurati che punta e impugnatura siano a temperatura ambiente!",
"CJCCalibrating": "Calibrazione in corso",
"SettingsResetWarning": "Ripristinare le impostazioni di default?",
"UVLOWarningString": "DC BASSA",
"UndervoltageString": "DC INSUFFICIENTE",
"InputVoltageString": "V in:",
@@ -17,12 +13,12 @@
"SleepingAdvancedString": "Riposo",
"SleepingTipAdvancedString": "Punta:",
"OffString": "OFF",
"DeviceFailedValidationWarning": "Il dispositivo in uso è molto probabilmente una contraffazione!"
"DeviceFailedValidationWarning": "È probabile che questo dispositivo sia contraffatto!"
},
"messagesWarn": {
"CJCCalibrationDone": [
"Calibration",
"done!"
"Calibrazione",
"completata!"
],
"ResetOKMessage": "Reset OK",
"SettingsResetMessage": [
@@ -119,10 +115,10 @@
},
"QCMaxVoltage": {
"text2": [
"Voltaggio",
"Tensione",
"QC"
],
"desc": "Imposta il massimo voltaggio negoziabile con un alimentatore Quick Charge [volt]"
"desc": "Imposta la tensione massima negoziabile con un alimentatore Quick Charge [volt]"
},
"PDNegTimeout": {
"text2": [
@@ -297,7 +293,7 @@
"Calibra T",
"all'avvio"
],
"desc": "At next boot tip Cold Junction Compensation will be calibrated (not required if Delta T is < 5°C)"
"desc": "Calibra le rilevazioni di temperatura al prossimo riavvio (non necessario se il Delta T<5 °C)"
},
"VoltageCalibration": {
"text2": [
@@ -332,7 +328,7 @@
"Ripristino",
"impostazioni"
],
"desc": "Ripristina le impostazioni allo stato iniziale"
"desc": "Ripristina le impostazioni di default"
},
"LanguageSwitch": {
"text2": [

View File

@@ -1,10 +1,6 @@
{
"languageCode": "JA_JP",
"languageLocalName": "日本語",
"fonts": [
"ascii_basic",
"cjk"
],
"tempUnitFahrenheit": true,
"messages": {
"SettingsCalibrationWarning": "Before rebooting, make sure tip & handle are at room temperature!",

View File

@@ -1,10 +1,6 @@
{
"languageCode": "LT",
"languageLocalName": "Lietuvių",
"fonts": [
"ascii_basic",
"latin_extended"
],
"tempUnitFahrenheit": false,
"messages": {
"SettingsCalibrationWarning": "Before rebooting, make sure tip & handle are at room temperature!",

View File

@@ -1,10 +1,6 @@
{
"languageCode": "NB",
"languageLocalName": "Norsk bokmål",
"fonts": [
"ascii_basic",
"latin_extended"
],
"tempUnitFahrenheit": false,
"messages": {
"SettingsCalibrationWarning": "Before rebooting, make sure tip & handle are at room temperature!",

View File

@@ -1,10 +1,6 @@
{
"languageCode": "NL",
"languageLocalName": "Nederlands",
"fonts": [
"ascii_basic",
"latin_extended"
],
"tempUnitFahrenheit": false,
"messages": {
"SettingsCalibrationWarning": "Before rebooting, make sure tip & handle are at room temperature!",

View File

@@ -1,10 +1,6 @@
{
"languageCode": "NL_BE",
"languageLocalName": "Vlaams",
"fonts": [
"ascii_basic",
"latin_extended"
],
"tempUnitFahrenheit": false,
"messages": {
"SettingsCalibrationWarning": "Before rebooting, make sure tip & handle are at room temperature!",

View File

@@ -1,10 +1,6 @@
{
"languageCode": "PL",
"languageLocalName": "Polski",
"fonts": [
"ascii_basic",
"latin_extended"
],
"tempUnitFahrenheit": false,
"messages": {
"SettingsCalibrationWarning": "Upewnij się, że końcówka i uchwyt mają temperaturę pokojową podczas następnego rozruchu!",

View File

@@ -1,10 +1,6 @@
{
"languageCode": "PT",
"languageLocalName": "Português",
"fonts": [
"ascii_basic",
"latin_extended"
],
"tempUnitFahrenheit": false,
"messages": {
"SettingsCalibrationWarning": "Before rebooting, make sure tip & handle are at room temperature!",

View File

@@ -1,10 +1,6 @@
{
"languageCode": "RO",
"languageLocalName": "Română",
"fonts": [
"ascii_basic",
"latin_extended"
],
"tempUnitFahrenheit": true,
"messages": {
"SettingsCalibrationWarning": "Before rebooting, make sure tip & handle are at room temperature!",

View File

@@ -1,11 +1,6 @@
{
"languageCode": "RU",
"languageLocalName": "Русский",
"fonts": [
"ascii_basic",
"latin_extended",
"cyrillic"
],
"tempUnitFahrenheit": false,
"messages": {
"SettingsCalibrationWarning": "Пожалуйста, убедитесь, что жало и корпус имеют комнатную температуру при следующей загрузке!",

View File

@@ -1,10 +1,6 @@
{
"languageCode": "SK",
"languageLocalName": "Slovenčina",
"fonts": [
"ascii_basic",
"latin_extended"
],
"tempUnitFahrenheit": false,
"messages": {
"SettingsCalibrationWarning": "Before rebooting, make sure tip & handle are at room temperature!",

View File

@@ -1,10 +1,6 @@
{
"languageCode": "SL",
"languageLocalName": "Slovenščina",
"fonts": [
"ascii_basic",
"latin_extended"
],
"tempUnitFahrenheit": false,
"messages": {
"SettingsCalibrationWarning": "Before rebooting, make sure tip & handle are at room temperature!",

View File

@@ -1,10 +1,6 @@
{
"languageCode": "SR_CYRL",
"languageLocalName": "Српски",
"fonts": [
"ascii_basic",
"cyrillic"
],
"tempUnitFahrenheit": false,
"messages": {
"SettingsCalibrationWarning": "Before rebooting, make sure tip & handle are at room temperature!",

View File

@@ -1,10 +1,6 @@
{
"languageCode": "SR_LATN",
"languageLocalName": "Srpski",
"fonts": [
"ascii_basic",
"latin_extended"
],
"tempUnitFahrenheit": false,
"messages": {
"SettingsCalibrationWarning": "Before rebooting, make sure tip & handle are at room temperature!",

View File

@@ -1,10 +1,6 @@
{
"languageCode": "SV",
"languageLocalName": "Svenska",
"fonts": [
"ascii_basic",
"latin_extended"
],
"tempUnitFahrenheit": false,
"messages": {
"SettingsCalibrationWarning": "Before rebooting, make sure tip & handle are at room temperature!",

View File

@@ -1,10 +1,6 @@
{
"languageCode": "TR",
"languageLocalName": "Türkçe",
"fonts": [
"ascii_basic",
"latin_extended"
],
"tempUnitFahrenheit": false,
"messages": {
"SettingsCalibrationWarning": "Before rebooting, make sure tip & handle are at room temperature!",

View File

@@ -1,11 +1,6 @@
{
"languageCode": "UK",
"languageLocalName": "Українська",
"fonts": [
"ascii_basic",
"latin_extended",
"cyrillic"
],
"tempUnitFahrenheit": false,
"messages": {
"SettingsCalibrationWarning": "Під час наступного завантаження переконайтеся, що жало і ручка мають кімнатну температуру!",
@@ -18,12 +13,12 @@
"SleepingAdvancedString": "Очікування...",
"SleepingTipAdvancedString": "Жало:",
"OffString": "Вимк",
"DeviceFailedValidationWarning": "Ваш пристрій, швидше за все, підробка!"
"DeviceFailedValidationWarning": "Вірогідно ваш пристрій підробний!"
},
"messagesWarn": {
"CJCCalibrationDone": [
"Calibration",
"done!"
"КХС",
"відкалібровано!"
],
"ResetOKMessage": "Скид. OK",
"SettingsResetMessage": [
@@ -298,7 +293,7 @@
"Калібрувати КХС",
"при наступному завантаженні"
],
"desc": "At next boot tip Cold Junction Compensation will be calibrated (not required if Delta T is < 5°C)"
"desc": "При наступному завантаження буде відкалібровано Компенсацію Холодного Спаю жала (непотрібне при різниці температур < 5°C)"
},
"VoltageCalibration": {
"text2": [

View File

@@ -1,10 +1,6 @@
{
"languageCode": "VI",
"languageLocalName": "Tieng Viet",
"fonts": [
"ascii_basic",
"latin_extended"
],
"tempUnitFahrenheit": false,
"messages": {
"SettingsCalibrationWarning": "Before rebooting, make sure tip & handle are at room temperature!",

View File

@@ -1,10 +1,6 @@
{
"languageCode": "YUE_HK",
"languageLocalName": "廣東話 (香港)",
"fonts": [
"ascii_basic",
"cjk"
],
"tempUnitFahrenheit": true,
"messages": {
"SettingsCalibrationWarning": "Before rebooting, make sure tip & handle are at room temperature!",

View File

@@ -1,10 +1,6 @@
{
"languageCode": "ZH_CN",
"languageLocalName": "简体中文",
"fonts": [
"ascii_basic",
"cjk"
],
"tempUnitFahrenheit": true,
"messages": {
"SettingsCalibrationWarning": "Before rebooting, make sure tip & handle are at room temperature!",

View File

@@ -1,10 +1,6 @@
{
"languageCode": "ZH_TW",
"languageLocalName": "正體中文",
"fonts": [
"ascii_basic",
"cjk"
],
"tempUnitFahrenheit": true,
"messages": {
"SettingsCalibrationWarning": "Before rebooting, make sure tip & handle are at room temperature!",

View File

@@ -10,7 +10,7 @@ var def = ///
},
{
"id": "SettingsResetWarning",
"description": "Confirmation message shown before confirming a settings reset."
"description": "Warning shown before confirming a settings reset."
},
{
"id": "UVLOWarningString",
@@ -58,9 +58,13 @@ var def = ///
"id": "CJCCalibrationDone",
"description": "Confirmation message indicating CJC calibration is complete."
},
{
"id": "ResetOKMessage",
"description": "Confirmation message shown after a successful settings-reset."
},
{
"id": "SettingsResetMessage",
"description": "Shown when the settings are reset to factory defaults either by the user or by incompatible firmware changes."
"description": "Shown after a firmware update when certain settings have been reset to factory defaults due to incompatible firmware changes."
},
{
"id": "NoAccelerometerMessage",

View File

@@ -5,6 +5,7 @@
* Author: Ralim
*/
#include "FreeRTOS.h"
#include "OperatingModeUtilities.h"
#include "settingsGUI.hpp"
#include "task.h"
#include <Buttons.hpp>

View File

@@ -93,23 +93,7 @@ const uint8_t WarningBlock24[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x30, 0x0C, 0x02, 0xF1, 0xF1, 0xF1, 0x02, 0x0C, 0x30, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xC0, 0xB0, 0x8C, 0x83, 0x80, 0x80, 0x80, 0x80, 0xB3, 0xB3, 0xB3, 0x80, 0x80, 0x80, 0x80, 0x83, 0x8C, 0xB0, 0xC0, 0x00, 0x00};
#if defined(MODEL_TS100) + defined(MODEL_Pinecil) > 0
const uint8_t buttonA[] = {
// width = 42
// height = 16
0x00, 0x00, 0x00, 0x00, 0xe0, 0x18, 0x04, 0x02, 0x02, 0x01, 0x81, 0x49, 0x31, 0x01, 0xc1, 0x25, 0x19, 0x01, 0xc1, 0x25, 0x19, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x04, 0x18, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x18, 0x20, 0x40, 0x40, 0x80, 0x89, 0x8a, 0x88, 0x94,
0x8c, 0x94, 0xae, 0x80, 0xbe, 0x8e, 0xa6, 0x8e, 0xa6, 0x8e, 0xa6, 0x8e, 0xa6, 0x8a, 0xa6, 0x8a, 0xa6, 0x8a, 0xa6, 0x8a, 0x46, 0x4a, 0x22, 0x18, 0x07, 0x00, 0x00, 0x00};
const uint8_t disconnectedTip[] = {
// width = 42
// height = 16
0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0xc0, 0x00, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xcc, 0x9c, 0x38, 0x70, 0xe0, 0xc0, 0x80, 0x20, 0x70, 0x38, 0x1c, 0xcc, 0x40,
0x80, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xc0, 0x60, 0xe0, 0x00, 0x01, 0x01, 0x01, 0x02, 0x01, 0x02, 0x05, 0x00, 0x07, 0x01, 0x04, 0x01, 0x04, 0x01,
0x04, 0x31, 0x38, 0x1c, 0x0e, 0x04, 0x01, 0x03, 0x07, 0x0e, 0x1c, 0x39, 0x30, 0x01, 0x03, 0x00, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x04, 0x09, 0x0f, 0x00};
#endif
#if defined(MODEL_Pinecilv2) >= 1
#if defined(MODEL_TS100) + defined(MODEL_Pinecil) + defined(MODEL_Pinecilv2) > 0
const uint8_t buttonA[] = {
// width = 42
// height = 16

View File

@@ -87,6 +87,7 @@ struct TranslationIndexTable {
uint16_t DeviceFailedValidationWarning;
uint16_t CJCCalibrationDone;
uint16_t ResetOKMessage;
uint16_t SettingsResetMessage;
uint16_t NoAccelerometerMessage;
uint16_t NoPowerDeliveryMessage;

View File

@@ -35,7 +35,6 @@ typedef struct {
} menuitem;
void enterSettingsMenu();
void GUIDelay();
void warnUser(const char *warning, const int timeout);
extern const menuitem rootSettingsMenu[];

View File

@@ -719,7 +719,7 @@ static void displayPowerPulseDuration(void) { OLED::printNumber(getSettingValue(
static bool setResetSettings(void) {
if (userConfirmation(translatedString(Tr->SettingsResetWarning))) {
resetSettings();
warnUser(translatedString(Tr->SettingsResetMessage), 10 * TICKS_SECOND);
warnUser(translatedString(Tr->ResetOKMessage), 10 * TICKS_SECOND);
}
return false;
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,38 @@
#include "OperatingModes.h"
void performCJCC(void) {
// Calibrate Cold Junction Compensation directly at boot, before internal components get warm.
OLED::refresh();
osDelay(50);
if (!isTipDisconnected() && abs(int(TipThermoModel::getTipInC() - getHandleTemperature(0) / 10)) < 10) {
uint16_t setoffset = 0;
// If the thermo-couple at the end of the tip, and the handle are at
// equilibrium, then the output should be zero, as there is no temperature
// differential.
while (setoffset == 0) {
uint32_t offset = 0;
for (uint8_t i = 0; i < 16; i++) {
offset += getTipRawTemp(1);
// cycle through the filter a fair bit to ensure we're stable.
OLED::clearScreen();
OLED::setCursor(0, 0);
OLED::print(translatedString(Tr->CJCCalibrating), FontStyle::SMALL);
OLED::setCursor(0, 8);
OLED::print(SymbolDot, FontStyle::SMALL);
for (uint8_t x = 0; x < (i / 4); x++)
OLED::print(SymbolDot, FontStyle::SMALL);
OLED::refresh();
osDelay(100);
}
setoffset = TipThermoModel::convertTipRawADCTouV(offset / 16, true);
}
setSettingValue(SettingsOptions::CalibrationOffset, setoffset);
OLED::clearScreen();
warnUser(translatedString(Tr->CJCCalibrationDone), 3 * TICKS_SECOND);
OLED::refresh();
// Preventing to repeat calibration at boot automatically (only one shot).
setSettingValue(SettingsOptions::CalibrateCJC, 0);
saveSettings();
}
}

View File

@@ -0,0 +1,138 @@
#include "OperatingModes.h"
extern osThreadId GUITaskHandle;
extern osThreadId MOVTaskHandle;
extern osThreadId PIDTaskHandle;
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::print(DebugMenu[screen], FontStyle::SMALL);
switch (screen) {
case 0: // Build Date
break;
case 1: // Device ID
{
uint64_t id = getDeviceID();
#ifdef DEVICE_HAS_VALIDATION_CODE
// If device has validation code; then we want to take over both lines of the screen
OLED::clearScreen(); // Ensure the buffer starts clean
OLED::setCursor(0, 0); // Position the cursor at the 0,0 (top left)
OLED::print(DebugMenu[screen], FontStyle::SMALL);
OLED::drawHex(getDeviceValidation(), FontStyle::SMALL, 8);
OLED::setCursor(0, 8); // second line
#endif
OLED::drawHex((uint32_t)(id >> 32), FontStyle::SMALL, 8);
OLED::drawHex((uint32_t)(id & 0xFFFFFFFF), FontStyle::SMALL, 8);
} break;
case 2: // ACC Type
OLED::print(AccelTypeNames[(int)DetectedAccelerometerVersion], FontStyle::SMALL);
break;
case 3: // Power Negotiation Status
{
int sourceNumber = 0;
if (getIsPoweredByDCIN()) {
sourceNumber = 0;
} else {
// We are not powered via DC, so want to display the appropriate state for PD or QC
bool poweredbyPD = false;
bool pdHasVBUSConnected = false;
#if POW_PD
if (USBPowerDelivery::fusbPresent()) {
// We are PD capable
if (USBPowerDelivery::negotiationComplete()) {
// We are powered via PD
poweredbyPD = true;
#ifdef VBUS_MOD_TEST
pdHasVBUSConnected = USBPowerDelivery::isVBUSConnected();
#endif
}
}
#endif
if (poweredbyPD) {
if (pdHasVBUSConnected) {
sourceNumber = 2;
} else {
sourceNumber = 3;
}
} else {
sourceNumber = 1;
}
}
OLED::print(PowerSourceNames[sourceNumber], FontStyle::SMALL);
} break;
case 4: // Input Voltage
printVoltage();
break;
case 5: // Temp in °C
OLED::printNumber(TipThermoModel::getTipInC(), 6, FontStyle::SMALL);
break;
case 6: // Handle Temp in °C
OLED::printNumber(getHandleTemperature(0) / 10, 6, FontStyle::SMALL);
OLED::print(SymbolDot, FontStyle::SMALL);
OLED::printNumber(getHandleTemperature(0) % 10, 1, FontStyle::SMALL);
break;
case 7: // Max Temp Limit in °C
OLED::printNumber(TipThermoModel::getTipMaxInC(), 6, FontStyle::SMALL);
break;
case 8: // System Uptime
OLED::printNumber(xTaskGetTickCount() / TICKS_100MS, 8, FontStyle::SMALL);
break;
case 9: // Movement Timestamp
OLED::printNumber(lastMovementTime / TICKS_100MS, 8, FontStyle::SMALL);
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::printNumber(getTipResistanceX10() % 10, 1, FontStyle::SMALL);
break;
case 11: // Raw Tip in µV
OLED::printNumber(TipThermoModel::convertTipRawADCTouV(getTipRawTemp(0), true), 8, FontStyle::SMALL);
break;
case 12: // Tip Cold Junction Compensation Offset in µV
OLED::printNumber(getSettingValue(SettingsOptions::CalibrationOffset), 8, FontStyle::SMALL);
break;
case 13: // High Water Mark for GUI
OLED::printNumber(uxTaskGetStackHighWaterMark(GUITaskHandle), 8, FontStyle::SMALL);
break;
case 14: // High Water Mark for Movement Task
OLED::printNumber(uxTaskGetStackHighWaterMark(MOVTaskHandle), 8, FontStyle::SMALL);
break;
case 15: // High Water Mark for PID Task
OLED::printNumber(uxTaskGetStackHighWaterMark(PIDTaskHandle), 8, FontStyle::SMALL);
break;
break;
#ifdef HALL_SENSOR
case 16: // Raw Hall Effect Value
{
int16_t hallEffectStrength = getRawHallEffect();
if (hallEffectStrength < 0)
hallEffectStrength = -hallEffectStrength;
OLED::printNumber(hallEffectStrength, 6, FontStyle::SMALL);
} break;
#endif
default:
break;
}
OLED::refresh();
b = getButtonState();
if (b == BUTTON_B_SHORT)
return;
else if (b == BUTTON_F_SHORT) {
screen++;
#ifdef HALL_SENSOR
screen = screen % 17;
#else
screen = screen % 16;
#endif
}
GUIDelay();
}
}

View File

@@ -0,0 +1,213 @@
#include "Buttons.hpp"
#include "OperatingModes.h"
#define MOVEMENT_INACTIVITY_TIME (60 * configTICK_RATE_HZ)
#define BUTTON_INACTIVITY_TIME (60 * configTICK_RATE_HZ)
uint8_t buttonAF[sizeof(buttonA)];
uint8_t buttonBF[sizeof(buttonB)];
uint8_t disconnectedTipF[sizeof(disconnectedTip)];
void renderHomeScreenAssets(void) {
// Generate the flipped screen into ram for later use
// flipped is generated by flipping each row
for (int row = 0; row < 2; row++) {
for (int x = 0; x < 42; x++) {
buttonAF[(row * 42) + x] = buttonA[(row * 42) + (41 - x)];
buttonBF[(row * 42) + x] = buttonB[(row * 42) + (41 - x)];
disconnectedTipF[(row * 42) + x] = disconnectedTip[(row * 42) + (41 - x)];
}
}
}
void drawHomeScreen(bool buttonLockout) {
bool tipDisconnectedDisplay = false;
bool tempOnDisplay = false;
bool showExitMenuTransition = false;
renderHomeScreenAssets();
for (;;) {
ButtonState buttons = getButtonState();
if (buttons != BUTTON_NONE) {
OLED::setDisplayState(OLED::DisplayState::ON);
}
if (buttons != BUTTON_NONE && buttonLockout)
buttons = BUTTON_NONE;
else
buttonLockout = false;
switch (buttons) {
case BUTTON_NONE:
// Do nothing
break;
case BUTTON_BOTH:
// Not used yet
// In multi-language this might be used to reset language on a long hold
// or some such
break;
case BUTTON_B_LONG:
// Show the version information
showDebugMenu();
break;
case BUTTON_F_LONG:
gui_solderingTempAdjust();
saveSettings();
break;
case BUTTON_F_SHORT:
if (!isTipDisconnected()) {
gui_solderingMode(0); // enter soldering mode
buttonLockout = true;
}
break;
case BUTTON_B_SHORT:
enterSettingsMenu(); // enter the settings menu
{
OLED::useSecondaryFramebuffer(true);
showExitMenuTransition = true;
}
buttonLockout = true;
break;
default:
break;
}
currentTempTargetDegC = 0; // ensure tip is off
getInputVoltageX10(getSettingValue(SettingsOptions::VoltageDiv), 0);
uint32_t tipTemp = TipThermoModel::getTipInC();
if (tipTemp > 55) {
setStatusLED(LED_COOLING_STILL_HOT);
} else {
setStatusLED(LED_STANDBY);
}
// Preemptively turn the display on. Turn it off if and only if
// the tip temperature is below 50 degrees C *and* motion sleep
// detection is enabled *and* there has been no activity (movement or
// button presses) in a while.
// This is zero cost really as state is only changed on display updates
OLED::setDisplayState(OLED::DisplayState::ON);
if ((tipTemp < 50) && getSettingValue(SettingsOptions::Sensitivity)
&& (((xTaskGetTickCount() - lastMovementTime) > MOVEMENT_INACTIVITY_TIME) && ((xTaskGetTickCount() - lastButtonTime) > BUTTON_INACTIVITY_TIME))) {
OLED::setDisplayState(OLED::DisplayState::OFF);
setStatusLED(LED_OFF);
} else {
OLED::setDisplayState(OLED::DisplayState::ON);
}
// Clear the lcd buffer
OLED::clearScreen();
if (OLED::getRotation()) {
OLED::setCursor(50, 0);
} else {
OLED::setCursor(-1, 0);
}
if (getSettingValue(SettingsOptions::DetailedIDLE)) {
if (isTipDisconnected()) {
if (OLED::getRotation()) {
// in right handed mode we want to draw over the first part
OLED::drawArea(54, 0, 42, 16, disconnectedTipF);
} else {
OLED::drawArea(0, 0, 42, 16, disconnectedTip);
}
if (OLED::getRotation()) {
OLED::setCursor(-1, 0);
} else {
OLED::setCursor(42, 0);
}
uint32_t Vlt = getInputVoltageX10(getSettingValue(SettingsOptions::VoltageDiv), 0);
OLED::printNumber(Vlt / 10, 2, FontStyle::LARGE);
OLED::print(SymbolDot, 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);
} else {
if (!(getSettingValue(SettingsOptions::CoolingTempBlink) && (tipTemp > 55) && (xTaskGetTickCount() % 1000 < 300)))
// Blink temp if setting enable and temp < 55°
// 1000 tick/sec
// OFF 300ms ON 700ms
gui_drawTipTemp(true, FontStyle::LARGE); // draw in the temp
if (OLED::getRotation()) {
OLED::setCursor(6, 0);
} else {
OLED::setCursor(73, 0); // top right
}
OLED::printNumber(getSettingValue(SettingsOptions::SolderingTemp), 3, FontStyle::SMALL); // draw set temp
if (getSettingValue(SettingsOptions::TemperatureInF))
OLED::print(SymbolDegF, FontStyle::SMALL);
else
OLED::print(SymbolDegC, 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);
}
} else {
if (OLED::getRotation()) {
OLED::drawArea(54, 0, 42, 16, buttonAF);
OLED::drawArea(12, 0, 42, 16, buttonBF);
OLED::setCursor(0, 0);
gui_drawBatteryIcon();
} else {
OLED::drawArea(0, 0, 42, 16, buttonA); // Needs to be flipped so button ends up
OLED::drawArea(42, 0, 42, 16, buttonB); // on right side of screen
OLED::setCursor(84, 0);
gui_drawBatteryIcon();
}
tipDisconnectedDisplay = false;
if (tipTemp > 55)
tempOnDisplay = true;
else if (tipTemp < 45)
tempOnDisplay = false;
if (isTipDisconnected()) {
tempOnDisplay = false;
tipDisconnectedDisplay = true;
}
if (tempOnDisplay || tipDisconnectedDisplay) {
// draw temp over the start soldering button
// Location changes on screen rotation
if (OLED::getRotation()) {
// in right handed mode we want to draw over the first part
OLED::fillArea(55, 0, 41, 16, 0); // clear the area for the temp
OLED::setCursor(56, 0);
} else {
OLED::fillArea(0, 0, 41, 16, 0); // clear the area
OLED::setCursor(0, 0);
}
// If we have a tip connected draw the temp, if not we leave it blank
if (!tipDisconnectedDisplay) {
// draw in the temp
if (!(getSettingValue(SettingsOptions::CoolingTempBlink) && (xTaskGetTickCount() % 260 < 160)))
gui_drawTipTemp(false, FontStyle::LARGE); // draw in the temp
} else {
// Draw in missing tip symbol
if (OLED::getRotation()) {
// in right handed mode we want to draw over the first part
OLED::drawArea(54, 0, 42, 16, disconnectedTipF);
} else {
OLED::drawArea(0, 0, 42, 16, disconnectedTip);
}
}
}
}
if (showExitMenuTransition) {
OLED::useSecondaryFramebuffer(false);
OLED::transitionSecondaryFramebuffer(false);
showExitMenuTransition = false;
} else {
OLED::refresh();
GUIDelay();
}
}
}

View File

@@ -0,0 +1,38 @@
#ifndef OPERATING_MODES_H_
#define OPERATING_MODES_H_
extern "C" {
#include "FreeRTOSConfig.h"
}
#include "Buttons.hpp"
#include "OLED.hpp"
#include "OperatingModeUtilities.h"
#include "Settings.h"
#include "TipThermoModel.h"
#include "Translation.h"
#include "cmsis_os.h"
#include "configuration.h"
#include "history.hpp"
#include "main.hpp"
#include "power.hpp"
#include "settingsGUI.hpp"
#include "stdlib.h"
#include "string.h"
#if POW_PD
#include "USBPD.h"
#include "pd.h"
#endif
// Exposed modes
void performCJCC(void); // Used to calibrate the Cold Junction offset
void gui_solderingTempAdjust(void); // For adjusting the setpoint temperature of the iron
int gui_SolderingSleepingMode(bool stayOff, bool autoStarted); // Sleep mode
void gui_solderingMode(uint8_t jumpToSleep); // Main mode for hot pointy tool
void showDebugMenu(void); // Debugging values
void showPDDebug(void); // Debugging menu that hows PD adaptor info
void showWarnings(void); // Shows user warnings if required
void drawHomeScreen(bool buttonLockout) __attribute__((noreturn)); // IDLE / Home screen
void renderHomeScreenAssets(void); // Called to act as start delay and used to render out flipped images for home screen graphics
//
#endif

View File

@@ -0,0 +1,40 @@
#include "OperatingModes.h"
void showWarnings(void) {
// Display alert if settings were reset
if (settingsWereReset) {
warnUser(translatedString(Tr->SettingsResetMessage), 10 * TICKS_SECOND);
}
#ifdef DEVICE_HAS_VALIDATION_SUPPORT
if (getDeviceValidationStatus()) {
// Warn user this device might be counterfeit
warnUser(translatedString(Tr->DeviceFailedValidationWarning), 10 * TICKS_SECOND);
}
#endif
#ifndef NO_WARN_MISSING
// We also want to alert if accel or pd is not detected / not responding
// In this case though, we dont want to nag the user _too_ much
// So only show first 2 times
while (DetectedAccelerometerVersion == AccelType::Scanning) {
osDelay(5);
}
// Display alert if accelerometer is not detected
if (DetectedAccelerometerVersion == AccelType::None) {
if (getSettingValue(SettingsOptions::AccelMissingWarningCounter) < 2) {
nextSettingValue(SettingsOptions::AccelMissingWarningCounter);
saveSettings();
warnUser(translatedString(Tr->NoAccelerometerMessage), 10 * TICKS_SECOND);
}
}
#if POW_PD
// We expect pd to be present
if (!USBPowerDelivery::fusbPresent()) {
if (getSettingValue(SettingsOptions::PDMissingWarningCounter) < 2) {
nextSettingValue(SettingsOptions::PDMissingWarningCounter);
saveSettings();
warnUser(translatedString(Tr->NoPowerDeliveryMessage), 10 * TICKS_SECOND);
}
}
#endif
#endif
}

View File

@@ -0,0 +1,67 @@
#include "OperatingModes.h"
int gui_SolderingSleepingMode(bool stayOff, bool autoStarted) {
// Drop to sleep temperature and display until movement or button press
for (;;) {
// user moved or pressed a button, go back to soldering
// If in the first two seconds we disable this to let accelerometer warm up
#ifdef POW_DC
if (checkForUnderVoltage())
return 1; // return non-zero on error
#endif
if (getSettingValue(SettingsOptions::TemperatureInF)) {
currentTempTargetDegC = stayOff ? 0 : TipThermoModel::convertFtoC(min(getSettingValue(SettingsOptions::SleepTemp), getSettingValue(SettingsOptions::SolderingTemp)));
} else {
currentTempTargetDegC = stayOff ? 0 : min(getSettingValue(SettingsOptions::SleepTemp), getSettingValue(SettingsOptions::SolderingTemp));
}
// draw the lcd
uint16_t tipTemp;
if (getSettingValue(SettingsOptions::TemperatureInF))
tipTemp = TipThermoModel::getTipInF();
else {
tipTemp = TipThermoModel::getTipInC();
}
OLED::clearScreen();
OLED::setCursor(0, 0);
if (getSettingValue(SettingsOptions::DetailedSoldering)) {
OLED::print(translatedString(Tr->SleepingAdvancedString), FontStyle::SMALL);
OLED::setCursor(0, 8);
OLED::print(translatedString(Tr->SleepingTipAdvancedString), FontStyle::SMALL);
OLED::printNumber(tipTemp, 3, FontStyle::SMALL);
if (getSettingValue(SettingsOptions::TemperatureInF))
OLED::print(SymbolDegF, FontStyle::SMALL);
else {
OLED::print(SymbolDegC, FontStyle::SMALL);
}
OLED::print(SymbolSpace, FontStyle::SMALL);
printVoltage();
OLED::print(SymbolVolts, FontStyle::SMALL);
} else {
OLED::print(translatedString(Tr->SleepingSimpleString), FontStyle::LARGE);
OLED::printNumber(tipTemp, 3, FontStyle::LARGE);
if (getSettingValue(SettingsOptions::TemperatureInF))
OLED::drawSymbol(0);
else {
OLED::drawSymbol(1);
}
}
OLED::refresh();
GUIDelay();
if (!shouldBeSleeping(autoStarted)) {
return 0;
}
if (shouldShutdown()) {
// shutdown
currentTempTargetDegC = 0;
return 1; // we want to exit soldering mode
}
}
return 0;
}

View File

@@ -0,0 +1,248 @@
#include "OperatingModes.h"
extern bool heaterThermalRunaway;
void gui_solderingMode(uint8_t jumpToSleep) {
/*
* * Soldering (gui_solderingMode)
* -> Main loop where we draw temp, and animations
* --> User presses buttons and they goto the temperature adjust screen
* ---> Display the current setpoint temperature
* ---> Use buttons to change forward and back on temperature
* ---> Both buttons or timeout for exiting
* --> Long hold front button to enter boost mode
* ---> Just temporarily sets the system into the alternate temperature for
* PID control
* --> Long hold back button to exit
* --> Double button to exit
* --> Long hold double button to toggle key lock
*/
bool boostModeOn = false;
bool buttonsLocked = false;
if (jumpToSleep) {
if (gui_SolderingSleepingMode(jumpToSleep == 2, true) == 1) {
lastButtonTime = xTaskGetTickCount();
return; // If the function returns non-0 then exit
}
}
for (;;) {
ButtonState buttons = getButtonState();
if (buttonsLocked && (getSettingValue(SettingsOptions::LockingMode) != 0)) { // If buttons locked
switch (buttons) {
case BUTTON_NONE:
boostModeOn = false;
break;
case BUTTON_BOTH_LONG:
// Unlock buttons
buttonsLocked = false;
warnUser(translatedString(Tr->UnlockingKeysString), TICKS_SECOND);
break;
case BUTTON_F_LONG:
// if boost mode is enabled turn it on
if (getSettingValue(SettingsOptions::BoostTemp) && (getSettingValue(SettingsOptions::LockingMode) == 1)) {
boostModeOn = true;
}
break;
// fall through
case BUTTON_BOTH:
case BUTTON_B_LONG:
case BUTTON_F_SHORT:
case BUTTON_B_SHORT:
// Do nothing and display a lock warning
warnUser(translatedString(Tr->WarningKeysLockedString), TICKS_SECOND / 2);
break;
default:
break;
}
} else { // Button not locked
switch (buttons) {
case BUTTON_NONE:
// stay
boostModeOn = false;
break;
case BUTTON_BOTH:
case BUTTON_B_LONG:
return; // exit on back long hold
case BUTTON_F_LONG:
// if boost mode is enabled turn it on
if (getSettingValue(SettingsOptions::BoostTemp))
boostModeOn = true;
break;
case BUTTON_F_SHORT:
case BUTTON_B_SHORT: {
uint16_t oldTemp = getSettingValue(SettingsOptions::SolderingTemp);
gui_solderingTempAdjust(); // goto adjust temp mode
if (oldTemp != getSettingValue(SettingsOptions::SolderingTemp)) {
saveSettings(); // only save on change
}
} break;
case BUTTON_BOTH_LONG:
if (getSettingValue(SettingsOptions::LockingMode) != 0) {
// Lock buttons
buttonsLocked = true;
warnUser(translatedString(Tr->LockingKeysString), TICKS_SECOND);
}
break;
default:
break;
}
}
// else we update the screen information
OLED::clearScreen();
// Draw in the screen details
if (getSettingValue(SettingsOptions::DetailedSoldering)) {
if (OLED::getRotation()) {
OLED::setCursor(50, 0);
} else {
OLED::setCursor(-1, 0);
}
gui_drawTipTemp(true, FontStyle::LARGE);
#ifndef NO_SLEEP_MODE
if (getSettingValue(SettingsOptions::Sensitivity) && getSettingValue(SettingsOptions::SleepTime)) {
if (OLED::getRotation()) {
OLED::setCursor(32, 0);
} else {
OLED::setCursor(47, 0);
}
printCountdownUntilSleep(getSleepTimeout());
}
#endif
if (boostModeOn) {
if (OLED::getRotation()) {
OLED::setCursor(38, 8);
} else {
OLED::setCursor(55, 8);
}
OLED::print(SymbolPlus, FontStyle::SMALL);
}
if (OLED::getRotation()) {
OLED::setCursor(0, 0);
} else {
OLED::setCursor(67, 0);
}
OLED::printNumber(x10WattHistory.average() / 10, 2, FontStyle::SMALL);
OLED::print(SymbolDot, FontStyle::SMALL);
OLED::printNumber(x10WattHistory.average() % 10, 1, FontStyle::SMALL);
OLED::print(SymbolWatts, FontStyle::SMALL);
if (OLED::getRotation()) {
OLED::setCursor(0, 8);
} else {
OLED::setCursor(67, 8);
}
printVoltage();
OLED::print(SymbolVolts, 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
// We draw boost arrow if boosting, or else gap temp <-> heat
// indicator
if (boostModeOn)
OLED::drawSymbol(2);
else
OLED::print(SymbolSpace, FontStyle::LARGE);
// Draw heating/cooling symbols
OLED::drawHeatSymbol(X10WattsToPWM(x10WattHistory.average()));
} else {
// Draw heating/cooling symbols
OLED::drawHeatSymbol(X10WattsToPWM(x10WattHistory.average()));
// We draw boost arrow if boosting, or else gap temp <-> heat
// indicator
if (boostModeOn)
OLED::drawSymbol(2);
else
OLED::print(SymbolSpace, FontStyle::LARGE);
gui_drawTipTemp(true, FontStyle::LARGE); // Draw current tip temp
OLED::print(SymbolSpace, FontStyle::LARGE); // Space out gap between battery <-> temp
gui_drawBatteryIcon();
}
}
OLED::refresh();
// Update the setpoints for the temperature
if (boostModeOn) {
if (getSettingValue(SettingsOptions::TemperatureInF))
currentTempTargetDegC = TipThermoModel::convertFtoC(getSettingValue(SettingsOptions::BoostTemp));
else {
currentTempTargetDegC = (getSettingValue(SettingsOptions::BoostTemp));
}
} else {
if (getSettingValue(SettingsOptions::TemperatureInF))
currentTempTargetDegC = TipThermoModel::convertFtoC(getSettingValue(SettingsOptions::SolderingTemp));
else {
currentTempTargetDegC = (getSettingValue(SettingsOptions::SolderingTemp));
}
}
#ifdef POW_DC
// Undervoltage test
if (checkForUnderVoltage()) {
lastButtonTime = xTaskGetTickCount();
return;
}
#endif
#ifdef ACCEL_EXITS_ON_MOVEMENT
// If the accel works in reverse where movement will cause exiting the soldering mode
if (getSettingValue(SettingsOptions::Sensitivity)) {
if (lastMovementTime) {
if (lastMovementTime > TICKS_SECOND * 10) {
// If we have moved recently; in the last second
// Then exit soldering mode
if (((TickType_t)(xTaskGetTickCount() - lastMovementTime)) < (TickType_t)(TICKS_SECOND)) {
currentTempTargetDegC = 0;
return;
}
}
}
}
#endif
#ifdef NO_SLEEP_MODE
// No sleep mode, but still want shutdown timeout
if (shouldShutdown()) {
// shutdown
currentTempTargetDegC = 0;
return; // we want to exit soldering mode
}
#endif
if (shouldBeSleeping(false)) {
if (gui_SolderingSleepingMode(false, false)) {
return; // If the function returns non-0 then exit
}
}
// Update LED status
int error = currentTempTargetDegC - TipThermoModel::getTipInC();
if (error >= -10 && error <= 10) {
// converged
setStatusLED(LED_HOT);
} else {
setStatusLED(LED_HEATING);
}
// If we have tripped thermal runaway, turn off heater and show warning
if (heaterThermalRunaway) {
currentTempTargetDegC = 0; // heater control off
warnUser(translatedString(Tr->WarningThermalRunaway), 10 * TICKS_SECOND);
heaterThermalRunaway = false;
return;
}
// slow down ui update rate
GUIDelay();
}
}

View File

@@ -0,0 +1,111 @@
#include "OperatingModes.h"
void gui_solderingTempAdjust(void) {
TickType_t lastChange = xTaskGetTickCount();
currentTempTargetDegC = 0; // Turn off heater while adjusting temp
TickType_t autoRepeatTimer = 0;
uint8_t autoRepeatAcceleration = 0;
bool waitForRelease = false;
ButtonState buttons = getButtonState();
if (buttons != BUTTON_NONE) {
// Temp adjust entered by long-pressing F button.
waitForRelease = true;
}
for (;;) {
OLED::setCursor(0, 0);
OLED::clearScreen();
buttons = getButtonState();
if (buttons) {
if (waitForRelease) {
buttons = BUTTON_NONE;
}
lastChange = xTaskGetTickCount();
} else {
waitForRelease = false;
}
int16_t delta = 0;
switch (buttons) {
case BUTTON_NONE:
// stay
autoRepeatAcceleration = 0;
break;
case BUTTON_BOTH:
// exit
return;
break;
case BUTTON_B_LONG:
if (xTaskGetTickCount() - autoRepeatTimer + autoRepeatAcceleration > PRESS_ACCEL_INTERVAL_MAX) {
delta = -getSettingValue(SettingsOptions::TempChangeLongStep);
autoRepeatTimer = xTaskGetTickCount();
autoRepeatAcceleration += PRESS_ACCEL_STEP;
}
break;
case BUTTON_B_SHORT:
delta = -getSettingValue(SettingsOptions::TempChangeShortStep);
break;
case BUTTON_F_LONG:
if (xTaskGetTickCount() - autoRepeatTimer + autoRepeatAcceleration > PRESS_ACCEL_INTERVAL_MAX) {
delta = getSettingValue(SettingsOptions::TempChangeLongStep);
autoRepeatTimer = xTaskGetTickCount();
autoRepeatAcceleration += PRESS_ACCEL_STEP;
}
break;
case BUTTON_F_SHORT:
delta = getSettingValue(SettingsOptions::TempChangeShortStep);
break;
default:
break;
}
if ((PRESS_ACCEL_INTERVAL_MAX - autoRepeatAcceleration) < PRESS_ACCEL_INTERVAL_MIN) {
autoRepeatAcceleration = PRESS_ACCEL_INTERVAL_MAX - PRESS_ACCEL_INTERVAL_MIN;
}
// If buttons are flipped; flip the delta
if (getSettingValue(SettingsOptions::ReverseButtonTempChangeEnabled)) {
delta = -delta;
}
if (delta != 0) {
// constrain between the set temp limits, i.e. 10-450 C
int16_t newTemp = getSettingValue(SettingsOptions::SolderingTemp);
newTemp += delta;
// Round to nearest increment of delta
delta = abs(delta);
newTemp = (newTemp / delta) * delta;
if (getSettingValue(SettingsOptions::TemperatureInF)) {
if (newTemp > MAX_TEMP_F)
newTemp = MAX_TEMP_F;
if (newTemp < MIN_TEMP_F)
newTemp = MIN_TEMP_F;
} else {
if (newTemp > MAX_TEMP_C)
newTemp = MAX_TEMP_C;
if (newTemp < MIN_TEMP_C)
newTemp = MIN_TEMP_C;
}
setSettingValue(SettingsOptions::SolderingTemp, (uint16_t)newTemp);
}
if (xTaskGetTickCount() - lastChange > (TICKS_SECOND * 2))
return; // exit if user just doesn't press anything for a bit
if (OLED::getRotation()) {
OLED::print(getSettingValue(SettingsOptions::ReverseButtonTempChangeEnabled) ? SymbolPlus : SymbolMinus, FontStyle::LARGE);
} else {
OLED::print(getSettingValue(SettingsOptions::ReverseButtonTempChangeEnabled) ? SymbolMinus : SymbolPlus, FontStyle::LARGE);
}
OLED::print(SymbolSpace, 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);
if (OLED::getRotation()) {
OLED::print(getSettingValue(SettingsOptions::ReverseButtonTempChangeEnabled) ? SymbolMinus : SymbolPlus, FontStyle::LARGE);
} else {
OLED::print(getSettingValue(SettingsOptions::ReverseButtonTempChangeEnabled) ? SymbolPlus : SymbolMinus, FontStyle::LARGE);
}
OLED::refresh();
GUIDelay();
}
}

View File

@@ -0,0 +1,93 @@
#include "OperatingModes.h"
#if POW_PD
#ifdef HAS_POWER_DEBUG_MENU
void showPDDebug(void) {
// Print out the USB-PD state
// Basically this is like the Debug menu, but instead we want to print out the PD status
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
if (screen == 0) {
// Print the PD state machine
OLED::print(SymbolState, FontStyle::SMALL);
OLED::print(SymbolSpace, FontStyle::SMALL);
OLED::printNumber(USBPowerDelivery::getStateNumber(), 2, FontStyle::SMALL, true);
OLED::print(SymbolSpace, 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);
} else {
OLED::print(SymbolVBus, FontStyle::SMALL);
}
}
}
} else {
// Print out the Proposed power options one by one
auto lastCaps = USBPowerDelivery::getLastSeenCapabilities();
if ((screen - 1) < 11) {
int voltage_mv = 0;
int min_voltage = 0;
int current_a_x100 = 0;
int wattage = 0;
if ((lastCaps[screen - 1] & PD_PDO_TYPE) == PD_PDO_TYPE_FIXED) {
voltage_mv = PD_PDV2MV(PD_PDO_SRC_FIXED_VOLTAGE_GET(lastCaps[screen - 1])); // voltage in mV units
current_a_x100 = PD_PDO_SRC_FIXED_CURRENT_GET(lastCaps[screen - 1]); // current in 10mA units
} else if ((lastCaps[screen - 1] & PD_PDO_TYPE) == PD_PDO_TYPE_AUGMENTED) {
voltage_mv = PD_PAV2MV(PD_APDO_AVS_MAX_VOLTAGE_GET(lastCaps[screen - 1]));
min_voltage = PD_PAV2MV(PD_APDO_PPS_MIN_VOLTAGE_GET(lastCaps[screen - 1]));
// Last value is wattage
wattage = PD_APDO_AVS_MAX_POWER_GET(lastCaps[screen - 1]);
} else {
voltage_mv = PD_PAV2MV(PD_APDO_PPS_MAX_VOLTAGE_GET(lastCaps[screen - 1]));
min_voltage = PD_PAV2MV(PD_APDO_PPS_MIN_VOLTAGE_GET(lastCaps[screen - 1]));
current_a_x100 = PD_PAI2CA(PD_APDO_PPS_CURRENT_GET(lastCaps[screen - 1])); // max current in 10mA units
}
// Skip not used entries
if (voltage_mv == 0) {
screen++;
} else {
// print out this entry of the proposal
OLED::printNumber(screen, 2, FontStyle::SMALL, true); // print the entry number
OLED::print(SymbolSpace, FontStyle::SMALL);
if (min_voltage > 0) {
OLED::printNumber(min_voltage / 1000, 2, FontStyle::SMALL, true); // print the voltage
OLED::print(SymbolMinus, FontStyle::SMALL);
}
OLED::printNumber(voltage_mv / 1000, 2, FontStyle::SMALL, true); // print the voltage
OLED::print(SymbolVolts, FontStyle::SMALL);
OLED::print(SymbolSpace, FontStyle::SMALL);
if (wattage) {
OLED::printNumber(wattage, 3, FontStyle::SMALL, true); // print the current in 0.1A res
OLED::print(SymbolWatts, 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::printNumber(current_a_x100 % 100, 2, FontStyle::SMALL, true); // print the current in 0.1A res
OLED::print(SymbolAmps, FontStyle::SMALL);
}
}
} else {
screen = 0;
}
}
OLED::refresh();
b = getButtonState();
if (b == BUTTON_B_SHORT)
return;
else if (b == BUTTON_F_SHORT) {
screen++;
}
GUIDelay();
}
}
#endif
#endif

View File

@@ -0,0 +1,29 @@
#include "OperatingModeUtilities.h"
#include "TipThermoModel.h"
void gui_drawTipTemp(bool symbol, const FontStyle font) {
// Draw tip temp handling unit conversion & tolerance near setpoint
uint32_t Temp = 0;
if (getSettingValue(SettingsOptions::TemperatureInF)) {
Temp = TipThermoModel::getTipInF();
} else {
Temp = TipThermoModel::getTipInC();
}
OLED::printNumber(Temp, 3, font); // Draw the tip temp out
if (symbol) {
if (font == FontStyle::LARGE) {
// Big font, can draw nice symbols
if (getSettingValue(SettingsOptions::TemperatureInF))
OLED::drawSymbol(0);
else
OLED::drawSymbol(1);
} else {
// Otherwise fall back to chars
if (getSettingValue(SettingsOptions::TemperatureInF))
OLED::print(SymbolDegF, FontStyle::SMALL);
else
OLED::print(SymbolDegC, FontStyle::SMALL);
}
}
}

View File

@@ -0,0 +1,10 @@
#include "OperatingModeUtilities.h"
void GUIDelay() {
// Called in all UI looping tasks,
// This limits the re-draw rate to the LCD and also lets the DMA run
// As the gui task can very easily fill this bus with transactions, which will
// prevent the movement detection from running
vTaskDelay(5 * TICKS_10MS);
}

View File

@@ -0,0 +1,18 @@
#ifndef OPERATING_MODE_UTILITIES_H_
#define OPERATING_MODE_UTILITIES_H_
#include "OLED.hpp"
#include <stdbool.h>
void GUIDelay(); //
bool checkForUnderVoltage(void); //
uint32_t getSleepTimeout(void); //
bool shouldBeSleeping(bool inAutoStart); //
bool shouldShutdown(void); //
void gui_drawTipTemp(bool symbol, const FontStyle font); //
void printVoltage(void); //
void warnUser(const char *warning, const int timeout); //
void gui_drawBatteryIcon(void); //
bool checkForUnderVoltage(void); //
uint16_t min(uint16_t a, uint16_t b); //
void printCountdownUntilSleep(int sleepThres); //
#endif

View File

@@ -0,0 +1,8 @@
#include "OperatingModeUtilities.h"
void printVoltage(void) {
uint32_t volt = getInputVoltageX10(getSettingValue(SettingsOptions::VoltageDiv), 0);
OLED::printNumber(volt / 10, 2, FontStyle::SMALL);
OLED::print(SymbolDot, FontStyle::SMALL);
OLED::printNumber(volt % 10, 1, FontStyle::SMALL);
}

View File

@@ -0,0 +1,8 @@
#include "Buttons.hpp"
#include "OperatingModeUtilities.h"
void warnUser(const char *warning, const int timeout) {
OLED::clearScreen();
OLED::printWholeScreen(warning);
OLED::refresh();
waitForButtonPressOrTimeout(timeout);
}

View File

@@ -0,0 +1,38 @@
#include "Buttons.hpp"
#include "OperatingModeUtilities.h"
#include "configuration.h"
#ifdef POW_DC
extern volatile uint32_t currentTempTargetDegC;
// returns true if undervoltage has occured
bool checkForUnderVoltage(void) {
if (!getIsPoweredByDCIN()) {
return false;
}
uint16_t v = getInputVoltageX10(getSettingValue(SettingsOptions::VoltageDiv), 0);
// Dont check for first 2 seconds while the ADC stabilizes and the DMA fills
// the buffer
if (xTaskGetTickCount() > (TICKS_SECOND * 2)) {
if ((v < lookupVoltageLevel())) {
currentTempTargetDegC = 0;
OLED::clearScreen();
OLED::setCursor(0, 0);
if (getSettingValue(SettingsOptions::DetailedSoldering)) {
OLED::print(translatedString(Tr->UndervoltageString), FontStyle::SMALL);
OLED::setCursor(0, 8);
OLED::print(translatedString(Tr->InputVoltageString), FontStyle::SMALL);
printVoltage();
OLED::print(SymbolVolts, FontStyle::SMALL);
} else {
OLED::print(translatedString(Tr->UVLOWarningString), FontStyle::LARGE);
}
OLED::refresh();
GUIDelay();
waitForButtonPress();
return true;
}
}
return false;
}
#endif

View File

@@ -0,0 +1,43 @@
#include "OperatingModeUtilities.h"
void gui_drawBatteryIcon(void) {
#if defined(POW_PD) || defined(POW_QC)
if (!getIsPoweredByDCIN()) {
// On non-DC inputs we replace this symbol with the voltage we are operating on
// If <9V then show single digit, if not show dual small ones vertically stacked
uint16_t V = getInputVoltageX10(getSettingValue(SettingsOptions::VoltageDiv), 0);
if (V % 10 >= 5)
V = (V / 10) + 1; // round up
else
V = V / 10;
if (V > 9) {
int16_t xPos = OLED::getCursorX();
OLED::printNumber(V / 10, 1, FontStyle::SMALL);
OLED::setCursor(xPos, 8);
OLED::printNumber(V % 10, 1, FontStyle::SMALL);
OLED::setCursor(xPos + 12, 0); // need to reset this as if we drew a wide char
} else {
OLED::printNumber(V, 1, FontStyle::LARGE);
}
return;
}
#endif
#ifdef POW_DC
if (getSettingValue(SettingsOptions::MinDCVoltageCells)) {
// User is on a lithium battery
// we need to calculate which of the 10 levels they are on
uint8_t cellCount = getSettingValue(SettingsOptions::MinDCVoltageCells) + 2;
uint32_t cellV = getInputVoltageX10(getSettingValue(SettingsOptions::VoltageDiv), 0) / cellCount;
// Should give us approx cell voltage X10
// Range is 42 -> Minimum voltage setting (systemSettings.minVoltageCells) = 9 steps therefore we will use battery 0-9
if (cellV < getSettingValue(SettingsOptions::MinVoltageCells))
cellV = getSettingValue(SettingsOptions::MinVoltageCells);
cellV -= getSettingValue(SettingsOptions::MinVoltageCells); // Should leave us a number of 0-9
if (cellV > 9)
cellV = 9;
OLED::drawBattery(cellV + 1);
} else {
OLED::drawSymbol(15); // Draw the DC Logo
}
#endif
}

View File

@@ -0,0 +1,18 @@
#include "OperatingModeUtilities.h"
#ifndef NO_SLEEP_MODE
uint32_t getSleepTimeout(void) {
if (getSettingValue(SettingsOptions::Sensitivity) && getSettingValue(SettingsOptions::SleepTime)) {
uint32_t sleepThres = 0;
if (getSettingValue(SettingsOptions::SleepTime) < 6)
sleepThres = getSettingValue(SettingsOptions::SleepTime) * 10 * 1000;
else
sleepThres = (getSettingValue(SettingsOptions::SleepTime) - 5) * 60 * 1000;
return sleepThres;
}
return 0;
}
#endif

View File

@@ -0,0 +1,10 @@
#include "OperatingModeUtilities.h"
#include <stdint.h>
uint16_t min(uint16_t a, uint16_t b) {
if (a > b)
return b;
else
return a;
}

View File

@@ -0,0 +1,20 @@
#include "Buttons.hpp"
#include "OperatingModeUtilities.h"
extern TickType_t lastMovementTime;
#ifndef NO_SLEEP_MODE
void printCountdownUntilSleep(int sleepThres) {
/*
* Print seconds or minutes (if > 99 seconds) until sleep
* mode is triggered.
*/
TickType_t lastEventTime = lastButtonTime < lastMovementTime ? lastMovementTime : lastButtonTime;
TickType_t downCount = sleepThres - xTaskGetTickCount() + lastEventTime;
if (downCount > (99 * TICKS_SECOND)) {
OLED::printNumber(downCount / 60000 + 1, 2, FontStyle::SMALL);
OLED::print(SymbolMinutes, FontStyle::SMALL);
} else {
OLED::printNumber(downCount / 1000 + 1, 2, FontStyle::SMALL);
OLED::print(SymbolSeconds, FontStyle::SMALL);
}
}
#endif

View File

@@ -0,0 +1,24 @@
#include "OperatingModeUtilities.h"
extern TickType_t lastMovementTime;
extern TickType_t lastHallEffectSleepStart;
#include "Buttons.hpp"
bool shouldShutdown(void) {
if (getSettingValue(SettingsOptions::ShutdownTime)) { // only allow shutdown exit if time > 0
if (lastMovementTime) {
if (((TickType_t)(xTaskGetTickCount() - lastMovementTime)) > (TickType_t)(getSettingValue(SettingsOptions::ShutdownTime) * TICKS_MIN)) {
return true;
}
}
if (lastHallEffectSleepStart) {
if (((TickType_t)(xTaskGetTickCount() - lastHallEffectSleepStart)) > (TickType_t)(getSettingValue(SettingsOptions::ShutdownTime) * TICKS_MIN)) {
return true;
}
}
}
if (getButtonState() == BUTTON_B_LONG) { // allow also if back button is pressed long
return true;
}
return false;
}

View File

@@ -0,0 +1,46 @@
#include "Buttons.hpp"
#include "OperatingModeUtilities.h"
TickType_t lastHallEffectSleepStart = 0;
extern TickType_t lastMovementTime;
bool shouldBeSleeping(bool inAutoStart) {
#ifndef NO_SLEEP_MODE
// Return true if the iron should be in sleep mode
if (getSettingValue(SettingsOptions::Sensitivity) && getSettingValue(SettingsOptions::SleepTime)) {
if (inAutoStart) {
// In auto start we are asleep until movement
if (lastMovementTime == 0 && lastButtonTime == 0) {
return true;
}
}
if (lastMovementTime > 0 || lastButtonTime > 0) {
if (((xTaskGetTickCount() - lastMovementTime) > getSleepTimeout()) && ((xTaskGetTickCount() - lastButtonTime) > getSleepTimeout())) {
return true;
}
}
}
#ifdef HALL_SENSOR
// If the hall effect sensor is enabled in the build, check if its over
// threshold, and if so then we force sleep
if (getHallSensorFitted() && lookupHallEffectThreshold()) {
int16_t hallEffectStrength = getRawHallEffect();
if (hallEffectStrength < 0)
hallEffectStrength = -hallEffectStrength;
// Have absolute value of measure of magnetic field strength
if (hallEffectStrength > lookupHallEffectThreshold()) {
if (lastHallEffectSleepStart == 0) {
lastHallEffectSleepStart = xTaskGetTickCount();
}
if ((xTaskGetTickCount() - lastHallEffectSleepStart) > TICKS_SECOND) {
return true;
}
} else {
lastHallEffectSleepStart = 0;
}
}
#endif
#endif
return false;
}

View File

@@ -147,6 +147,8 @@ FRTOS_INC_DIR = ./Middlewares/Third_Party/FreeRTOS/Source/include
DRIVER_INC_DIR =./Core/Drivers
BSP_INC_DIR = ./Core/BSP
THREADS_INC_DIR = ./Core/Threads
THREADS_OP_MODES_INC_DIR = ./Core/Threads/OperatingModes
THREADS_OP_MODES_TOOLS_INC_DIR = ./Core/Threads/OperatingModes/utils
SOURCE_THREADS_DIR = ./Core/Threads
SOURCE_CORE_DIR = ./Core/Src
@@ -372,6 +374,8 @@ INCLUDES = -I$(APP_INC_DIR) \
-I$(DRIVER_INC_DIR) \
-I$(BSP_INC_DIR) \
-I$(THREADS_INC_DIR) \
-I$(THREADS_OP_MODES_INC_DIR) \
-I$(THREADS_OP_MODES_TOOLS_INC_DIR) \
-I$(INC_PD_DRIVERS_DIR) \
$(DEVICE_INCLUDES)