forked from me/IronOS-Meta
Make -m MODEL argument compatible with the main IronOS project build files & configs (+unify code style a bit) (#40)
* Add model name input argument compatibility with main IronOS project * Fix var name according to PEP8 / code review
This commit is contained in:
@@ -38,33 +38,34 @@ class S60Settings:
|
|||||||
DFU_PINECIL_ALT = 0
|
DFU_PINECIL_ALT = 0
|
||||||
DFU_PINECIL_VENDOR = 0x1209
|
DFU_PINECIL_VENDOR = 0x1209
|
||||||
DFU_PINECIL_PRODUCT = 0xDB42
|
DFU_PINECIL_PRODUCT = 0xDB42
|
||||||
|
|
||||||
class TS101Settings:
|
class TS101Settings:
|
||||||
IMAGE_ADDRESS = 0x08000000 + (126 * 1024)
|
IMAGE_ADDRESS = 0x08000000 + (126 * 1024)
|
||||||
DFU_TARGET_NAME = b"IronOS-dfu"
|
DFU_TARGET_NAME = b"IronOS-dfu"
|
||||||
DFU_PINECIL_ALT = 0
|
DFU_PINECIL_ALT = 0
|
||||||
DFU_PINECIL_VENDOR = 0x1209
|
DFU_PINECIL_VENDOR = 0x1209
|
||||||
DFU_PINECIL_PRODUCT = 0xDB42
|
DFU_PINECIL_PRODUCT = 0xDB42
|
||||||
|
|
||||||
class MHP30Settings:
|
class MHP30Settings:
|
||||||
IMAGE_ADDRESS = 0x08000000 + (126 * 1024)
|
IMAGE_ADDRESS = 0x08000000 + (126 * 1024)
|
||||||
DFU_TARGET_NAME = b"IronOS-dfu"
|
DFU_TARGET_NAME = b"IronOS-dfu"
|
||||||
DFU_PINECIL_ALT = 0
|
DFU_PINECIL_ALT = 0
|
||||||
DFU_PINECIL_VENDOR = 0x1209
|
DFU_PINECIL_VENDOR = 0x1209
|
||||||
DFU_PINECIL_PRODUCT = 0xDB42
|
DFU_PINECIL_PRODUCT = 0xDB42
|
||||||
|
|
||||||
class PinecilSettings:
|
class PinecilSettings:
|
||||||
IMAGE_ADDRESS = 0x0801F800
|
IMAGE_ADDRESS = 0x0801F800
|
||||||
DFU_TARGET_NAME = b"Pinecil"
|
DFU_TARGET_NAME = b"Pinecil"
|
||||||
DFU_PINECIL_ALT = 0
|
DFU_PINECIL_ALT = 0
|
||||||
DFU_PINECIL_VENDOR = 0x28E9
|
DFU_PINECIL_VENDOR = 0x28E9
|
||||||
DFU_PINECIL_PRODUCT = 0x0189
|
DFU_PINECIL_PRODUCT = 0x0189
|
||||||
|
|
||||||
class Pinecilv2Settings:
|
class Pinecilv2Settings:
|
||||||
IMAGE_ADDRESS = (1016 * 1024) # its 2 4k erase pages inset
|
IMAGE_ADDRESS = (1016 * 1024) # its 2 4k erase pages inset
|
||||||
DFU_TARGET_NAME = b"Pinecilv2"
|
DFU_TARGET_NAME = b"Pinecilv2"
|
||||||
DFU_PINECIL_ALT = 0
|
DFU_PINECIL_ALT = 0
|
||||||
DFU_PINECIL_VENDOR = 0x28E9 # These are ignored by blisp so doesnt matter what we use
|
DFU_PINECIL_VENDOR = 0x28E9 # These are ignored by blisp so doesnt matter what we use
|
||||||
DFU_PINECIL_PRODUCT = 0x0189 # These are ignored by blisp so doesnt matter what we use
|
DFU_PINECIL_PRODUCT = 0x0189 # These are ignored by blisp so doesnt matter what we use
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def still_image_to_bytes(image: Image, negative: bool, dither: bool, threshold: int, preview_filename):
|
def still_image_to_bytes(image: Image, negative: bool, dither: bool, threshold: int, preview_filename):
|
||||||
@@ -261,17 +262,20 @@ def img2hex(
|
|||||||
if len(data) < LCD_PAGE_SIZE:
|
if len(data) < LCD_PAGE_SIZE:
|
||||||
pad = [0] * (LCD_PAGE_SIZE - len(data))
|
pad = [0] * (LCD_PAGE_SIZE - len(data))
|
||||||
data.extend(pad)
|
data.extend(pad)
|
||||||
if device_model_name == "miniware":
|
|
||||||
|
# Set device settings depending on input `-m` argument
|
||||||
|
device_name = device_model_name.lower()
|
||||||
|
if device_name == "miniware" or device_name == "ts100" or device_name == "ts80" or device_name == "ts80p":
|
||||||
deviceSettings = MiniwareSettings
|
deviceSettings = MiniwareSettings
|
||||||
elif device_model_name == "pinecilv1":
|
elif device_name == "pinecilv1" or device_name == "pinecil":
|
||||||
deviceSettings = PinecilSettings
|
deviceSettings = PinecilSettings
|
||||||
elif device_model_name == "pinecilv2":
|
elif device_name == "pinecilv2":
|
||||||
deviceSettings = Pinecilv2Settings
|
deviceSettings = Pinecilv2Settings
|
||||||
elif device_model_name == "ts101":
|
elif device_name == "ts101":
|
||||||
deviceSettings = TS101Settings
|
deviceSettings = TS101Settings
|
||||||
elif device_model_name == "s60":
|
elif device_name == "s60":
|
||||||
deviceSettings = S60Settings
|
deviceSettings = S60Settings
|
||||||
elif device_model_name == "mhp30":
|
elif device_name == "mhp30":
|
||||||
deviceSettings = MHP30Settings
|
deviceSettings = MHP30Settings
|
||||||
else:
|
else:
|
||||||
print("Could not determine device type")
|
print("Could not determine device type")
|
||||||
@@ -373,9 +377,8 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
|
|
||||||
print(f"Converting {args.input_filename} => {args.output_filename}")
|
print(f"Converting {args.input_filename} => {args.output_filename}")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
img2hex(
|
img2hex(
|
||||||
input_filename=args.input_filename,
|
input_filename=args.input_filename,
|
||||||
output_filename_base=args.output_filename,
|
output_filename_base=args.output_filename,
|
||||||
@@ -385,10 +388,9 @@ if __name__ == "__main__":
|
|||||||
dither=args.dither,
|
dither=args.dither,
|
||||||
negative=args.negative,
|
negative=args.negative,
|
||||||
make_erase_image=args.erase,
|
make_erase_image=args.erase,
|
||||||
|
|
||||||
flip = False,
|
flip = False,
|
||||||
)
|
)
|
||||||
|
|
||||||
img2hex(
|
img2hex(
|
||||||
input_filename=args.input_filename,
|
input_filename=args.input_filename,
|
||||||
output_filename_base=args.output_filename,
|
output_filename_base=args.output_filename,
|
||||||
|
|||||||
Reference in New Issue
Block a user