@@ -2,6 +2,7 @@ import { qdlDevice } from '@commaai/qdl'
22import { usbClass } from '@commaai/qdl/usblib'
33
44import { getManifest } from './manifest'
5+ import config from '../config'
56import { createSteps , withProgress } from './progress'
67
78export 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