From 921929b71e6a94d5ccd2c5fd065d2dffc194405e Mon Sep 17 00:00:00 2001 From: FerroO2000 Date: Thu, 23 May 2024 15:38:53 +0200 Subject: [PATCH] sync mcb --- examples/markdown/MCB.dbc | 15 ++++--- examples/markdown/SC24.md | 86 ++++++++++++++++++++++++++++++++------- md_exporter.go | 1 + message.go | 11 +++++ 4 files changed, 93 insertions(+), 20 deletions(-) diff --git a/examples/markdown/MCB.dbc b/examples/markdown/MCB.dbc index 656d027..22a9c6d 100644 --- a/examples/markdown/MCB.dbc +++ b/examples/markdown/MCB.dbc @@ -81,7 +81,7 @@ BO_ 258 BMS_LV_lvBatGeneral: 6 BMS_LV SG_ LV_BAT_summedVoltage : 32|16@1+ (0.267,14000) [0|17497.845] "mV" DSPACE BO_ 259 BMS_LV_status: 4 BMS_LV - SG_ LV_RELAY_isOpen : 0|1@1+ (1,0) [0|1] "" DSPACE + SG_ LV_RELAY_isClosed : 0|1@1+ (1,0) [0|1] "" DSPACE SG_ LV_CELL_0_isOV : 1|1@1+ (1,0) [0|1] "" DSPACE SG_ LV_CELL_0_isUV : 2|1@1+ (1,0) [0|1] "" DSPACE SG_ LV_CELL_1_isOV : 3|1@1+ (1,0) [0|1] "" DSPACE @@ -185,6 +185,9 @@ BO_ 1026 SB_REAR_analog: 6 SB_REAR SG_ COOL_PRESS_RIGHT_voltage : 16|16@1+ (1,0) [0|65535] "mV" DSPACE SG_ BRAKE_PRESS_REAR_voltage : 32|16@1+ (1,0) [0|65535] "mV" DSPACE +BO_ 255 DASH_lvRelayOverride: 2 DASH + SG_ BMS_LV_diagPWD : 0|15@1+ (1,0) [0|65535] "" BMS_LV + SG_ LV_RELAY_forcedState : 15|1@1+ (1,0) [0|1] "" BMS_LV @@ -233,9 +236,7 @@ BO_ 37 dSpace_RTD_ACK: 1 DSPACE -BO_ 255 BMSLV_RelayOverride: 2 DSPACE - SG_ password : 0|15@1+ (1,0) [0|65535] "" BMS_LV - SG_ close_relay : 15|1@1+ (1,0) [0|1] "" BMS_LV + BO_ 512 dSpace_PeripheralsCTRL: 3 DSPACE @@ -290,7 +291,7 @@ CM_ SG_ 258 LV_BAT_currentSensVoltage "The voltage returned by the current senso CM_ SG_ 258 LV_BAT_voltage "The total read voltage of the LV battery pack expressed in mV."; CM_ SG_ 258 LV_BAT_summedVoltage "The total voltage of the LV battery pack calculated by summing each cell voltage expressed in mV."; -CM_ SG_ 259 LV_RELAY_isOpen "States whether the LV relay is open."; +CM_ SG_ 259 LV_RELAY_isClosed "States whether the LV relay is closed."; CM_ SG_ 259 LV_CELL_0_isOV "States whether the LV cell #0 is in overvoltage."; CM_ SG_ 259 LV_CELL_0_isUV "States whether the LV cell #0 is in undervoltage."; CM_ SG_ 259 LV_CELL_1_isOV "States whether the LV cell #1 is in overvoltage."; @@ -380,6 +381,10 @@ CM_ SG_ 1026 COOL_PRESS_LEFT_voltage "The voltage of the left cooling pressure s CM_ SG_ 1026 COOL_PRESS_RIGHT_voltage "The voltage of the right cooling pressure sensor expressed in mV."; CM_ SG_ 1026 BRAKE_PRESS_REAR_voltage "The voltage of the rear brake pressure sensor expressed in mV."; +CM_ SG_ 255 BMS_LV_diagPWD "The diagnostic password of the BMS_LV."; +CM_ SG_ 255 LV_RELAY_forcedState "The command to force the LV relay open (0) or closed (1)."; + + diff --git a/examples/markdown/SC24.md b/examples/markdown/SC24.md index aac83f5..bb00ee6 100644 --- a/examples/markdown/SC24.md +++ b/examples/markdown/SC24.md @@ -15,6 +15,8 @@ CAN-ID: **20** Size: **3** bytes +Byte Order: **little-endian** + Cycle Time: **10** ms Receivers: [DSPACE](#DSPACE) @@ -30,6 +32,8 @@ CAN-ID: **256** Size: **8** bytes +Byte Order: **little-endian** + Cycle Time: **100** ms Receivers: [DSPACE](#DSPACE) @@ -46,6 +50,8 @@ CAN-ID: **257** Size: **6** bytes +Byte Order: **little-endian** + Cycle Time: **100** ms Receivers: [DSPACE](#DSPACE) @@ -61,6 +67,8 @@ CAN-ID: **258** Size: **6** bytes +Byte Order: **little-endian** + Cycle Time: **100** ms Receivers: [DSPACE](#DSPACE) @@ -76,13 +84,15 @@ CAN-ID: **259** Size: **4** bytes +Byte Order: **little-endian** + Cycle Time: **100** ms Receivers: [DSPACE](#DSPACE) | Name | Start Bit | Size | Min | Max | Offset | Scale | Unit | Description | |----------------------|-----------|------|-----|-----|--------|-------|------|--------------------------------------------------------------------------------| -| LV_RELAY_isOpen | 0 | 1 | 0 | 1 | 0 | 1 | - | States whether the LV relay is open. | +| LV_RELAY_isClosed | 0 | 1 | 0 | 1 | 0 | 1 | - | States whether the LV relay is closed. | | LV_CELL_0_isOV | 1 | 1 | 0 | 1 | 0 | 1 | - | States whether the LV cell #0 is in overvoltage. | | LV_CELL_0_isUV | 2 | 1 | 0 | 1 | 0 | 1 | - | States whether the LV cell #0 is in undervoltage. | | LV_CELL_1_isOV | 3 | 1 | 0 | 1 | 0 | 1 | - | States whether the LV cell #1 is in overvoltage. | @@ -115,6 +125,8 @@ CAN-ID: **260** Size: **8** bytes +Byte Order: **little-endian** + Cycle Time: **2000** ms Receivers: [DSPACE](#DSPACE) @@ -133,6 +145,8 @@ CAN-ID: **261** Size: **8** bytes +Byte Order: **little-endian** + Cycle Time: **2000** ms Receivers: [DSPACE](#DSPACE) @@ -157,6 +171,8 @@ CAN-ID: **23** Size: **3** bytes +Byte Order: **little-endian** + Cycle Time: **10** ms Receivers: [DSPACE](#DSPACE) @@ -172,6 +188,8 @@ CAN-ID: **38** Size: **1** bytes +Byte Order: **little-endian** + Cycle Time: **500** ms Receivers: [DSPACE](#DSPACE) @@ -180,11 +198,29 @@ Receivers: [DSPACE](#DSPACE) |---------|-----------|------|-----|-----|--------|-------|------|------------------| | RTD_CMD | 0 | 8 | 0 | 255 | 0 | 1 | - | The RTD command. | +#### DASH_lvRelayOverride +CAN-ID: **255** + +Size: **2** bytes + +Byte Order: **little-endian** + +Cycle Time: - + +Receivers: [BMS_LV](#BMS_LV) + +| Name | Start Bit | Size | Min | Max | Offset | Scale | Unit | Description | +|----------------------|-----------|------|-----|-------|--------|-------|------|-----------------------------------------------------------| +| BMS_LV_diagPWD | 0 | 15 | 0 | 65535 | 0 | 1 | - | The diagnostic password of the BMS_LV. | +| LV_RELAY_forcedState | 15 | 1 | 0 | 1 | 0 | 1 | - | The command to force the LV relay open (0) or closed (1). | + #### DASH_motorStatus CAN-ID: **1280** Size: **1** bytes +Byte Order: **little-endian** + Cycle Time: - Receivers: [DSPACE](#DSPACE) @@ -207,6 +243,8 @@ CAN-ID: **25** Size: **3** bytes +Byte Order: **little-endian** + Cycle Time: **10** ms Receivers: [DSPACE](#DSPACE) @@ -222,6 +260,8 @@ CAN-ID: **37** Size: **1** bytes +Byte Order: **little-endian** + Cycle Time: - Receivers: [DASH](#DASH) @@ -230,25 +270,13 @@ Receivers: [DASH](#DASH) |---------------|-----------|------|-----|-----|--------|-------|------|-------------| | RTD_FSM_STATE | 0 | 8 | -1 | 6 | 0 | 1 | - | - | -#### BMSLV_RelayOverride -CAN-ID: **255** - -Size: **2** bytes - -Cycle Time: - - -Receivers: [BMS_LV](#BMS_LV) - -| Name | Start Bit | Size | Min | Max | Offset | Scale | Unit | Description | -|-------------|-----------|------|-----|-------|--------|-------|------|-------------| -| password | 0 | 15 | 0 | 65535 | 0 | 1 | - | - | -| close_relay | 15 | 1 | 0 | 1 | 0 | 1 | - | - | - #### dSpace_PeripheralsCTRL CAN-ID: **512** Size: **3** bytes +Byte Order: **little-endian** + Cycle Time: - Receivers: [DASH](#DASH) @@ -270,6 +298,8 @@ CAN-ID: **5** Size: **8** bytes +Byte Order: **little-endian** + Cycle Time: **10** ms Receivers: [DSPACE](#DSPACE) @@ -286,6 +316,8 @@ CAN-ID: **16** Size: **4** bytes +Byte Order: **little-endian** + Cycle Time: **10** ms Receivers: [DSPACE](#DSPACE) @@ -300,6 +332,8 @@ CAN-ID: **21** Size: **3** bytes +Byte Order: **little-endian** + Cycle Time: **10** ms Receivers: [DSPACE](#DSPACE) @@ -315,6 +349,8 @@ CAN-ID: **49** Size: **1** bytes +Byte Order: **little-endian** + Cycle Time: **10** ms Receivers: [DSPACE](#DSPACE) @@ -331,6 +367,8 @@ CAN-ID: **1024** Size: **8** bytes +Byte Order: **little-endian** + Cycle Time: **10** ms Receivers: [DSPACE](#DSPACE) @@ -355,6 +393,8 @@ CAN-ID: **17** Size: **4** bytes +Byte Order: **little-endian** + Cycle Time: **10** ms Receivers: [DSPACE](#DSPACE) @@ -369,6 +409,8 @@ CAN-ID: **22** Size: **3** bytes +Byte Order: **little-endian** + Cycle Time: **10** ms Receivers: [DSPACE](#DSPACE) @@ -384,6 +426,8 @@ CAN-ID: **48** Size: **1** bytes +Byte Order: **little-endian** + Cycle Time: **10** ms Receivers: [DSPACE](#DSPACE) @@ -401,6 +445,8 @@ CAN-ID: **50** Size: **1** bytes +Byte Order: **little-endian** + Cycle Time: - Receivers: [DSPACE](#DSPACE) @@ -414,6 +460,8 @@ CAN-ID: **1025** Size: **8** bytes +Byte Order: **little-endian** + Cycle Time: **10** ms Receivers: [DSPACE](#DSPACE) @@ -432,6 +480,8 @@ CAN-ID: **1026** Size: **6** bytes +Byte Order: **little-endian** + Cycle Time: **10** ms Receivers: [DSPACE](#DSPACE) @@ -453,6 +503,8 @@ CAN-ID: **18** Size: **3** bytes +Byte Order: **little-endian** + Cycle Time: **10** ms Receivers: [DSPACE](#DSPACE) @@ -474,6 +526,8 @@ CAN-ID: **19** Size: **3** bytes +Byte Order: **little-endian** + Cycle Time: **10** ms Receivers: [DSPACE](#DSPACE) @@ -503,6 +557,8 @@ CAN-ID: **24** Size: **3** bytes +Byte Order: **little-endian** + Cycle Time: **10** ms Receivers: [DSPACE](#DSPACE) diff --git a/md_exporter.go b/md_exporter.go index 48f635b..080bf7d 100644 --- a/md_exporter.go +++ b/md_exporter.go @@ -93,6 +93,7 @@ func (e *mdExporter) exportMessage(msg *Message) { e.w.PlainTextf("CAN-ID: %s", md.Bold(fmt.Sprintf("%d", msg.id))).LF() e.w.PlainTextf("Size: %s bytes", md.Bold(fmt.Sprintf("%d", msg.sizeByte))).LF() + e.w.PlainTextf("Byte Order: %s", md.Bold(msg.byteOrder.String())).LF() cycleTimeStr := "-" if msg.cycleTime > 0 { diff --git a/message.go b/message.go index bf9f01b..2d36921 100644 --- a/message.go +++ b/message.go @@ -69,6 +69,17 @@ const ( MessageByteOrderBigEndian ) +func (mbo MessageByteOrder) String() string { + switch mbo { + case MessageByteOrderLittleEndian: + return "little-endian" + case MessageByteOrderBigEndian: + return "big-endian" + default: + return "unknown" + } +} + // Message is the representation of data sent by a node thought the bus. // It holds a list of signals that are contained in the message payload. type Message struct {