Skip to content

Commit

Permalink
fix workshop code to handle empty dates from silly tuners
Browse files Browse the repository at this point in the history
  • Loading branch information
bri3d committed Dec 9, 2021
1 parent 071931f commit 9ff0f4d
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions lib/workshop_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,11 +308,15 @@ def __init__(self, asw_checksum=None, cal_id=None, workshop_code: bytes = None):
self.flash_date = date.today()
self.is_valid = True
else:
self.flash_date = date(
convert_from_bcd(workshop_code[0]),
convert_from_bcd(workshop_code[1]),
convert_from_bcd(workshop_code[2]),
)
if workshop_code[0] > 0 and workshop_code[1] > 0 and workshop_code[2] > 0:
self.flash_date = date(
convert_from_bcd(workshop_code[0]),
convert_from_bcd(workshop_code[1]),
convert_from_bcd(workshop_code[2]),
)
else:
self.flash_date = date.today()

self.is_valid = workshop_code_is_valid(workshop_code)
if self.is_valid:
self.cal_id = workshop_code[4:8]
Expand Down

0 comments on commit 9ff0f4d

Please sign in to comment.