Skip to content

Commit 30b9a96

Browse files
committed
fast mode
1 parent 2439aab commit 30b9a96

File tree

3 files changed

+29
-24
lines changed

3 files changed

+29
-24
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@ You can start editing the page by modifying `src/app/index.jsx`. The page auto-u
1818
**Helpful for debugging**
1919
* [chrome://usb-internals/](chrome://usb-internals/)
2020
* [chrome://device-log/](chrome://device-log/)
21+
* Add `?fast=1` to the URL to skip flashing the system partition (the slowest). Useful for testing the full flow quickly.

src/app/Flash.jsx

Lines changed: 14 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -137,29 +137,20 @@ function LinearProgress({ value, barColor }) {
137137

138138
function DeviceState({ serial }) {
139139
return (
140-
<div className="mt-8 p-4 sm:min-w-[350px] border border-gray-200 dark:border-gray-600 bg-white dark:bg-gray-700 text-black dark:text-white rounded-md flex flex-row gap-2">
141-
<div className="flex flex-row gap-2">
142-
<svg
143-
xmlns="http://www.w3.org/2000/svg"
144-
viewBox="0 96 960 960"
145-
className="text-green-500 dark:text-[#51ff00]"
146-
height="24"
147-
width="24"
148-
>
149-
<path
150-
fill="currentColor"
151-
d="M480 976q-32 0-52-20t-20-52q0-22 11-40t31-29V724H302q-24 0-42-18t-18-42V555q-20-9-31-26.609-11-17.608-11-40.108Q200 456 220 436t52-20q32 0 52 20t20 52.411Q344 511 333 528.5T302 555v109h148V324h-80l110-149 110 149h-80v340h148V560h-42V416h144v144h-42v104q0 24-18 42t-42 18H510v111q19.95 10.652 30.975 29.826Q552 884 552 904q0 32-20 52t-52 20Z"
152-
/>
153-
</svg>
154-
Device connected
155-
</div>
156-
<span className="text-gray-400">|</span>
157-
<div className="flex flex-row gap-2">
158-
<span>
159-
Serial:
160-
<span className="ml-2 font-mono">{serial || 'unknown'}</span>
161-
</span>
162-
</div>
140+
<div className="mt-8 p-3 px-4 border border-gray-200 dark:border-gray-600 bg-white dark:bg-gray-700 text-black dark:text-white rounded-md flex flex-row items-center gap-2">
141+
<svg
142+
xmlns="http://www.w3.org/2000/svg"
143+
viewBox="0 96 960 960"
144+
className="text-green-500 dark:text-[#51ff00]"
145+
height="20"
146+
width="20"
147+
>
148+
<path
149+
fill="currentColor"
150+
d="M480 976q-32 0-52-20t-20-52q0-22 11-40t31-29V724H302q-24 0-42-18t-18-42V555q-20-9-31-26.609-11-17.608-11-40.108Q200 456 220 436t52-20q32 0 52 20t20 52.411Q344 511 333 528.5T302 555v109h148V324h-80l110-149 110 149h-80v340h148V560h-42V416h144v144h-42v104q0 24-18 42t-42 18H510v111q19.95 10.652 30.975 29.826Q552 884 552 904q0 32-20 52t-52 20Z"
151+
/>
152+
</svg>
153+
<span className="font-mono">Device serial: {serial || 'unknown'}</span>
163154
</div>
164155
)
165156
}

src/utils/manager.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@ import { getManifest } from './manifest'
55
import config from '../config'
66
import { createSteps, withProgress } from './progress'
77

8+
// Fast mode for development - skips flashing system partition (the slowest)
9+
// Enable with ?fast=1 in URL
10+
const FAST_MODE = new URLSearchParams(window.location.search).has('fast')
11+
if (FAST_MODE) {
12+
console.warn('[Flash] FAST MODE ENABLED - skipping system partition')
13+
}
14+
815
export const StepCode = {
916
INITIALIZING: 0,
1017
READY: 1,
@@ -367,10 +374,16 @@ export class FlashManager {
367374
this.#setProgress(0)
368375

369376
// Exclude GPT images and persist image, and pick correct userdata image to flash
370-
const systemImages = this.manifest
377+
let systemImages = this.manifest
371378
.filter((image) => !image.gpt && image.name !== 'persist')
372379
.filter((image) => !image.name.startsWith('userdata_') || image.name === this.#userdataImage)
373380

381+
// In fast mode, skip the system partition (slowest to flash)
382+
if (FAST_MODE) {
383+
systemImages = systemImages.filter((image) => image.name !== 'system')
384+
console.info('[Flash] Fast mode: skipping system partition')
385+
}
386+
374387
if (!systemImages.find((image) => image.name === this.#userdataImage)) {
375388
console.error(`[Flash] Did not find userdata image "${this.#userdataImage}"`)
376389
this.#setError(ErrorCode.UNKNOWN)

0 commit comments

Comments
 (0)