1
0
forked from me/IronOS

Merge branch 'master' into master

This commit is contained in:
Ben V. Brown
2022-02-02 22:49:56 +11:00
committed by GitHub
6 changed files with 58 additions and 28 deletions

Binary file not shown.

View File

@@ -1,8 +1,7 @@
#!/usr/bin/env python
# coding=utf-8
from __future__ import division
import os
import sys
import os, sys, struct, zlib
try:
@@ -13,7 +12,7 @@ except ImportError as error:
"management tool."
.format(error, sys.argv[0]))
VERSION_STRING = '0.02'
VERSION_STRING = '0.03'
LCD_WIDTH = 96
LCD_HEIGHT = 16
@@ -26,12 +25,23 @@ INTELHEX_EXTENDED_LINEAR_ADDRESS_RECORD = 0x04
INTELHEX_BYTES_PER_LINE = 16
INTELHEX_MINIMUM_SIZE = 4096
DFU_PINECIL_ALT = 0
DFU_PINECIL_VENDOR = 0x28e9
DFU_PINECIL_PRODUCT = 0x0189
DFU_LOGO_ADDRESS = 0x0801F800
DFU_TARGET_NAME = b"Pinecil"
DFU_PREFIX_SIZE = 11
DFU_SUFFIX_SIZE = 16
def split16(word):
"""return high and low byte of 16-bit word value as tuple"""
return (word >> 8) & 0xff, word & 0xff
def compute_crc(data):
return 0xFFFFFFFF & -zlib.crc32(data) - 1
def intel_hex_line(record_type, offset, data):
"""generate a line of data in Intel hex format"""
# length, address offset, record type
@@ -82,6 +92,32 @@ def intel_hex(file, bytes_, start_address=0x0):
write(intel_hex_line(INTELHEX_END_OF_FILE_RECORD, 0, ()))
def build_dfu(file, bytes_):
data = b""
for byte in bytes_:
data += byte.to_bytes(1, byteorder="big")
data = (
struct.pack("<2I", DFU_LOGO_ADDRESS, len(data)) + data
)
data = (
struct.pack(
"<6sBI255s2I", b"Target", DFU_PINECIL_ALT, 1, DFU_TARGET_NAME, len(data), 1
)
+ data
)
data = (
struct.pack(
"<5sBIB", b"DfuSe", 1, DFU_PREFIX_SIZE + len(data) + DFU_SUFFIX_SIZE, 1
)
+ data
)
data += struct.pack("<4H3sB", 0, DFU_PINECIL_PRODUCT, DFU_PINECIL_VENDOR, 0x011A, b"UFD", DFU_SUFFIX_SIZE)
crc = compute_crc(data)
data += struct.pack("<I", crc)
file.write(data)
def img2hex(input_filename,
output_file,
preview_filename=None,
@@ -160,8 +196,7 @@ def img2hex(input_filename,
data[4 + ndx + (1 if ndx % 2 == 0 else -1)] = byte
if binary:
for byte in data:
output_file.write(byte.to_bytes(1, byteorder="big"))
build_dfu(output_file, data)
else:
intel_hex(output_file, data, 0x0800F800)
@@ -234,7 +269,7 @@ if __name__ == "__main__":
sys.exit(1)
try:
if args.output_filename[-4:] == ".bin":
if args.output_filename[-4:] == ".dfu":
with open(args.output_filename, 'wb') as output:
img2hex(args.input_filename,
output,

View File

@@ -28,10 +28,10 @@ You perform this the same way as if you were flashing a new firmware, and all of
### Pinecil
For the Pinecil, we require to flash the logo using dfu-util instead, which will only take `.bin` files rather than `.hex`.
For the Pinecil, we require to flash the logo using dfu-util instead.
To flash the logo, use the following steps:
- `python3 img2ts100.py input.png logo.bin`
- `dfu-util -d 28e9:0189 -a 0 -D logo.bin -s 0x0801F800`
- `python3 img2ts100.py input.png logo.dfu`
- `dfu-util -D logo.dfu`
The converter will create a binary file if the .bin extension is used. Use dfu-util to flash it in the right location.
The converter will create a DFU instead of a HEX file if the .dfu extension is used.

View File

@@ -2,44 +2,39 @@
"languageCode": "RU",
"languageLocalName": "Русский",
"fonts": ["ascii_basic", "latin_extended", "cyrillic"],
"tempUnitFahrenheit": false,
"messages": {
"SettingsCalibrationDone": "Калибровка завершена!",
"SettingsCalibrationWarning": "Прежде чем продолжить, пожалуйста, убедитесь, что жало имеет комнатную температуру!",
"SettingsResetWarning": "Вы уверены, что хотите сбросить настройки к значениям по умолчанию?",
"UVLOWarningString": "НАПРЯЖ--",
"UndervoltageString": "Низкое напряжение",
"UndervoltageString": "Низ. напряжение",
"InputVoltageString": "Питание В: ",
"WarningTipTempString": "Темп. жала: ",
"BadTipString": "ЖАЛО--",
"SleepingSimpleString": "Zzzz",
"SleepingAdvancedString": "Ожидание...",
"WarningSimpleString": "ГОРЯЧО!",
"WarningAdvancedString": "!!! ГОРЯЧЕЕ !!!\n!!! ЖАЛО !!!",
"SleepingTipAdvancedString": "Жало:",
"IdleTipString": "Жало:",
"IdleSetString": " ->",
"TipDisconnectedString": "ЖАЛО ОТСОЕДИНЕНО",
"SolderingAdvancedPowerPrompt": "Питание: ",
"OffString": "Выкл.",
"YourGainMessage": "Прирост:"
"OffString": "Вык"
},
"messagesWarn": {
"ResetOKMessage": "Сброс OK",
"SettingsResetMessage": ["Настройки", "сброшены!"],
"NoAccelerometerMessage": ["Не определен", "акселерометр!"],
"NoPowerDeliveryMessage": ["No USB-PD IC", "detected!"],
"LockingKeysString": "LOCKED",
"UnlockingKeysString": "UNLOCKED",
"WarningKeysLockedString": "!LOCKED!",
"NoPowerDeliveryMessage": ["USB-PD питание", "не обнаружено"],
"LockingKeysString": "ЗАБЛОК",
"UnlockingKeysString": "РАЗБЛОК",
"WarningKeysLockedString": "!ЗАБЛОК!",
"WarningThermalRunaway": ["Thermal", "Runaway"]
},
"characters": {
"SettingRightChar": "П",
"SettingLeftChar": "Л",
"SettingAutoChar": "А",
"SettingOffChar": "O",
"SettingOffChar": "О",
"SettingSlowChar": "М",
"SettingMediumChar": "M",
"SettingMediumChar": "С",
"SettingFastChar": "Б",
"SettingStartNoneChar": "В",
"SettingStartSolderingChar": "П",
@@ -131,7 +126,7 @@
},
"VoltageCalibration": {
"text2": ["Калибровка", "напряжения"],
"desc": "Калибровка входного напряжения (длинное нажатие для выхода)"
"desc": "Калибровка входного напряжения (долгое нажатие для выхода)"
},
"AdvancedSoldering": {
"text2": ["Подробный", "экран пайки"],
@@ -170,7 +165,7 @@
"desc": "Сила импульса удерживающего от сна повербанк или другой источник питания"
},
"HallEffSensitivity": {
"text2": ["Эффект Холла", "чувствительность"],
"text2": ["Датчик", "Холла"],
"desc": "Уровень чувствительности датчика холла в режиме сна (О=Отключено | Н=Низкий | С=Средний | В=Высокий)"
},
"LockingMode": {
@@ -199,7 +194,7 @@
},
"LanguageSwitch": {
"text2": ["Язык:", " RU Русский"],
"desc": ""
"desc": "Язык прошивки"
},
"Brightness": {
"text2": ["Яркость", "экрана"],