@@ -330,7 +330,7 @@ def __len__(self):
330330 if callback :
331331 callback (
332332 flasher_step = "SETUP" ,
333- flasher_status = "In Flasher util " ,
333+ flasher_status = "Starting... " ,
334334 flasher_progress = 100 ,
335335 )
336336 else :
@@ -368,7 +368,9 @@ def send_obd(data):
368368
369369 if callback :
370370 callback (
371- flasher_step = "SETUP" , flasher_status = "Clearing DTCs " , flasher_progress = 100
371+ flasher_step = "SETUP" ,
372+ flasher_status = "Clearing DTCs..." ,
373+ flasher_progress = 100 ,
372374 )
373375
374376 detailedLogger .info ("Sending 0x4 Clear Emissions DTCs over OBD-2" )
@@ -409,7 +411,7 @@ def volkswagen_security_algo(level: int, seed: bytes, params=None) -> bytes:
409411
410412 if callback :
411413 callback (
412- flasher_step = "SETUP " ,
414+ flasher_step = "CONNECTING " ,
413415 flasher_status = "Entering extended diagnostic session... " ,
414416 flasher_progress = 0 ,
415417 )
@@ -426,7 +428,7 @@ def volkswagen_security_algo(level: int, seed: bytes, params=None) -> bytes:
426428 callback (
427429 flasher_step = "SETUP" ,
428430 flasher_status = "Connected to vehicle with VIN: " + vin ,
429- flasher_progress = 100 ,
431+ flasher_progress = 20 ,
430432 )
431433
432434 detailedLogger .info (
@@ -443,7 +445,7 @@ def volkswagen_security_algo(level: int, seed: bytes, params=None) -> bytes:
443445 callback (
444446 flasher_step = "SETUP" ,
445447 flasher_status = "Checking programming precondition" ,
446- flasher_progress = 100 ,
448+ flasher_progress = 40 ,
447449 )
448450
449451 detailedLogger .info ("Checking programming precondition, routine 0x0203..." )
@@ -456,7 +458,7 @@ def volkswagen_security_algo(level: int, seed: bytes, params=None) -> bytes:
456458 callback (
457459 flasher_step = "SETUP" ,
458460 flasher_status = "Upgrading to programming session..." ,
459- flasher_progress = 100 ,
461+ flasher_progress = 60 ,
460462 )
461463
462464 detailedLogger .info ("Upgrading to programming session..." )
@@ -488,7 +490,7 @@ def switchpatch_programming_payload(payload):
488490 callback (
489491 flasher_step = "SETUP" ,
490492 flasher_status = "Performing Seed/Key authentication..." ,
491- flasher_progress = 100 ,
493+ flasher_progress = 80 ,
492494 )
493495
494496 # Perform Seed/Key Security Level 17. This will call volkswagen_security_algo above to perform the Seed/Key auth against the SA2 script.
@@ -501,7 +503,7 @@ def switchpatch_programming_payload(payload):
501503 callback (
502504 flasher_step = "SETUP" ,
503505 flasher_status = "Writing Workshop data..." ,
504- flasher_progress = 100 ,
506+ flasher_progress = 50 ,
505507 )
506508
507509 detailedLogger .info ("Writing flash tool log to LocalIdentifier 0xF15A..." )
@@ -536,7 +538,7 @@ def switchpatch_programming_payload(payload):
536538
537539 if callback :
538540 callback (
539- flasher_step = "SETUP " ,
541+ flasher_step = "PROGRAMMING " ,
540542 flasher_status = "Verifying reprogramming dependencies..." ,
541543 flasher_progress = 100 ,
542544 )
@@ -547,32 +549,33 @@ def switchpatch_programming_payload(payload):
547549
548550 client .tester_present ()
549551
550- # If a periodic task was patched or altered as part of the process, let's give it a few seconds to run
551- time .sleep (5 )
552552 if callback :
553553 callback (
554- flasher_step = "SETUP " ,
554+ flasher_step = "FINALIZING " ,
555555 flasher_status = "Finalizing..." ,
556556 flasher_progress = 100 ,
557557 )
558+ # If a periodic task was patched or altered as part of the process, let's give it a few seconds to run
559+ time .sleep (5 )
558560
559561 detailedLogger .info ("Rebooting ECU..." )
560562 # Reboot
561- client .ecu_reset (services .ECUReset .ResetType .hardReset )
562-
563- conn .close ()
564-
565- detailedLogger .info ("Sending 0x4 Clear Emissions DTCs over OBD-2" )
566- send_obd (bytes ([0x4 ]))
567-
568- if callback :
569- callback (
570- flasher_step = "SETUP" ,
571- flasher_status = "DONE!..." ,
572- flasher_progress = 100 ,
573- )
563+ try :
564+ client .ecu_reset (services .ECUReset .ResetType .hardReset )
565+
566+ conn .close ()
567+
568+ detailedLogger .info ("Sending 0x4 Clear Emissions DTCs over OBD-2" )
569+ send_obd (bytes ([0x4 ]))
570+ finally :
571+ if callback :
572+ callback (
573+ flasher_step = "DONE" ,
574+ flasher_status = "DONE!..." ,
575+ flasher_progress = 100 ,
576+ )
574577
575- detailedLogger .info ("Done!" )
578+ detailedLogger .info ("Done!" )
576579 except exceptions .NegativeResponseException as e :
577580 logger .error (
578581 'Server refused our request for service %s with code "%s" (0x%02x)'
0 commit comments