forked from me/IronOS-Meta
Refactor more
This commit is contained in:
2
.github/workflows/push.yml
vendored
2
.github/workflows/push.yml
vendored
@@ -28,7 +28,7 @@ jobs:
|
|||||||
run: mkdir -p /tmp/${{ matrix.model }}
|
run: mkdir -p /tmp/${{ matrix.model }}
|
||||||
|
|
||||||
- name: build test
|
- 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
|
- name: Archive artifacts
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v2
|
||||||
|
|||||||
@@ -1,12 +1,22 @@
|
|||||||
|
|
||||||
## Boot up logo's are logos or animations shown on boot of IronOS
|
## 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.
|
They can be (re)programmed as many times as desired after flashing the normal firmware.
|
||||||
|
|
||||||
|
|
||||||
### Data storage format
|
### 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 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
|
||||||
|
|||||||
@@ -131,7 +131,6 @@ def animated_image_to_bytes(imageIn: Image, negative: bool, dither: bool, thresh
|
|||||||
frameData = []
|
frameData = []
|
||||||
frameTiming = None
|
frameTiming = None
|
||||||
for framenum in range(0, imageIn.n_frames):
|
for framenum in range(0, imageIn.n_frames):
|
||||||
print(f"Frame {framenum}")
|
|
||||||
imageIn.seek(framenum)
|
imageIn.seek(framenum)
|
||||||
image = imageIn
|
image = imageIn
|
||||||
|
|
||||||
@@ -206,8 +205,9 @@ def img2hex(
|
|||||||
data = animated_image_to_bytes(image, negative, dither, threshold)
|
data = animated_image_to_bytes(image, negative, dither, threshold)
|
||||||
else:
|
else:
|
||||||
# magic/required header
|
# magic/required header
|
||||||
data = [DATA_PROGRAMMED_MARKER, 0xBB]
|
data = [DATA_PROGRAMMED_MARKER, 0x00] # Timing value of 0
|
||||||
data.extend(still_image_to_bytes(image, negative, dither, threshold, preview_filename))
|
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
|
# Pad up to the full page size
|
||||||
if len(data) < LCD_PAGE_SIZE:
|
if len(data) < LCD_PAGE_SIZE:
|
||||||
@@ -217,8 +217,9 @@ def img2hex(
|
|||||||
if isPinecil:
|
if isPinecil:
|
||||||
deviceSettings = PinecilSettings
|
deviceSettings = PinecilSettings
|
||||||
# Generate both possible outputs
|
# Generate both possible outputs
|
||||||
|
output_name = output_filename_base + os.path.basename(input_filename)
|
||||||
DFUOutput.writeFile(
|
DFUOutput.writeFile(
|
||||||
output_filename_base + ".dfu",
|
output_name + ".dfu",
|
||||||
data,
|
data,
|
||||||
deviceSettings.IMAGE_ADDRESS,
|
deviceSettings.IMAGE_ADDRESS,
|
||||||
deviceSettings.DFU_TARGET_NAME,
|
deviceSettings.DFU_TARGET_NAME,
|
||||||
@@ -226,7 +227,7 @@ def img2hex(
|
|||||||
deviceSettings.DFU_PINECIL_PRODUCT,
|
deviceSettings.DFU_PINECIL_PRODUCT,
|
||||||
deviceSettings.DFU_PINECIL_VENDOR,
|
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():
|
def parse_commandline():
|
||||||
@@ -273,7 +274,6 @@ def parse_commandline():
|
|||||||
help="use dithering (speckling) to convert gray or " "color to black and white",
|
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(
|
parser.add_argument(
|
||||||
"-E",
|
"-E",
|
||||||
"--erase",
|
"--erase",
|
||||||
@@ -297,21 +297,17 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
args = parse_commandline()
|
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:
|
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.stderr.write('Won\'t overwrite existing file "{}" (use --force ' "option to override)\n".format(args.preview))
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
img2hex(
|
img2hex(
|
||||||
input_filename=args.input_filename,
|
input_filename=args.input_filename,
|
||||||
|
output_filename_base=args.output_filename,
|
||||||
preview_filename=args.preview,
|
preview_filename=args.preview,
|
||||||
threshold=args.threshold,
|
threshold=args.threshold,
|
||||||
dither=args.dither,
|
dither=args.dither,
|
||||||
negative=args.negative,
|
negative=args.negative,
|
||||||
make_erase_image=args.erase,
|
make_erase_image=args.erase,
|
||||||
output_filename_base=args.output_filename,
|
|
||||||
isPinecil=args.pinecil,
|
isPinecil=args.pinecil,
|
||||||
)
|
)
|
||||||
|
|||||||
4
Bootup Logos/run.sh
Executable file
4
Bootup Logos/run.sh
Executable file
@@ -0,0 +1,4 @@
|
|||||||
|
#! /bin/sh
|
||||||
|
echo $1
|
||||||
|
echo $2
|
||||||
|
find Images/ -type f -exec python img2logo.py {} "$1" "$2" \;
|
||||||
Reference in New Issue
Block a user