Skip to content

Commit dc0cd19

Browse files
committed
bootanimation: decouple loading from animation
1 parent 413d60c commit dc0cd19

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

loader/main.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -150,29 +150,29 @@ static int loader(const struct shell *sh)
150150
memset(ram_firmware, 0, 64 * 1024);
151151
*ram_start = &ram_firmware[0];
152152
}
153-
if (gpio_pin_get_dt(&spec) == 0 || (ram_firmware != NULL)) {
153+
if (gpio_pin_get_dt(&spec) == 0) {
154154
matrixBegin();
155155
matrixSetGrayscaleBits(8);
156-
while (gpio_pin_get_dt(&spec) == 0 || (ram_firmware != NULL)) {
156+
while (gpio_pin_get_dt(&spec) == 0) {
157157
matrixPlay(_bootanimation, _bootanimation_len);
158-
if (ram_firmware != NULL) {
159-
printk("Trying to load firmware from RAM: %p\n", ram_firmware);
160-
// poll the first bytes, if filled try to use them for booting
161-
sketch_hdr = (struct sketch_header_v1 *)(ram_firmware + 7);
162-
if (sketch_hdr->ver == 0x1 && sketch_hdr->magic == 0x2341) {
163-
// Found valid data, use it for booting
164-
base_addr = (uintptr_t)ram_firmware;
165-
*ram_start = 0;
166-
break;
167-
}
168-
}
169158
}
170159
matrixPlay(_bootanimation_end, _bootanimation_end_len);
171160
uint8_t _framebuffer[104] = {0};
172161
matrixGrayscaleWrite(_framebuffer);
173162
k_sleep(K_MSEC(10));
174163
matrixEnd();
175164
}
165+
while (!sketch_valid) {
166+
__asm__("bkpt");
167+
// poll the first bytes, if filled try to use them for booting
168+
sketch_hdr = (struct sketch_header_v1 *)(ram_firmware + 7);
169+
if (sketch_hdr->ver == 0x1 && sketch_hdr->magic == 0x2341) {
170+
// Found valid data, use it for booting
171+
base_addr = (uintptr_t)ram_firmware;
172+
*ram_start = 0;
173+
sketch_valid = true;
174+
}
175+
}
176176
}
177177
#endif
178178

0 commit comments

Comments
 (0)