Skip to content

Commit b16d855

Browse files
better
1 parent 7fa0711 commit b16d855

File tree

3 files changed

+25
-21
lines changed

3 files changed

+25
-21
lines changed

src/app/Flash.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ export default function Flash() {
194194
.then((res) => res.arrayBuffer())
195195
.then((programmer) => {
196196
// Create QDL manager with callbacks that update React state
197-
qdlManager.current = new FlashManager(config.manifests.release, programmer, {
197+
qdlManager.current = new FlashManager(programmer, {
198198
onStepChange: setStep,
199199
onMessageChange: setMessage,
200200
onProgressChange: setProgress,

src/config.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
const config = {
22
manifests: {
3-
release: 'https://raw.githubusercontent.com/commaai/openpilot/927548621be1be0c2c9063868b93d1f5020904de/system/hardware/tici/all-partitions.json',
3+
release_tizi: 'https://raw.githubusercontent.com/commaai/openpilot/927548621be1be0c2c9063868b93d1f5020904de/system/hardware/tici/all-partitions.json',
4+
release_tici: 'https://raw.githubusercontent.com/commaai/openpilot/927548621be1be0c2c9063868b93d1f5020904de/system/hardware/tici/all-partitions.json',
45
master: 'https://raw.githubusercontent.com/commaai/openpilot/master/system/hardware/tici/all-partitions.json',
56
},
67
loader: {
7-
url: 'https://raw.githubusercontent.com/commaai/flash/master/src/QDL/programmer.bin',
8+
url: 'https://raw.githubusercontent.com/commaai/flash/tici/src/QDL/programmer.bin',
89
},
910
}
1011

src/utils/manager.js

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { qdlDevice } from '@commaai/qdl'
22
import { usbClass } from '@commaai/qdl/usblib'
33

44
import { getManifest } from './manifest'
5+
import config from '../config'
56
import { createSteps, withProgress } from './progress'
67

78
export const StepCode = {
@@ -96,8 +97,8 @@ export class FlashManager {
9697
* @param {ArrayBuffer} programmer
9798
* @param {FlashManagerCallbacks} callbacks
9899
*/
99-
constructor(manifestUrl, programmer, callbacks = {}) {
100-
this.manifestUrl = manifestUrl
100+
constructor(programmer, callbacks = {}) {
101+
this.manifestUrl = null
101102
this.callbacks = callbacks
102103
this.device = new qdlDevice(programmer)
103104
/** @type {import('./image').ImageManager|null} */
@@ -190,21 +191,6 @@ export class FlashManager {
190191
return
191192
}
192193

193-
if (!this.manifest?.length) {
194-
try {
195-
this.manifest = await getManifest(this.manifestUrl)
196-
if (this.manifest.length === 0) {
197-
throw new Error('Manifest is empty')
198-
}
199-
} catch (err) {
200-
console.error('[Flash] Failed to fetch manifest')
201-
console.error(err)
202-
this.#setError(ErrorCode.UNKNOWN)
203-
return
204-
}
205-
console.info('[Flash] Loaded manifest', this.manifest)
206-
}
207-
208194
this.#setStep(StepCode.READY)
209195
}
210196

@@ -237,10 +223,27 @@ export class FlashManager {
237223
try {
238224
const deviceType = await this.device.getDeviceType()
239225
if (deviceType == 32) {
240-
this.#setError(ErrorCode.UNSUPPORTED_TICI)
226+
this.manifestUrl = config.manifests.release_tici
227+
console.log('tici')
228+
} else {
229+
this.manifestUrl = config.manifests.release_tizi
230+
console.log('tizi')
231+
}
232+
233+
try {
234+
this.manifest = await getManifest(this.manifestUrl)
235+
if (this.manifest.length === 0) {
236+
throw new Error('Manifest is empty')
237+
}
238+
} catch (err) {
239+
console.error('[Flash] Failed to fetch manifest')
240+
console.error(err)
241241
this.#setConnected(false)
242+
this.#setError(ErrorCode.UNKNOWN)
242243
return
243244
}
245+
console.info('[Flash] Loaded manifest', this.manifest)
246+
244247
} catch (err) {
245248
console.error('[Flash] Connection lost', err)
246249
this.#setError(ErrorCode.LOST_CONNECTION)

0 commit comments

Comments
 (0)