@@ -344,7 +344,7 @@ def replay_process(cfg, lr, fingerprint=None):
344
344
else :
345
345
return cpp_replay_process (cfg , lr , fingerprint )
346
346
347
- def setup_env (simulation = False ):
347
+ def setup_env (simulation = False , CP = None ):
348
348
params = Params ()
349
349
params .clear_all ()
350
350
params .put_bool ("OpenpilotEnabledToggle" , True )
@@ -355,12 +355,22 @@ def setup_env(simulation=False):
355
355
356
356
os .environ ["NO_RADAR_SLEEP" ] = "1"
357
357
os .environ ["REPLAY" ] = "1"
358
+ os .environ ['SKIP_FW_QUERY' ] = ""
359
+ os .environ ['FINGERPRINT' ] = ""
358
360
359
361
if simulation :
360
362
os .environ ["SIMULATION" ] = "1"
361
363
elif "SIMULATION" in os .environ :
362
364
del os .environ ["SIMULATION" ]
363
365
366
+ # Regen or python process
367
+ if CP is not None :
368
+ if CP .fingerprintSource == "fw" and CP .carFingerprint in FW_VERSIONS :
369
+ params .put ("CarParamsCache" , CP .as_builder ().to_bytes ())
370
+ else :
371
+ os .environ ['SKIP_FW_QUERY' ] = "1"
372
+ os .environ ['FINGERPRINT' ] = CP .carFingerprint
373
+
364
374
def python_replay_process (cfg , lr , fingerprint = None ):
365
375
sub_sockets = [s for _ , sub in cfg .pub_sub .items () for s in sub ]
366
376
pub_sockets = [s for s in cfg .pub_sub .keys () if s != 'can' ]
@@ -375,30 +385,13 @@ def python_replay_process(cfg, lr, fingerprint=None):
375
385
all_msgs = sorted (lr , key = lambda msg : msg .logMonoTime )
376
386
pub_msgs = [msg for msg in all_msgs if msg .which () in list (cfg .pub_sub .keys ())]
377
387
378
- setup_env ()
379
-
380
- # TODO: remove after getting new route for civic & accord
381
- migration = {
382
- "HONDA CIVIC 2016 TOURING" : "HONDA CIVIC 2016" ,
383
- "HONDA ACCORD 2018 SPORT 2T" : "HONDA ACCORD 2018" ,
384
- "HONDA ACCORD 2T 2018" : "HONDA ACCORD 2018" ,
385
- "Mazda CX-9 2021" : "MAZDA CX-9 2021" ,
386
- }
387
-
388
388
if fingerprint is not None :
389
389
os .environ ['SKIP_FW_QUERY' ] = "1"
390
390
os .environ ['FINGERPRINT' ] = fingerprint
391
+ setup_env ()
391
392
else :
392
- os .environ ['SKIP_FW_QUERY' ] = ""
393
- os .environ ['FINGERPRINT' ] = ""
394
- for msg in lr :
395
- if msg .which () == 'carParams' :
396
- car_fingerprint = migration .get (msg .carParams .carFingerprint , msg .carParams .carFingerprint )
397
- if msg .carParams .fingerprintSource == "fw" and (car_fingerprint in FW_VERSIONS ):
398
- Params ().put ("CarParamsCache" , msg .carParams .as_builder ().to_bytes ())
399
- else :
400
- os .environ ['SKIP_FW_QUERY' ] = "1"
401
- os .environ ['FINGERPRINT' ] = car_fingerprint
393
+ CP = [m for m in lr if m .which () == 'carParams' ][0 ].carParams
394
+ setup_env (CP = CP )
402
395
403
396
assert (type (managed_processes [cfg .proc_name ]) is PythonProcess )
404
397
managed_processes [cfg .proc_name ].prepare ()
0 commit comments