From 3b02e3ea6fa4609f3cd854c9906281c558ec5b11 Mon Sep 17 00:00:00 2001 From: "Ben V. Brown" <5425387+Ralim@users.noreply.github.com> Date: Tue, 1 Aug 2023 21:38:09 +1000 Subject: [PATCH] Expanding supported devices (#35) --- .github/workflows/push.yml | 18 +++--- .github/workflows/release.yml | 108 +++++++++++++++++++++------------- Bootup Logos/README.md | 3 +- Bootup Logos/img2logo.py | 59 +++++++++++++++---- Bootup Logos/run.sh | 2 +- 5 files changed, 129 insertions(+), 61 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 883953c..90e3498 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -10,17 +10,19 @@ jobs: strategy: matrix: include: - - args: "-m" - model: "miniware" - - args: "-p" - model: "pinecil" + - model: "miniware" + - model: "pinecilv1" + - model: "pinecilv2" + - model: "mhp30" + - model: "ts101" + - model: "s60" fail-fast: true steps: - name: Install dependencies (apk) run: apk add --no-cache git python3 py3-pip zlib py3-pillow - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: submodules: true @@ -28,13 +30,13 @@ jobs: run: mkdir -p /tmp/${{ matrix.model }} - name: build all files for the device - run: cd Bootup\ Logos && ./run.sh /tmp/${{ matrix.model }}/ ${{matrix.args}} + run: cd Bootup\ Logos && ./run.sh /tmp/${{ matrix.model }}/ -m ${{matrix.model}} - name: build logo erase file - run: cd Bootup\ Logos && python3 img2logo.py -E erase_stored_image /tmp/${{ matrix.model }}/ ${{matrix.args}} + run: cd Bootup\ Logos && python3 img2logo.py -E erase_stored_image /tmp/${{ matrix.model }}/ -m ${{matrix.model}} - name: Archive artifacts - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: ${{ matrix.model }} path: | diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 95035ea..9c19f0f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,41 +1,69 @@ --- -name: "release" - -on: - push: - branches: - - "main" - -jobs: - release: - name: "Release" - runs-on: "ubuntu-22.04" - - steps: - - name: Install dependencies (apk) - run: sudo apt update && sudo apt-get install -y git python3 python3-pillow - - - uses: actions/checkout@v2 - with: - submodules: true - - - name: prep - run: mkdir -p /tmp/pinecil && mkdir -p /tmp/miniware - - - name: build all files for the device - run: cd Bootup\ Logos && ./run.sh /tmp/pinecil/ -p && ./run.sh /tmp/miniware/ -m - - - name: build logo erase file - run: cd Bootup\ Logos && python3 img2logo.py -E erase_stored_image /tmp/pinecil/ -p && python3 img2logo.py -E erase_stored_image /tmp/miniware/ -m - - - name: compress logo files - run: zip -rj pinecil.zip /tmp/pinecil/* && zip -rj miniware.zip /tmp/miniware/* - - - uses: "marvinpinto/action-automatic-releases@latest" - with: - repo_token: "${{ secrets.GITHUB_TOKEN }}" - automatic_release_tag: "latest" - prerelease: false - title: "Release" - files: | - *.zip + name: "release" + + on: + push: + branches: + - "main" + + jobs: + release: + name: "Release" + runs-on: "ubuntu-22.04" + + steps: + - name: Install dependencies (apk) + run: sudo apt update && sudo apt-get install -y git python3 python3-pillow + + - uses: actions/checkout@v3 + with: + submodules: true + + - name: prep + run: | + mkdir -p /tmp/pinecilv1 && \ + mkdir -p /tmp/pinecilv2 && \ + mkdir -p /tmp/miniware && \ + mkdir -p /tmp/ts101 && \ + mkdir -p /tmp/mhp30 && \ + mkdir -p /tmp/s60 + + - name: build all files for the device + run: | + cd Bootup\ Logos && \ + ./run.sh /tmp/pinecilv1/ -m pinecilv1 && \ + ./run.sh /tmp/pinecilv2/ -m pinecilv2 && \ + ./run.sh /tmp/miniware/ -m miniware && \ + ./run.sh /tmp/ts101/ -m ts101 && \ + ./run.sh /tmp/mhp30/ -m mhp30 && \ + ./run.sh /tmp/s60/ -m s60 + + - name: build logo erase file + run: | + cd Bootup\ Logos && \ + python3 img2logo.py -E erase_stored_image /tmp/pinecilv1/ -m pinecilv1 && \ + python3 img2logo.py -E erase_stored_image /tmp/pinecilv2/ -m pinecilv2 && \ + python3 img2logo.py -E erase_stored_image /tmp/miniware/ -m miniware && \ + python3 img2logo.py -E erase_stored_image /tmp/ts101/ -m ts101 && \ + python3 img2logo.py -E erase_stored_image /tmp/mhp30/ -m mhp30 && \ + python3 img2logo.py -E erase_stored_image /tmp/s60/ -m s60 + + + - name: compress logo files + run: | + zip -rj pinecilv1.zip /tmp/pinecilv1/* && \ + zip -rj miniware.zip /tmp/miniware/* && \ + zip -rj pinecilv2.zip /tmp/pinecilv2/* && \ + zip -rj ts101.zip /tmp/ts101/* && \ + zip -rj mhp30.zip /tmp/mhp30/* && \ + zip -rj s60.zip /tmp/s60/* + + - uses: "marvinpinto/action-automatic-releases@latest" + with: + repo_token: "${{ secrets.GITHUB_TOKEN }}" + automatic_release_tag: "latest" + prerelease: false + title: "Release" + files: | + *.zip + \ No newline at end of file diff --git a/Bootup Logos/README.md b/Bootup Logos/README.md index 4f824e4..b765269 100644 --- a/Bootup Logos/README.md +++ b/Bootup Logos/README.md @@ -1,3 +1,5 @@ +# Boot up Logos + ## Boot up logo's are logos or animations shown on boot of IronOS These are programmed into the device just like the normal firmware. @@ -51,7 +53,6 @@ This just overwrites individual bytes in the output buffer. |![Alt text](https://github.com/Ralim/IronOS-Meta/blob/main/Bootup%20Logos/Images/wh_40k.png)|wh_40k.png|| |![Alt text](https://github.com/Ralim/IronOS-Meta/blob/main/Bootup%20Logos/Images/wwii_kilroy.png)|wwii_kilroy.png|| - **Animated logos** |Logo \* |Filename |Note | |:-------------:|:-------------:|:-----:| diff --git a/Bootup Logos/img2logo.py b/Bootup Logos/img2logo.py index cdcaea3..fdb598a 100755 --- a/Bootup Logos/img2logo.py +++ b/Bootup Logos/img2logo.py @@ -32,13 +32,39 @@ class MiniwareSettings: DFU_PINECIL_VENDOR = 0x1209 DFU_PINECIL_PRODUCT = 0xDB42 - +class S60Settings: + IMAGE_ADDRESS = 0x08000000 + (62 * 1024) + DFU_TARGET_NAME = b"IronOS-dfu" + DFU_PINECIL_ALT = 0 + DFU_PINECIL_VENDOR = 0x1209 + DFU_PINECIL_PRODUCT = 0xDB42 + +class TS101Settings: + IMAGE_ADDRESS = 0x08000000 + (126 * 1024) + DFU_TARGET_NAME = b"IronOS-dfu" + 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" DFU_PINECIL_ALT = 0 DFU_PINECIL_VENDOR = 0x28E9 DFU_PINECIL_PRODUCT = 0x0189 + +class Pinecilv2Settings: + IMAGE_ADDRESS = (1016 * 1024) # its 2 4k erase pages inset + DFU_TARGET_NAME = b"Pinecilv2" + DFU_PINECIL_ALT = 0 + 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 + def still_image_to_bytes(image: Image, negative: bool, dither: bool, threshold: int, preview_filename): @@ -190,11 +216,11 @@ def animated_image_to_bytes(imageIn: Image, negative: bool, dither: bool, thresh def img2hex( input_filename, + device_model_name:str, preview_filename=None, threshold=128, dither=False, negative=False, - isPinecil=False, make_erase_image=False, output_filename_base="out", flip=False, @@ -235,9 +261,21 @@ def img2hex( if len(data) < LCD_PAGE_SIZE: pad = [0] * (LCD_PAGE_SIZE - len(data)) data.extend(pad) - deviceSettings = MiniwareSettings - if isPinecil: + if device_model_name == "miniware": + deviceSettings = MiniwareSettings + elif device_model_name == "pinecilv1": deviceSettings = PinecilSettings + elif device_model_name == "pinecilv2": + deviceSettings = Pinecilv2Settings + elif device_model_name == "ts101": + deviceSettings = TS101Settings + elif device_model_name == "s60": + deviceSettings = S60Settings + elif device_model_name == "mhp30": + deviceSettings = MHP30Settings + else: + print("Could not determine device type") + sys.exit(-1) # Split name from extension so we can mangle in the _L suffix for flipped images split_name = os.path.splitext( os.path.basename(input_filename)) @@ -313,8 +351,7 @@ def parse_commandline(): help="generate a logo erase file instead of a logo", ) - parser.add_argument("-p", "--pinecil", action="store_true", help="generate files for Pinecil") - parser.add_argument("-m", "--miniware", action="store_true", help="generate files for miniware") + parser.add_argument("-m", "--model", help="device model name") parser.add_argument( "-v", "--version", @@ -334,32 +371,32 @@ if __name__ == "__main__": sys.stderr.write('Won\'t overwrite existing file "{}" (use --force ' "option to override)\n".format(args.preview)) sys.exit(1) - if args.miniware == False and args.pinecil == False: - sys.stderr.write("You must provide --miniware or --pinecil to select your model") - sys.exit(1) print(f"Converting {args.input_filename} => {args.output_filename}") + + img2hex( input_filename=args.input_filename, output_filename_base=args.output_filename, + device_model_name=args.model, preview_filename=args.preview, threshold=args.threshold, dither=args.dither, negative=args.negative, make_erase_image=args.erase, - isPinecil=args.pinecil, + flip = False, ) img2hex( input_filename=args.input_filename, output_filename_base=args.output_filename, + device_model_name=args.model, preview_filename=args.preview, threshold=args.threshold, dither=args.dither, negative=args.negative, make_erase_image=args.erase, - isPinecil=args.pinecil, flip = True, ) diff --git a/Bootup Logos/run.sh b/Bootup Logos/run.sh index ad348a2..546919c 100755 --- a/Bootup Logos/run.sh +++ b/Bootup Logos/run.sh @@ -2,4 +2,4 @@ echo $1 echo $2 set -e -find Images/ -type f -exec python3 img2logo.py {} "$1" "$2" \; +find Images/ -type f -exec python3 img2logo.py {} "$1" "$2" "$3" \;