Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Year 2017+ Header doesn't parse #11

Open
cecil-t opened this issue Nov 1, 2017 · 12 comments
Open

Year 2017+ Header doesn't parse #11

cecil-t opened this issue Nov 1, 2017 · 12 comments
Assignees

Comments

@cecil-t
Copy link
Member

cecil-t commented Nov 1, 2017

The header section of the MBB files don't parse properly on 2017 (and presumably newer) VINs. The data in the file seems to parse ok but the header looks like this:

"
Zero MBB log

Serial number Z�tWR� ] sj421
VIN 20:12
Firmware rev. 1536
Board rev. 125
Model W

Printing 3925 of 3925 log entries..

Entry Time of Log Event Conditions
+--------+----------------------+--------------------------+----------------------------------
"

( none of the fields above show proper data - Serial number through Model

@adaviel
Copy link

adaviel commented Nov 15, 2017

python-2.6.6 on CentOS 6, 2017 Zero FXS

./zero_log_parser.py 538XXBZ48HCJ08346_MBB_2017-11-04.bin
Traceback (most recent call last):
File "./zero_log_parser.py", line 839, in
parse_log(log_file, output_file)
File "./zero_log_parser.py", line 736, in parse_log
print('Parsing {}...'.format(bin_file))
ValueError: zero length field name in format

I note that my VIN is at offset 0x252 and bike model at 0x26c

I don't know Python well enough to debug; I'm better at Perl

538XXBZ48HCJ08346_MBB_2017-11-04.zip

@shaleh
Copy link

shaleh commented Mar 2, 2018

Does any one have a 2016 log file? It looks like the format was extended. There is a zeroed out chunk where the current code is looking for the VIN. As @adaviel points out, the VIN is at 0x252, not 0x240 as the current code expects.

@cecil-t
Copy link
Member Author

cecil-t commented Mar 2, 2018

Here's a few sample logs of older files that should parse properly.

Zero-14-15-16-sample-logs.zip

@cecil-t
Copy link
Member Author

cecil-t commented Mar 2, 2018

And a few more 2017 samples
Zero-17-sample-logs.zip

@shaleh
Copy link

shaleh commented Mar 2, 2018

2018 samples?

@shaleh
Copy link

shaleh commented Mar 2, 2018

My suspicion is the firmware revision changed and the log file parser needs to track the firmware version of the file.

@cecil-t
Copy link
Member Author

cecil-t commented Mar 2, 2018

I'll double check but haven't seen any 2018 VINs yet.

I don't think it's related to firmware version. My 2014, vin 03455 in the zip file above, has the latest firmware but still parses fine.

You'll also notice that in 2015 or 2016 the .bin file sizes doubled from 128k to 256k. So there are definitely differences in the years beyond firmware.

@tyzbit
Copy link
Contributor

tyzbit commented Apr 20, 2019

Here are some logs from a 2018 SR.
Zero-18-sample-log.zip

@glynnelson
Copy link

Here are a 2019 DSR logs, the original converted and the way I manually modify the header so I can correctly parse the data in Keith Thomas' Google Sheets Visual Zero Log spreadsheet.

logs.zip

@briantrice
Copy link
Member

I forgot about this issue, sorry. I did receive a 2019 log which I managed to parse reasonably well, but without an official decoding from Zero, I had to guess.

Please try the latest log parser on these logs. I'll take time to re-test it myself now as well but might be delayed.

@briantrice briantrice self-assigned this Apr 22, 2020
@briantrice
Copy link
Member

Revised to handle firmware revision and model better:
d0eddf5

@6ffm70
Copy link

6ffm70 commented Jan 17, 2023

I have a similar issue with a 2022 FXE MBB log (reproduced with two of two different samples):

Zero Unknown Type log

VIN                
Model              
Initial date        Change Does Not Req
System info        unknown

Printing 7094 of 7094 log entries..

The BMS headers repeat as follows (looks ok to me):

Zero BMS log

Initial date       Jul 13 2022 10:28:45
Pack serial number 19lb3***

Printing 7582 of 7582 log entries..

Output test.py:

======================================================================
FAIL: test_can_handle_logs_in_dir (__main__.TestLogParserDirectory) (log_name='538XXFZA2NCM18***_MBB_2022-08-12.bin', dir='')
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test.py", line 144, in test_can_handle_logs_in_dir
    self._test_parse_of_logfile(log_file)
  File "test.py", line 104, in _test_parse_of_logfile
    self.fail(msg=log_record.message)
AssertionError: Unknown Log Format

======================================================================
FAIL: test_can_handle_logs_in_dir (__main__.TestLogParserDirectory) (log_name='538XXFZA2NCM18***_MBB_2022-11-11.bin', dir='')
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test.py", line 144, in test_can_handle_logs_in_dir
    self._test_parse_of_logfile(log_file)
  File "test.py", line 104, in _test_parse_of_logfile
    self.fail(msg=log_record.message)
AssertionError: Unknown Log Format

----------------------------------------------------------------------
Ran 2 tests in 0.785s

There's a third a third MBB*.bin in that directory where no FAIL was reported. Tested this, output seems ok except from Model and Initial date (model=FXE, logfile date is from 2022-08-25; bike was produced 2021-07):

Zero MBB log

Serial number      RKT212300***
VIN                538XXFZA2NCM18***
Firmware rev.      33
Board rev.         3236
Model              FX
Initial date       Apr 13 2021 07:20:53

Printing 7026 of 7026 log entries..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants