1
0
forked from me/IronOS-Meta

Refactor more

This commit is contained in:
Ben V. Brown
2022-02-14 22:17:48 +11:00
parent a526c3bb0d
commit 90b2e2c311
4 changed files with 26 additions and 16 deletions

View File

@@ -28,7 +28,7 @@ jobs:
run: mkdir -p /tmp/${{ matrix.model }}
- name: build test
run: cd Bootup\ Logos && python3 img2logo.py ${{matrix.args}} Images/IronOS.gif /tmp/${{ matrix.model }}/IronOS.gif
run: cd Bootup\ Logos && ./run.sh /tmp/${{ matrix.model }}/ ${{matrix.args}}
- name: Archive artifacts
uses: actions/upload-artifact@v2

View File

@@ -1,12 +1,22 @@
## Boot up logo's are logos or animations shown on boot of IronOS
These are programmed into the device just like the normal firmware.
These are programmed into the device just like the normal firmware.
They can be (re)programmed as many times as desired after flashing the normal firmware.
### Data storage format
The data is stored into the second last page of flash, this gives 1024 bytes of space for the entire payload of bootup logo data.
The first byte is marked purely to
The first byte is marked purely to indicate that the page is programmed and which revision of the boot logo logic it is
The next byte indicates the frame timing in milliseconds, or `0` to indicate only show first frame for whole bootloader duration (still image mode)
Then the OLED buffer is cleared to black, then every frame is encoded as either:
### Full frame updates
`[0xFF][Full framebuffer of data]`
### Delta frame update
`[count of updates][[index,data][index,data][index,data][index,data]]`
Where index is byte location into screen buffer, and data is the new byte to plonk down there
This just overwrites individual bytes in the output buffer

View File

@@ -131,7 +131,6 @@ def animated_image_to_bytes(imageIn: Image, negative: bool, dither: bool, thresh
frameData = []
frameTiming = None
for framenum in range(0, imageIn.n_frames):
print(f"Frame {framenum}")
imageIn.seek(framenum)
image = imageIn
@@ -206,8 +205,9 @@ def img2hex(
data = animated_image_to_bytes(image, negative, dither, threshold)
else:
# magic/required header
data = [DATA_PROGRAMMED_MARKER, 0xBB]
data.extend(still_image_to_bytes(image, negative, dither, threshold, preview_filename))
data = [DATA_PROGRAMMED_MARKER, 0x00] # Timing value of 0
image_bytes = still_image_to_bytes(image, negative, dither, threshold, preview_filename)
data.extend(get_screen_blob([0] * LCD_NUM_BYTES, image_bytes))
# Pad up to the full page size
if len(data) < LCD_PAGE_SIZE:
@@ -217,8 +217,9 @@ def img2hex(
if isPinecil:
deviceSettings = PinecilSettings
# Generate both possible outputs
output_name = output_filename_base + os.path.basename(input_filename)
DFUOutput.writeFile(
output_filename_base + ".dfu",
output_name + ".dfu",
data,
deviceSettings.IMAGE_ADDRESS,
deviceSettings.DFU_TARGET_NAME,
@@ -226,7 +227,7 @@ def img2hex(
deviceSettings.DFU_PINECIL_PRODUCT,
deviceSettings.DFU_PINECIL_VENDOR,
)
HexOutput.writeFile(output_filename_base + ".hex", data, deviceSettings.IMAGE_ADDRESS)
HexOutput.writeFile(output_name + ".hex", data, deviceSettings.IMAGE_ADDRESS)
def parse_commandline():
@@ -273,7 +274,6 @@ def parse_commandline():
help="use dithering (speckling) to convert gray or " "color to black and white",
)
parser.add_argument("-f", "--force", action="store_true", help="force overwriting of existing files")
parser.add_argument(
"-E",
"--erase",
@@ -297,21 +297,17 @@ if __name__ == "__main__":
args = parse_commandline()
if os.path.exists(args.output_filename) and not args.force:
sys.stderr.write('Won\'t overwrite existing file "{}" (use --force ' "option to override)\n".format(args.output_filename))
sys.exit(1)
if args.preview and os.path.exists(args.preview) and not args.force:
sys.stderr.write('Won\'t overwrite existing file "{}" (use --force ' "option to override)\n".format(args.preview))
sys.exit(1)
img2hex(
input_filename=args.input_filename,
output_filename_base=args.output_filename,
preview_filename=args.preview,
threshold=args.threshold,
dither=args.dither,
negative=args.negative,
make_erase_image=args.erase,
output_filename_base=args.output_filename,
isPinecil=args.pinecil,
)

4
Bootup Logos/run.sh Executable file
View File

@@ -0,0 +1,4 @@
#! /bin/sh
echo $1
echo $2
find Images/ -type f -exec python img2logo.py {} "$1" "$2" \;