|
| 1 | +module.exports = function() |
| 2 | +{ |
| 3 | + var Parser = require('binary-parser').Parser; |
| 4 | + |
| 5 | + // Category = Hardware Configuration |
| 6 | + // Object = Cellmon |
| 7 | + // MsgLength = 53 |
| 8 | + // Description = Hardware cellmon setup configuration |
| 9 | + // Version = 5 |
| 10 | + // Frequency = 20 seconds |
| 11 | + // Support = Current |
| 12 | + // Valid from = SW 1.0.30 |
| 13 | + this.parse_4b35 = function(msg) |
| 14 | + { |
| 15 | + var status = new Parser() |
| 16 | + .skip(8) |
| 17 | + .uint8('HwCellmonSetupVers') |
| 18 | + .uint8('HwCellmonBattTypeID') /* BattTypes |
| 19 | + Custom = 0, |
| 20 | + Li-FePO4 Typical = 1, |
| 21 | + Li-Ion Performance = 2, |
| 22 | + Li-Ion LongLife = 3, |
| 23 | + Li-FePO4 Longlife = 4, */ |
| 24 | + .uint8( 'HwCellmonFirstID') |
| 25 | + .uint8( 'HwCellmonLastID') |
| 26 | + .int16le('HwCellmonNomCellVolt', { formatter: (x) => {return x/1000;}}) |
| 27 | + .int16le('HwCellmonLoCellVolt', { formatter: (x) => {return x/1000;}}) |
| 28 | + .int16le('HwCellmonHiCellVolt', { formatter: (x) => {return x/1000;}}) |
| 29 | + .int16le('HwCellmonBypassVoltLevel', { formatter: (x) => {return x/1000;}}) |
| 30 | + .int16le('HwCellmonBypassAmpLimit', { formatter: (x) => {return x/1000;}}) |
| 31 | + .uint8( 'HwCellmonBypassTempLimit', { formatter: (x) => {return x-40;}}) // temperature ºC |
| 32 | + .uint8( 'HwCellmonLoCellTemp', { formatter: (x) => {return x-40;}}) // temperature ºC |
| 33 | + .uint8( 'HwCellmonHiCellTemp', { formatter: (x) => {return x-40;}}) // temperature ºC |
| 34 | + .uint8( 'HwCellmonDiffNomCellsInSeries') // Boolean 0 = Off , 1 = On |
| 35 | + .uint8( 'HwCellmonNomCellsInSeries') |
| 36 | + .uint8( 'HwCellmonAllowEntireRange') // Boolean 0 = Off , 1 = On |
| 37 | + .uint8( 'HwCellmonEntireFirstID') |
| 38 | + .uint8( 'HwCellmonEntireLastID') |
| 39 | + .uint8( 'HwCellmonBypassExtraMode') /* BypassExtraModes |
| 40 | + None = 0, |
| 41 | + Idle Shunt = 1, |
| 42 | + Same CellVolt = 2, |
| 43 | + AutoLevel = 3, */ |
| 44 | + .int16le('HwCellmonBypassExtraInterval', { formatter: (x) => {return x/1000;}}) // seconds |
| 45 | + .uint8( 'HwCellmonCellMonTypeID') /* CellMonTypes |
| 46 | + Custom = 0, |
| 47 | + GenMon 2W = 1, |
| 48 | + GenMon 8W = 2, |
| 49 | + LongMon = 3, |
| 50 | + BlockMonM8 = 4, |
| 51 | + BlockMonM14 = 5, |
| 52 | + EndMon = 6, |
| 53 | + ManyMon = 7, */ |
| 54 | + .floatle('HwCellmonBypassImpedance', { formatter: (x) => {return x/1000;}}) |
| 55 | + .int16le('HwCellmonBypassLoVoltCutout', { formatter: (x) => {return x/1000;}}) |
| 56 | + .int16le('HwCellmonBypassShuntChargeLimit', { formatter: (x) => {return x/100;}}) // amps |
| 57 | + .int16le('HwCellmonBypassShuntDischgLimit', { formatter: (x) => {return x/100;}}) // amps |
| 58 | + .uint8( 'HwCellmonBypassShuntSocLo', { formatter: (x) => {return (x-5)/2;}}) // percent |
| 59 | + .int16le('HwCellmonBypassCellVoltBanding', { formatter: (x) => {return x/1000;}}) |
| 60 | + .int16le('HwCellmonBypassCellVoltDiff', { formatter: (x) => {return x/1000;}}) |
| 61 | + .int16le('HwCellmonBypassStableInterval', { formatter: (x) => {return x/1000;}}) // seconds |
| 62 | + .int16le('HwCellmonBypassExtraAmpLimit', { formatter: (x) => {return x/1000;}}) // amps |
| 63 | + |
| 64 | + return status.parse(msg); |
| 65 | + } |
| 66 | +} |
0 commit comments