Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
b86e689
assets: vendor Terminus 4.49.1 8x16 and 12x24 bitmap fonts (OFL)
Jun 15, 2026
b040c31
feat(fonts): SMALL=8x16 / LARGE=12x24 from Terminus on 128x32
Jun 15, 2026
8648af4
feat(UI): exact-width LARGE tip-temp readout helpers
Jun 15, 2026
7d1e127
feat(UI): centered 1-line temp + 2-line status on detailed screens
Jun 15, 2026
281d768
fix(fonts): use Terminus bold for LARGE (12x24), regular for SMALL
Jun 15, 2026
bb33e20
refactor(UI): right-align tip temp in first 80px, drop width helpers
Jun 15, 2026
49f5c89
fix(UI): centre 24px large text on temperature-change screen
Jun 15, 2026
c154891
fix(UI): move 2nd row to y=16 on two-line 128x32 screens
Jun 15, 2026
7504a12
fix(fonts): include degree sign in SMALL/LARGE DegC/DegF symbols
Jun 15, 2026
5886152
fix(UI): bottom-aligned small degree on detailed tip temperature
Jun 15, 2026
2559ff2
fix(UI): right-align + centre submenu value on 128x32
Jun 15, 2026
b2f4633
fix(UI): shift detailed tip temperature one digit left
Jun 15, 2026
2f07789
fix(UI): tip temperature at y=8 on simplified 128x32 screens
Jun 15, 2026
7894ab4
fix(UI): vertically centre checkboxes on 128x32
Jun 15, 2026
67d8921
fix(UI): scrolling description in 8x16 font at y=8 on 128x32
Jun 15, 2026
051cfaa
fix(UI): centre power-source icon, move it right on simplified soldering
Jun 15, 2026
2ac7b9f
fix(UI): keep Temperature Unit value on screen (128x32)
Jun 15, 2026
f04d8d5
fix(UI): right-align Soldering Tip Type value (128x32)
Jun 15, 2026
74a5f1b
fix(UI): wrap PD Mode value into two lines (128x32)
Jun 15, 2026
63ab14a
fix(UI): draw scrolling description in large font (128x32)
Jun 15, 2026
dde73a4
fix(UI): wrap Soldering Tip Type value into two lines (128x32)
Jun 15, 2026
534d37d
fix(UI): encode menu descriptions for the small font on 128x32
Jun 15, 2026
ec92b65
fix(UI): centre temperature on simplified idle and soldering (128x32)
Jun 15, 2026
6405fd1
fix(UI): centre the simplified sleep screen (128x32)
Jun 15, 2026
940702e
fix(UI): centre warnUser popups on screen (128x32)
Jun 15, 2026
8e17f33
docs(README): add fork note about scope and intent
Jun 15, 2026
c430072
Fix TS101 PD negotiation regression (v2.22 → v2.23)
Platinplayer23 Oct 27, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

# IronOS - Open Source Flexible Firmware for Soldering Hardware

> **Note about this fork:** While I fully agree with the refactoring work Ralim is doing on the upstream branch, I did not want to wait any longer, so I created this fork to temporarily sort out the TS101 large-display issues until his fix is finished. My changes would probably just break his ongoing work or make merging more difficult, so I'll raise a pull request only as a courtesy, without any expectation of it being accepted or merged. I have tested this only for my own use cases — right-handed, English, on a TS101 — and cannot guarantee the same build will work for other orientations, languages, or devices.
_This repository was formerly known as TS100, it's the same great code. Just with more supported devices._

Originally conceived as an alternative firmware for the _TS100_, this firmware has evolved into a complex soldering hardware control firmware.
Expand Down
184 changes: 146 additions & 38 deletions Translations/make_translation.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ def write_start(f: TextIO):
)
f.write("\n")
f.write('#include "Translation.h"\n')
# configuration.h defines OLED_128x32, which selects the larger font tables
f.write('#include "configuration.h"\n')


def get_constants() -> List[Tuple[str, str]]:
Expand All @@ -126,10 +128,10 @@ def get_constants() -> List[Tuple[str, str]]:
("SmallSymbolDot", "."),
("SmallSymbolSlash", "/"),
("SmallSymbolColon", ":"),
("LargeSymbolDegC", "C"),
("SmallSymbolDegC", "C"),
("LargeSymbolDegF", "F"),
("SmallSymbolDegF", "F"),
("LargeSymbolDegC", "°C"),
("SmallSymbolDegC", "°C"),
("LargeSymbolDegF", "°F"),
("SmallSymbolDegF", "°F"),
("LargeSymbolMinutes", "m"),
("SmallSymbolMinutes", "m"),
("LargeSymbolSeconds", "s"),
Expand Down Expand Up @@ -198,6 +200,12 @@ def get_power_source_list() -> List[str]:
]


# On 128x32 panels the scrolling menu descriptions are drawn with the small
# (Terminus 8x16) font instead of the large one, so they must be ranked and
# encoded against the small font. Set from the build macros in main().
DESCRIPTIONS_USE_SMALL_FONT = False


def test_is_small_font(msg: str) -> bool:
return "\n" in msg and msg[0] != "\n"

Expand Down Expand Up @@ -250,7 +258,10 @@ def get_letter_counts(defs: dict, lang: dict, build_version: str) -> Dict:
for mod in defs["menuOptions"]:
eid = mod["id"]
msg = obj[eid]["description"]
big_font_messages.append(msg)
if DESCRIPTIONS_USE_SMALL_FONT:
small_font_messages.append(msg)
else:
big_font_messages.append(msg)

obj = lang["menuValues"]
for mod in defs["menuValues"]:
Expand All @@ -274,7 +285,10 @@ def get_letter_counts(defs: dict, lang: dict, build_version: str) -> Dict:
for mod in defs["menuGroups"]:
eid = mod["id"]
msg = obj[eid]["description"]
big_font_messages.append(msg)
if DESCRIPTIONS_USE_SMALL_FONT:
small_font_messages.append(msg)
else:
big_font_messages.append(msg)

constants = get_constants()
for x in constants:
Expand Down Expand Up @@ -408,6 +422,72 @@ def get_cell(x: int, y: int) -> bool:
return bytes(bs)


# --- Terminus fonts: become SMALL (8x16) and LARGE (12x24) on 128x32 panels ---
# (path, cell width, cell height, font ascent)
TERMINUS_FONTS = {
"8x16": ("terminus/ter-u16n.bdf", 8, 16, 12), # regular weight for the small/status font
"12x24": ("terminus/ter-u24b.bdf", 12, 24, 19), # bold weight for the large/readout font
}
_terminus_cache: Dict[str, Font] = {}


def _terminus_font(size: str) -> Font:
path = TERMINUS_FONTS[size][0]
if path not in _terminus_cache:
with open(os.path.join(HERE, path), "rb") as fh:
_terminus_cache[path] = bdfreader.read_bdf(fh)
return _terminus_cache[path]


def get_terminus_bytes(sym: str, size: str) -> bytes:
"""Render `sym` from a Terminus BDF into the IronOS column-major strip format.
Missing glyphs (or non-single-char symbols) render blank (compresses away)."""
_, dst_w, dst_h, ascent = TERMINUS_FONTS[size]
blank = bytes(dst_w * (dst_h // 8))
if len(sym) != 1:
return blank
try:
glyph: Glyph = _terminus_font(size)[ord(sym)]
except KeyError:
return blank
data = glyph.data
src_left, src_bottom, src_w, src_h = glyph.get_bounding_box()

def get_cell(x: int, y: int) -> bool:
adj_x = x - src_left
if adj_x < 0 or adj_x >= src_w:
return False
adj_y = y - (ascent - src_h - src_bottom)
if adj_y < 0 or adj_y >= src_h:
return False
return bool(data[src_h - adj_y - 1] & (1 << (src_w - adj_x - 1)))

bs = bytearray()
for block in range(dst_h // 8):
for c in range(dst_w):
b = 0
for r in range(8):
if get_cell(c, r + 8 * block):
b |= 0x01 << r
bs.append(b)
return bytes(bs)


def make_terminus_table_cpp(name: str, size: str, sym_list: List[str]) -> str:
out = f"const uint8_t {name}[] = {{\n"
for i, sym in enumerate(sym_list):
out += f"{bytes_to_c_hex(get_terminus_bytes(sym, size))}//0x{i + 2:X} -> {sym}\n"
out += f"}}; // {name}\n"
return out


def terminus_block_bytes(size: str, sym_list: List[str]) -> bytes:
out = bytearray()
for sym in sym_list:
out.extend(get_terminus_bytes(sym, size))
return bytes(out)


def get_bytes_from_font_index(index: int) -> bytes:
"""
Converts the font table index into its corresponding bytes
Expand Down Expand Up @@ -763,14 +843,23 @@ def render_font_block(data: LanguageData, f: TextIO, compress_font: bool = False
)

if not compress_font:
font_table_text = make_font_table_cpp(
data.small_text_symbols,
data.large_text_symbols,
font_map,
small_font_symbol_conversion_table,
large_font_symbol_conversion_table,
# On 128x32 the SMALL/LARGE fonts are the larger Terminus 8x16/12x24;
# on smaller panels they are the original hand-drawn 6x8/12x16. Same
# array names so FontSectionInfo is unchanged.
f.write("#ifdef OLED_128x32\n")
f.write(make_terminus_table_cpp("USER_FONT_12", "12x24", data.large_text_symbols))
f.write(make_terminus_table_cpp("USER_FONT_6x8", "8x16", data.small_text_symbols))
f.write("#else\n")
f.write(
make_font_table_cpp(
data.small_text_symbols,
data.large_text_symbols,
font_map,
small_font_symbol_conversion_table,
large_font_symbol_conversion_table,
)
)
f.write(font_table_text)
f.write("#endif /* OLED_128x32 */\n")
f.write(
"const FontSection FontSectionInfo = {\n"
" .font12_start_ptr = USER_FONT_12,\n"
Expand All @@ -782,33 +871,38 @@ def render_font_block(data: LanguageData, f: TextIO, compress_font: bool = False
"};\n"
)
else:
font12_uncompressed = bytearray()
for sym in data.large_text_symbols:
font12_uncompressed.extend(font_map.font12_maps[sym])
font12_compressed = brieflz.compress(bytes(font12_uncompressed))
logging.info(
f"Font table 12x16 compressed from {len(font12_uncompressed)} to {len(font12_compressed)} bytes (ratio {len(font12_compressed) / len(font12_uncompressed):.3})"
)

write_bytes_as_c_array(f, "font_12x16_brieflz", font12_compressed)
font06_uncompressed = bytearray()
def emit_compressed(name: str, data_bytes: bytes) -> None:
write_bytes_as_c_array(f, name, brieflz.compress(data_bytes))

# 128x32 uses Terminus 8x16/12x24; smaller panels use the hand-drawn fonts.
# Same array/buffer names so FontSectionInfo is unchanged (sizes via sizeof).
f.write("#ifdef OLED_128x32\n")
t12 = terminus_block_bytes("12x24", data.large_text_symbols)
t06 = terminus_block_bytes("8x16", data.small_text_symbols)
emit_compressed("font_12x16_brieflz", t12)
emit_compressed("font_06x08_brieflz", t06)
f.write(f"static uint8_t font12_out_buffer[{len(t12)}];\n")
f.write(f"static uint8_t font06_out_buffer[{len(t06)}];\n")
f.write("#else\n")
h12 = bytearray()
for sym in data.large_text_symbols:
h12.extend(font_map.font12_maps[sym])
h06 = bytearray()
for sym in data.small_text_symbols:
font06_uncompressed.extend(font_map.font06_maps[sym])
font06_compressed = brieflz.compress(bytes(font06_uncompressed))
logging.info(
f"Font table 06x08 compressed from {len(font06_uncompressed)} to {len(font06_compressed)} bytes (ratio {len(font06_compressed) / len(font06_uncompressed):.3})"
)

write_bytes_as_c_array(f, "font_06x08_brieflz", font06_compressed)
h06.extend(font_map.font06_maps[sym])
emit_compressed("font_12x16_brieflz", bytes(h12))
emit_compressed("font_06x08_brieflz", bytes(h06))
f.write(f"static uint8_t font12_out_buffer[{len(h12)}];\n")
f.write(f"static uint8_t font06_out_buffer[{len(h06)}];\n")
f.write("#endif /* OLED_128x32 */\n")

f.write(
f"static uint8_t font12_out_buffer[{len(font12_uncompressed)}];\n"
f"static uint8_t font06_out_buffer[{len(font06_uncompressed)}];\n"
"const FontSection FontSectionInfo = {\n"
" .font12_start_ptr = font12_out_buffer,\n"
" .font06_start_ptr = font06_out_buffer,\n"
f" .font12_decompressed_size = {len(font12_uncompressed)},\n"
f" .font06_decompressed_size = {len(font06_uncompressed)},\n"
" .font12_decompressed_size = sizeof(font12_out_buffer),\n"
" .font06_decompressed_size = sizeof(font06_out_buffer),\n"
" .font12_compressed_source = font_12x16_brieflz,\n"
" .font06_compressed_source = font_06x08_brieflz,\n"
"};\n"
Expand Down Expand Up @@ -922,7 +1016,9 @@ def write_languages(
lang.get("languageLocalName", lang["languageCode"]) for lang in data.langs
]

f.write('#include "Translation_multi.h"')
f.write('#include "Translation_multi.h"\n')
# configuration.h defines OLED_128x32, which selects the larger font tables
f.write('#include "configuration.h"')

f.write(f"\n// ---- {lang_names} ----\n\n")

Expand Down Expand Up @@ -1102,10 +1198,13 @@ def add_encoded_string(
translated_string_lookups[translation_id] = record

def encode_string_and_add(
message: str, translation_id: str, force_large_text: bool = False
message: str,
translation_id: str,
force_large_text: bool = False,
force_small_text: bool = False,
):
encoded_data: bytes
if force_large_text is False and test_is_small_font(message):
if force_small_text or (force_large_text is False and test_is_small_font(message)):
encoded_data = convert_string_bytes(
small_font_symbol_conversion_table, message
)
Expand All @@ -1121,7 +1220,10 @@ def encode_string_and_add(
lang_data = lang["menuOptions"][record["id"]]
# Add to translations the menu text and the description
encode_string_and_add(
lang_data["description"], "menuOptions" + record["id"] + "description", True
lang_data["description"],
"menuOptions" + record["id"] + "description",
force_large_text=not DESCRIPTIONS_USE_SMALL_FONT,
force_small_text=DESCRIPTIONS_USE_SMALL_FONT,
)
encode_string_and_add(
lang_data["displayText"], "menuOptions" + record["id"] + "displayText"
Expand All @@ -1137,7 +1239,10 @@ def encode_string_and_add(
lang_data = lang["menuGroups"][record["id"]]
# Add to translations the menu text and the description
encode_string_and_add(
lang_data["description"], "menuGroups" + record["id"] + "description", True
lang_data["description"],
"menuGroups" + record["id"] + "description",
force_large_text=not DESCRIPTIONS_USE_SMALL_FONT,
force_small_text=DESCRIPTIONS_USE_SMALL_FONT,
)
encode_string_and_add(
lang_data["displayText"], "menuGroups" + record["id"] + "displayText"
Expand Down Expand Up @@ -1429,6 +1534,9 @@ def main() -> None:
else frozenset()
)

global DESCRIPTIONS_USE_SMALL_FONT
DESCRIPTIONS_USE_SMALL_FONT = "OLED_128x32" in macros

language_data: LanguageData
if args.input_pickled:
logging.info(f"Reading pickled language data from {args.input_pickled.name}...")
Expand Down
94 changes: 94 additions & 0 deletions Translations/terminus/OFL.TXT
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
Copyright (C) 2020 Dimitar Toshkov Zhekov,
with Reserved Font Name "Terminus Font".

This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
http://scripts.sil.org/OFL


-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------

PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.

The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.

DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.

"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).

"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).

"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.

"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.

PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:

1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.

2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.

3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.

4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.

5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.

TERMINATION
This license becomes null and void if any of the above conditions are
not met.

DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.
Loading