forked from zero-motorcycle-community/zero-log-parser
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bms-g3.ksy.yml
76 lines (72 loc) · 1.85 KB
/
bms-g3.ksy.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
meta:
id: zlog_bms
title: A parser for Zero motorcycle Gen 3 BMS binary log files
endian: le
#bit-endian: le
seq:
- id: partial #```````````Partial log till next 0xb2 entry
terminator: 0xB2
consume: false # So next stream can read/start from 0xB2
doc: "Find first valid log entry"
- id: log_entry
type: log_entries
repeat: until
repeat-until: _io.eof
types:
log_entries:
seq:
- id: header_begin
contents: [0xB2]
- id: length
type: u1
doc: "Data is sometimes less then <length> bytes. Calculated different then MBB"
- id: log_type
type: u1
doc: "0xFD 0x4B 0x4D"
# when length 0x6B: 0xFE or <variable> 0xFE is inserted before timestamp. variable increments by three
# 0x40->0x43. Sometimes nothing inserted though (smh)
# - id: timestamp
# type: u4
- id: header
terminator: 0xF9
doc: "Process <data-somtimes>,timestamp,<data:null>,sequence-number at program SW level for now"
#size: 4
# - id: count
# type: u1
# doc: 'seems to increment for every 0xB2 record'
# - id: header_end
# contents: [0xF9] # 0xF8=>Serial Log Console <--MBB... (BMS also?)
- id: data
type:
switch-on: log_type
cases:
0x4B: log_type_4_b
0x4D: log_type_4_d
0xFD: capacity_estimate
_: log_type_unknown
log_type_4_b:
seq:
- id: data
eos-error: false
terminator: 0xB2
consume: false
log_type_4_d:
seq:
- id: data
eos-error: false
terminator: 0xB2
consume: false
capacity_estimate:
seq:
- id: data
type: str
encoding: ASCII
eos-error: false
terminator: 0xB2
consume: false
log_type_unknown:
seq:
- id: data
eos-error: false
terminator: 0xB2
consume: false