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:
@@ -45,12 +45,14 @@ class TS101Settings:
|
||||
DFU_PINECIL_ALT = 0
|
||||
DFU_PINECIL_VENDOR = 0x1209
|
||||
DFU_PINECIL_PRODUCT = 0xDB42
|
||||
|
||||
class MHP30Settings:
|
||||
IMAGE_ADDRESS = 0x08000000 + (126 * 1024)
|
||||
DFU_TARGET_NAME = b"IronOS-dfu"
|
||||
DFU_PINECIL_ALT = 0
|
||||
DFU_PINECIL_VENDOR = 0x1209
|
||||
DFU_PINECIL_PRODUCT = 0xDB42
|
||||
|
||||
class PinecilSettings:
|
||||
IMAGE_ADDRESS = 0x0801F800
|
||||
DFU_TARGET_NAME = b"Pinecil"
|
||||
@@ -66,7 +68,6 @@ class Pinecilv2Settings:
|
||||
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):
|
||||
# convert to luminance
|
||||
# do even if already black/white because PIL can't invert 1-bit so
|
||||
@@ -261,17 +262,20 @@ def img2hex(
|
||||
if len(data) < LCD_PAGE_SIZE:
|
||||
pad = [0] * (LCD_PAGE_SIZE - len(data))
|
||||
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
|
||||
elif device_model_name == "pinecilv1":
|
||||
elif device_name == "pinecilv1" or device_name == "pinecil":
|
||||
deviceSettings = PinecilSettings
|
||||
elif device_model_name == "pinecilv2":
|
||||
elif device_name == "pinecilv2":
|
||||
deviceSettings = Pinecilv2Settings
|
||||
elif device_model_name == "ts101":
|
||||
elif device_name == "ts101":
|
||||
deviceSettings = TS101Settings
|
||||
elif device_model_name == "s60":
|
||||
elif device_name == "s60":
|
||||
deviceSettings = S60Settings
|
||||
elif device_model_name == "mhp30":
|
||||
elif device_name == "mhp30":
|
||||
deviceSettings = MHP30Settings
|
||||
else:
|
||||
print("Could not determine device type")
|
||||
@@ -375,7 +379,6 @@ if __name__ == "__main__":
|
||||
print(f"Converting {args.input_filename} => {args.output_filename}")
|
||||
|
||||
|
||||
|
||||
img2hex(
|
||||
input_filename=args.input_filename,
|
||||
output_filename_base=args.output_filename,
|
||||
@@ -385,7 +388,6 @@ if __name__ == "__main__":
|
||||
dither=args.dither,
|
||||
negative=args.negative,
|
||||
make_erase_image=args.erase,
|
||||
|
||||
flip = False,
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user