From 1ff4adf5e4b0be7835cf86b63e2efd692d142f9a Mon Sep 17 00:00:00 2001 From: saji Date: Thu, 7 Mar 2024 13:29:50 -0600 Subject: [PATCH] add generator test for skylab --- skylab/skylab_gen.go | 1275 +++++++++++--------- skylab/skylab_gen_test.go | 1535 ++++++++++++++++++++++++- skylab/templates/golang_tests.go.tmpl | 17 + 3 files changed, 2280 insertions(+), 547 deletions(-) diff --git a/skylab/skylab_gen.go b/skylab/skylab_gen.go index 8c4132a..ea984ff 100644 --- a/skylab/skylab_gen.go +++ b/skylab/skylab_gen.go @@ -1,250 +1,250 @@ -// generated by gen_skylab.go at 2024-03-04 20:39:49.644966621 -0600 CST m=+0.004692195 DO NOT EDIT! +// generated by gen_skylab.go at 2024-03-07 13:28:08.045194699 -0600 CST m=+0.003043646 DO NOT EDIT! package skylab import ( - "encoding/binary" - "encoding/json" "errors" + "encoding/binary" "github.com/kschamplin/gotelem/internal/can" + "encoding/json" ) type SkylabId uint32 const ( - BmsMeasurementId SkylabId = 0x10 - BatteryStatusId SkylabId = 0x11 - BmsKillReasonId SkylabId = 0x12 - BmsModuleMinMaxId SkylabId = 0x13 - BmsSocId SkylabId = 0x14 - BmsCapacityId SkylabId = 0x15 - BmsCurrentlimitId SkylabId = 0x18 - BmsFanInfoId SkylabId = 0x19 - BmsSetMinFanSpeedId SkylabId = 0x1B - BmsModuleId SkylabId = 0x40 - BmsChargerResponseId SkylabId = 0x75 - ChassisIsolationFaultId SkylabId = 0x38 - BmsImdInfoId SkylabId = 0x37 - DashboardPedalPercentagesId SkylabId = 0x290 - CarStateId SkylabId = 0x291 - DashboardPedalFaultId SkylabId = 0x292 - DashboardSystemTimeoutTestId SkylabId = 0x299 - CarSpeedId SkylabId = 0x29A + BmsMeasurementId SkylabId = 0x10 + BatteryStatusId SkylabId = 0x11 + BmsKillReasonId SkylabId = 0x12 + BmsModuleMinMaxId SkylabId = 0x13 + BmsSocId SkylabId = 0x14 + BmsCapacityId SkylabId = 0x15 + BmsCurrentlimitId SkylabId = 0x18 + BmsFanInfoId SkylabId = 0x19 + BmsSetMinFanSpeedId SkylabId = 0x1B + BmsModuleId SkylabId = 0x40 + BmsChargerResponseId SkylabId = 0x75 + ChassisIsolationFaultId SkylabId = 0x38 + BmsImdInfoId SkylabId = 0x37 + DashboardPedalPercentagesId SkylabId = 0x290 + CarStateId SkylabId = 0x291 + DashboardPedalFaultId SkylabId = 0x292 + DashboardSystemTimeoutTestId SkylabId = 0x299 + CarSpeedId SkylabId = 0x29A FlightComputerLvBoardDisconnectCountsId SkylabId = 0x29B FlightComputerHvBoardDisconnectCountsId SkylabId = 0x29C - FlightComputerInternalStateId SkylabId = 0x29D - PowerToDriveId SkylabId = 0x19E - ArrayPowerId SkylabId = 0x19F - ArrayEnergyId SkylabId = 0x119 - ArrayEnergyResetId SkylabId = 0x120 - VisionTurnSignalsCommandId SkylabId = 0x2B0 - VisionBrakeLightsCommandId SkylabId = 0x2B1 - VisionHeadlightsCommandId SkylabId = 0x2B2 - VisionHornCommandId SkylabId = 0x2B3 - VisionArrayLatchesCommandId SkylabId = 0x2B4 - VisionRearviewCommandId SkylabId = 0x2B5 - TrackerEnableId SkylabId = 0x610 - DistanceTraveledId SkylabId = 0x19D - ChargerStateId SkylabId = 0x573 - ChargerBmsRequestId SkylabId = 0x74 - ChargerCurrentVoltageId SkylabId = 0x576 - ChargerPowerId SkylabId = 0x577 - ThunderstruckControlMessageId SkylabId = 0x18E54024 - VisionStatusFrontId SkylabId = 0x2B6 - VisionStatusRearId SkylabId = 0x2B7 - LightsFrontIdId SkylabId = 0x300 - LightsBackIdId SkylabId = 0x301 - VisionIdId SkylabId = 0x302 - SteeringPressCount1Id SkylabId = 0x240 - SteeringPressCount2Id SkylabId = 0x250 - SteeringButtonColors1Id SkylabId = 0x241 - SteeringButtonColors2Id SkylabId = 0x251 - SteeringHornId SkylabId = 0x242 - ThunderstruckStatusMessageId SkylabId = 0x18EB2440 - TrackerDataId SkylabId = 0x600 - TritiumMotorDriveLId SkylabId = 0x121 - TritiumMotorPowerLId SkylabId = 0x122 - TritiumResetLId SkylabId = 0x123 - TritiumMotorDriveRId SkylabId = 0x161 - TritiumMotorPowerRId SkylabId = 0x162 - TritiumResetRId SkylabId = 0x163 - BmsAhSetId SkylabId = 0x16 - BmsWhSetId SkylabId = 0x17 - BmsKillId SkylabId = 0x1A - TelemetryRtcResetId SkylabId = 0x700 - WsrIdentificationId SkylabId = 0x140 - WsrStatusInformationId SkylabId = 0x141 - WsrBusMeasurementId SkylabId = 0x142 - WsrVelocityId SkylabId = 0x143 - WsrPhaseCurrentId SkylabId = 0x144 - WsrMotorVoltageVectorId SkylabId = 0x145 - WsrMotorCurrentVectorId SkylabId = 0x146 - WsrMotorBackemfId SkylabId = 0x147 - Wsr15165VoltageRailId SkylabId = 0x148 - Wsr2512VoltageRailId SkylabId = 0x149 - WsrHeatsinkMotorTempId SkylabId = 0x14B - WsrDspBoardTempId SkylabId = 0x14C - WsrReservedId SkylabId = 0x14D - WsrOdometerBusAmphoursMeasurementId SkylabId = 0x14E - WsrSlipSpeedMeasurementId SkylabId = 0x157 - WslIdentificationId SkylabId = 0x100 - WslStatusInformationId SkylabId = 0x101 - WslBusMeasurementId SkylabId = 0x102 - WslVelocityId SkylabId = 0x103 - WslPhaseCurrentId SkylabId = 0x104 - WslMotorVoltageVectorId SkylabId = 0x105 - WslMotorCurrentVectorId SkylabId = 0x106 - WslMotorBackemfId SkylabId = 0x107 - Wsl15165VoltageRailId SkylabId = 0x108 - Wsl2512VoltageRailId SkylabId = 0x109 - WslHeatsinkMotorTempId SkylabId = 0x10B - WslDspBoardTempId SkylabId = 0x10C - WslOdometerBusAmphoursMeasurementId SkylabId = 0x10E - WslReservedId SkylabId = 0x10D - WslSlipSpeedMeasurementId SkylabId = 0x117 + FlightComputerInternalStateId SkylabId = 0x29D + PowerToDriveId SkylabId = 0x19E + ArrayPowerId SkylabId = 0x19F + ArrayEnergyId SkylabId = 0x119 + ArrayEnergyResetId SkylabId = 0x120 + VisionTurnSignalsCommandId SkylabId = 0x2B0 + VisionBrakeLightsCommandId SkylabId = 0x2B1 + VisionHeadlightsCommandId SkylabId = 0x2B2 + VisionHornCommandId SkylabId = 0x2B3 + VisionArrayLatchesCommandId SkylabId = 0x2B4 + VisionRearviewCommandId SkylabId = 0x2B5 + TrackerEnableId SkylabId = 0x610 + DistanceTraveledId SkylabId = 0x19D + ChargerStateId SkylabId = 0x573 + ChargerBmsRequestId SkylabId = 0x74 + ChargerCurrentVoltageId SkylabId = 0x576 + ChargerPowerId SkylabId = 0x577 + ThunderstruckControlMessageId SkylabId = 0x18E54024 + VisionStatusFrontId SkylabId = 0x2B6 + VisionStatusRearId SkylabId = 0x2B7 + LightsFrontIdId SkylabId = 0x300 + LightsBackIdId SkylabId = 0x301 + VisionIdId SkylabId = 0x302 + SteeringPressCount1Id SkylabId = 0x240 + SteeringPressCount2Id SkylabId = 0x250 + SteeringButtonColors1Id SkylabId = 0x241 + SteeringButtonColors2Id SkylabId = 0x251 + SteeringHornId SkylabId = 0x242 + ThunderstruckStatusMessageId SkylabId = 0x18EB2440 + TrackerDataId SkylabId = 0x600 + TritiumMotorDriveLId SkylabId = 0x121 + TritiumMotorPowerLId SkylabId = 0x122 + TritiumResetLId SkylabId = 0x123 + TritiumMotorDriveRId SkylabId = 0x161 + TritiumMotorPowerRId SkylabId = 0x162 + TritiumResetRId SkylabId = 0x163 + BmsAhSetId SkylabId = 0x16 + BmsWhSetId SkylabId = 0x17 + BmsKillId SkylabId = 0x1A + TelemetryRtcResetId SkylabId = 0x700 + WsrIdentificationId SkylabId = 0x140 + WsrStatusInformationId SkylabId = 0x141 + WsrBusMeasurementId SkylabId = 0x142 + WsrVelocityId SkylabId = 0x143 + WsrPhaseCurrentId SkylabId = 0x144 + WsrMotorVoltageVectorId SkylabId = 0x145 + WsrMotorCurrentVectorId SkylabId = 0x146 + WsrMotorBackemfId SkylabId = 0x147 + Wsr15165VoltageRailId SkylabId = 0x148 + Wsr2512VoltageRailId SkylabId = 0x149 + WsrHeatsinkMotorTempId SkylabId = 0x14B + WsrDspBoardTempId SkylabId = 0x14C + WsrReservedId SkylabId = 0x14D + WsrOdometerBusAmphoursMeasurementId SkylabId = 0x14E + WsrSlipSpeedMeasurementId SkylabId = 0x157 + WslIdentificationId SkylabId = 0x100 + WslStatusInformationId SkylabId = 0x101 + WslBusMeasurementId SkylabId = 0x102 + WslVelocityId SkylabId = 0x103 + WslPhaseCurrentId SkylabId = 0x104 + WslMotorVoltageVectorId SkylabId = 0x105 + WslMotorCurrentVectorId SkylabId = 0x106 + WslMotorBackemfId SkylabId = 0x107 + Wsl15165VoltageRailId SkylabId = 0x108 + Wsl2512VoltageRailId SkylabId = 0x109 + WslHeatsinkMotorTempId SkylabId = 0x10B + WslDspBoardTempId SkylabId = 0x10C + WslOdometerBusAmphoursMeasurementId SkylabId = 0x10E + WslReservedId SkylabId = 0x10D + WslSlipSpeedMeasurementId SkylabId = 0x117 ) // list of every packet ID. Can be used for O(1) checks. var idMap = map[can.CanID]bool{ - - {Id: 0x10, Extended: false}: true, - {Id: 0x11, Extended: false}: true, - {Id: 0x12, Extended: false}: true, - {Id: 0x13, Extended: false}: true, - {Id: 0x14, Extended: false}: true, - {Id: 0x15, Extended: false}: true, - {Id: 0x18, Extended: false}: true, - {Id: 0x19, Extended: false}: true, - {Id: 0x1B, Extended: false}: true, - {Id: 0x40, Extended: false}: true, - {Id: 0x41, Extended: false}: true, - {Id: 0x42, Extended: false}: true, - {Id: 0x43, Extended: false}: true, - {Id: 0x44, Extended: false}: true, - {Id: 0x45, Extended: false}: true, - {Id: 0x46, Extended: false}: true, - {Id: 0x47, Extended: false}: true, - {Id: 0x48, Extended: false}: true, - {Id: 0x49, Extended: false}: true, - {Id: 0x4A, Extended: false}: true, - {Id: 0x4B, Extended: false}: true, - {Id: 0x4C, Extended: false}: true, - {Id: 0x4D, Extended: false}: true, - {Id: 0x4E, Extended: false}: true, - {Id: 0x4F, Extended: false}: true, - {Id: 0x50, Extended: false}: true, - {Id: 0x51, Extended: false}: true, - {Id: 0x52, Extended: false}: true, - {Id: 0x53, Extended: false}: true, - {Id: 0x54, Extended: false}: true, - {Id: 0x55, Extended: false}: true, - {Id: 0x56, Extended: false}: true, - {Id: 0x57, Extended: false}: true, - {Id: 0x58, Extended: false}: true, - {Id: 0x59, Extended: false}: true, - {Id: 0x5A, Extended: false}: true, - {Id: 0x5B, Extended: false}: true, - {Id: 0x5C, Extended: false}: true, - {Id: 0x5D, Extended: false}: true, - {Id: 0x5E, Extended: false}: true, - {Id: 0x5F, Extended: false}: true, - {Id: 0x60, Extended: false}: true, - {Id: 0x61, Extended: false}: true, - {Id: 0x62, Extended: false}: true, - {Id: 0x63, Extended: false}: true, - - {Id: 0x75, Extended: false}: true, - {Id: 0x38, Extended: false}: true, - {Id: 0x37, Extended: false}: true, - {Id: 0x290, Extended: false}: true, - {Id: 0x291, Extended: false}: true, - {Id: 0x292, Extended: false}: true, - {Id: 0x299, Extended: false}: true, - {Id: 0x29A, Extended: false}: true, - {Id: 0x29B, Extended: false}: true, - {Id: 0x29C, Extended: false}: true, - {Id: 0x29D, Extended: false}: true, - {Id: 0x19E, Extended: false}: true, - {Id: 0x19F, Extended: false}: true, - {Id: 0x119, Extended: false}: true, - {Id: 0x120, Extended: false}: true, - {Id: 0x2B0, Extended: false}: true, - {Id: 0x2B1, Extended: false}: true, - {Id: 0x2B2, Extended: false}: true, - {Id: 0x2B3, Extended: false}: true, - {Id: 0x2B4, Extended: false}: true, - {Id: 0x2B5, Extended: false}: true, - {Id: 0x610, Extended: false}: true, - {Id: 0x611, Extended: false}: true, - {Id: 0x612, Extended: false}: true, - {Id: 0x613, Extended: false}: true, - {Id: 0x614, Extended: false}: true, - {Id: 0x615, Extended: false}: true, - - {Id: 0x19D, Extended: false}: true, - {Id: 0x573, Extended: false}: true, - {Id: 0x74, Extended: false}: true, - {Id: 0x576, Extended: false}: true, - {Id: 0x577, Extended: false}: true, - {Id: 0x18E54024, Extended: true}: true, - {Id: 0x2B6, Extended: false}: true, - {Id: 0x2B7, Extended: false}: true, - {Id: 0x300, Extended: false}: true, - {Id: 0x301, Extended: false}: true, - {Id: 0x302, Extended: false}: true, - {Id: 0x240, Extended: false}: true, - {Id: 0x250, Extended: false}: true, - {Id: 0x241, Extended: false}: true, - {Id: 0x251, Extended: false}: true, - {Id: 0x242, Extended: false}: true, - {Id: 0x18EB2440, Extended: true}: true, - {Id: 0x600, Extended: false}: true, - {Id: 0x601, Extended: false}: true, - {Id: 0x602, Extended: false}: true, - {Id: 0x603, Extended: false}: true, - {Id: 0x604, Extended: false}: true, - {Id: 0x605, Extended: false}: true, - - {Id: 0x121, Extended: false}: true, - {Id: 0x122, Extended: false}: true, - {Id: 0x123, Extended: false}: true, - {Id: 0x161, Extended: false}: true, - {Id: 0x162, Extended: false}: true, - {Id: 0x163, Extended: false}: true, - {Id: 0x16, Extended: false}: true, - {Id: 0x17, Extended: false}: true, - {Id: 0x1A, Extended: false}: true, - {Id: 0x700, Extended: false}: true, - {Id: 0x140, Extended: false}: true, - {Id: 0x141, Extended: false}: true, - {Id: 0x142, Extended: false}: true, - {Id: 0x143, Extended: false}: true, - {Id: 0x144, Extended: false}: true, - {Id: 0x145, Extended: false}: true, - {Id: 0x146, Extended: false}: true, - {Id: 0x147, Extended: false}: true, - {Id: 0x148, Extended: false}: true, - {Id: 0x149, Extended: false}: true, - {Id: 0x14B, Extended: false}: true, - {Id: 0x14C, Extended: false}: true, - {Id: 0x14D, Extended: false}: true, - {Id: 0x14E, Extended: false}: true, - {Id: 0x157, Extended: false}: true, - {Id: 0x100, Extended: false}: true, - {Id: 0x101, Extended: false}: true, - {Id: 0x102, Extended: false}: true, - {Id: 0x103, Extended: false}: true, - {Id: 0x104, Extended: false}: true, - {Id: 0x105, Extended: false}: true, - {Id: 0x106, Extended: false}: true, - {Id: 0x107, Extended: false}: true, - {Id: 0x108, Extended: false}: true, - {Id: 0x109, Extended: false}: true, - {Id: 0x10B, Extended: false}: true, - {Id: 0x10C, Extended: false}: true, - {Id: 0x10E, Extended: false}: true, - {Id: 0x10D, Extended: false}: true, - {Id: 0x117, Extended: false}: true, + + { Id: 0x10, Extended: false }: true, + { Id: 0x11, Extended: false }: true, + { Id: 0x12, Extended: false }: true, + { Id: 0x13, Extended: false }: true, + { Id: 0x14, Extended: false }: true, + { Id: 0x15, Extended: false }: true, + { Id: 0x18, Extended: false }: true, + { Id: 0x19, Extended: false }: true, + { Id: 0x1B, Extended: false }: true, + { Id: 0x40, Extended: false }: true, + { Id: 0x41, Extended: false }: true, + { Id: 0x42, Extended: false }: true, + { Id: 0x43, Extended: false }: true, + { Id: 0x44, Extended: false }: true, + { Id: 0x45, Extended: false }: true, + { Id: 0x46, Extended: false }: true, + { Id: 0x47, Extended: false }: true, + { Id: 0x48, Extended: false }: true, + { Id: 0x49, Extended: false }: true, + { Id: 0x4A, Extended: false }: true, + { Id: 0x4B, Extended: false }: true, + { Id: 0x4C, Extended: false }: true, + { Id: 0x4D, Extended: false }: true, + { Id: 0x4E, Extended: false }: true, + { Id: 0x4F, Extended: false }: true, + { Id: 0x50, Extended: false }: true, + { Id: 0x51, Extended: false }: true, + { Id: 0x52, Extended: false }: true, + { Id: 0x53, Extended: false }: true, + { Id: 0x54, Extended: false }: true, + { Id: 0x55, Extended: false }: true, + { Id: 0x56, Extended: false }: true, + { Id: 0x57, Extended: false }: true, + { Id: 0x58, Extended: false }: true, + { Id: 0x59, Extended: false }: true, + { Id: 0x5A, Extended: false }: true, + { Id: 0x5B, Extended: false }: true, + { Id: 0x5C, Extended: false }: true, + { Id: 0x5D, Extended: false }: true, + { Id: 0x5E, Extended: false }: true, + { Id: 0x5F, Extended: false }: true, + { Id: 0x60, Extended: false }: true, + { Id: 0x61, Extended: false }: true, + { Id: 0x62, Extended: false }: true, + { Id: 0x63, Extended: false }: true, + + { Id: 0x75, Extended: false }: true, + { Id: 0x38, Extended: false }: true, + { Id: 0x37, Extended: false }: true, + { Id: 0x290, Extended: false }: true, + { Id: 0x291, Extended: false }: true, + { Id: 0x292, Extended: false }: true, + { Id: 0x299, Extended: false }: true, + { Id: 0x29A, Extended: false }: true, + { Id: 0x29B, Extended: false }: true, + { Id: 0x29C, Extended: false }: true, + { Id: 0x29D, Extended: false }: true, + { Id: 0x19E, Extended: false }: true, + { Id: 0x19F, Extended: false }: true, + { Id: 0x119, Extended: false }: true, + { Id: 0x120, Extended: false }: true, + { Id: 0x2B0, Extended: false }: true, + { Id: 0x2B1, Extended: false }: true, + { Id: 0x2B2, Extended: false }: true, + { Id: 0x2B3, Extended: false }: true, + { Id: 0x2B4, Extended: false }: true, + { Id: 0x2B5, Extended: false }: true, + { Id: 0x610, Extended: false }: true, + { Id: 0x611, Extended: false }: true, + { Id: 0x612, Extended: false }: true, + { Id: 0x613, Extended: false }: true, + { Id: 0x614, Extended: false }: true, + { Id: 0x615, Extended: false }: true, + + { Id: 0x19D, Extended: false }: true, + { Id: 0x573, Extended: false }: true, + { Id: 0x74, Extended: false }: true, + { Id: 0x576, Extended: false }: true, + { Id: 0x577, Extended: false }: true, + { Id: 0x18E54024, Extended: true }: true, + { Id: 0x2B6, Extended: false }: true, + { Id: 0x2B7, Extended: false }: true, + { Id: 0x300, Extended: false }: true, + { Id: 0x301, Extended: false }: true, + { Id: 0x302, Extended: false }: true, + { Id: 0x240, Extended: false }: true, + { Id: 0x250, Extended: false }: true, + { Id: 0x241, Extended: false }: true, + { Id: 0x251, Extended: false }: true, + { Id: 0x242, Extended: false }: true, + { Id: 0x18EB2440, Extended: false }: true, + { Id: 0x600, Extended: false }: true, + { Id: 0x601, Extended: false }: true, + { Id: 0x602, Extended: false }: true, + { Id: 0x603, Extended: false }: true, + { Id: 0x604, Extended: false }: true, + { Id: 0x605, Extended: false }: true, + + { Id: 0x121, Extended: false }: true, + { Id: 0x122, Extended: false }: true, + { Id: 0x123, Extended: false }: true, + { Id: 0x161, Extended: false }: true, + { Id: 0x162, Extended: false }: true, + { Id: 0x163, Extended: false }: true, + { Id: 0x16, Extended: false }: true, + { Id: 0x17, Extended: false }: true, + { Id: 0x1A, Extended: false }: true, + { Id: 0x700, Extended: false }: true, + { Id: 0x140, Extended: false }: true, + { Id: 0x141, Extended: false }: true, + { Id: 0x142, Extended: false }: true, + { Id: 0x143, Extended: false }: true, + { Id: 0x144, Extended: false }: true, + { Id: 0x145, Extended: false }: true, + { Id: 0x146, Extended: false }: true, + { Id: 0x147, Extended: false }: true, + { Id: 0x148, Extended: false }: true, + { Id: 0x149, Extended: false }: true, + { Id: 0x14B, Extended: false }: true, + { Id: 0x14C, Extended: false }: true, + { Id: 0x14D, Extended: false }: true, + { Id: 0x14E, Extended: false }: true, + { Id: 0x157, Extended: false }: true, + { Id: 0x100, Extended: false }: true, + { Id: 0x101, Extended: false }: true, + { Id: 0x102, Extended: false }: true, + { Id: 0x103, Extended: false }: true, + { Id: 0x104, Extended: false }: true, + { Id: 0x105, Extended: false }: true, + { Id: 0x106, Extended: false }: true, + { Id: 0x107, Extended: false }: true, + { Id: 0x108, Extended: false }: true, + { Id: 0x109, Extended: false }: true, + { Id: 0x10B, Extended: false }: true, + { Id: 0x10C, Extended: false }: true, + { Id: 0x10E, Extended: false }: true, + { Id: 0x10D, Extended: false }: true, + { Id: 0x117, Extended: false }: true, } // FromCanFrame creates a Packet from a given CAN ID and data payload. @@ -252,369 +252,369 @@ var idMap = map[can.CanID]bool{ func FromCanFrame(f can.Frame) (Packet, error) { id := f.Id if !idMap[id] { - return nil, &UnknownIdError{id.Id} + return nil, &UnknownIdError{ id.Id } } switch id { - case can.CanID{Id: 0x10, Extended: false}: + case can.CanID{ Id: 0x10, Extended: false }: var res = &BmsMeasurement{} res.UnmarshalPacket(f.Data) return res, nil - case can.CanID{Id: 0x11, Extended: false}: + case can.CanID{ Id: 0x11, Extended: false }: var res = &BatteryStatus{} res.UnmarshalPacket(f.Data) return res, nil - case can.CanID{Id: 0x12, Extended: false}: + case can.CanID{ Id: 0x12, Extended: false }: var res = &BmsKillReason{} res.UnmarshalPacket(f.Data) return res, nil - case can.CanID{Id: 0x13, Extended: false}: + case can.CanID{ Id: 0x13, Extended: false }: var res = &BmsModuleMinMax{} res.UnmarshalPacket(f.Data) return res, nil - case can.CanID{Id: 0x14, Extended: false}: + case can.CanID{ Id: 0x14, Extended: false }: var res = &BmsSoc{} res.UnmarshalPacket(f.Data) return res, nil - case can.CanID{Id: 0x15, Extended: false}: + case can.CanID{ Id: 0x15, Extended: false }: var res = &BmsCapacity{} res.UnmarshalPacket(f.Data) return res, nil - case can.CanID{Id: 0x18, Extended: false}: + case can.CanID{ Id: 0x18, Extended: false }: var res = &BmsCurrentlimit{} res.UnmarshalPacket(f.Data) return res, nil - case can.CanID{Id: 0x19, Extended: false}: + case can.CanID{ Id: 0x19, Extended: false }: var res = &BmsFanInfo{} res.UnmarshalPacket(f.Data) return res, nil - case can.CanID{Id: 0x1B, Extended: false}: + case can.CanID{ Id: 0x1B, Extended: false }: var res = &BmsSetMinFanSpeed{} res.UnmarshalPacket(f.Data) return res, nil - case can.CanID{Id: 0x40, Extended: false}, can.CanID{Id: 0x41, Extended: false}, can.CanID{Id: 0x42, Extended: false}, can.CanID{Id: 0x43, Extended: false}, can.CanID{Id: 0x44, Extended: false}, can.CanID{Id: 0x45, Extended: false}, can.CanID{Id: 0x46, Extended: false}, can.CanID{Id: 0x47, Extended: false}, can.CanID{Id: 0x48, Extended: false}, can.CanID{Id: 0x49, Extended: false}, can.CanID{Id: 0x4A, Extended: false}, can.CanID{Id: 0x4B, Extended: false}, can.CanID{Id: 0x4C, Extended: false}, can.CanID{Id: 0x4D, Extended: false}, can.CanID{Id: 0x4E, Extended: false}, can.CanID{Id: 0x4F, Extended: false}, can.CanID{Id: 0x50, Extended: false}, can.CanID{Id: 0x51, Extended: false}, can.CanID{Id: 0x52, Extended: false}, can.CanID{Id: 0x53, Extended: false}, can.CanID{Id: 0x54, Extended: false}, can.CanID{Id: 0x55, Extended: false}, can.CanID{Id: 0x56, Extended: false}, can.CanID{Id: 0x57, Extended: false}, can.CanID{Id: 0x58, Extended: false}, can.CanID{Id: 0x59, Extended: false}, can.CanID{Id: 0x5A, Extended: false}, can.CanID{Id: 0x5B, Extended: false}, can.CanID{Id: 0x5C, Extended: false}, can.CanID{Id: 0x5D, Extended: false}, can.CanID{Id: 0x5E, Extended: false}, can.CanID{Id: 0x5F, Extended: false}, can.CanID{Id: 0x60, Extended: false}, can.CanID{Id: 0x61, Extended: false}, can.CanID{Id: 0x62, Extended: false}, can.CanID{Id: 0x63, Extended: false}: + case can.CanID{ Id: 0x40, Extended: false },can.CanID{ Id: 0x41, Extended: false },can.CanID{ Id: 0x42, Extended: false },can.CanID{ Id: 0x43, Extended: false },can.CanID{ Id: 0x44, Extended: false },can.CanID{ Id: 0x45, Extended: false },can.CanID{ Id: 0x46, Extended: false },can.CanID{ Id: 0x47, Extended: false },can.CanID{ Id: 0x48, Extended: false },can.CanID{ Id: 0x49, Extended: false },can.CanID{ Id: 0x4A, Extended: false },can.CanID{ Id: 0x4B, Extended: false },can.CanID{ Id: 0x4C, Extended: false },can.CanID{ Id: 0x4D, Extended: false },can.CanID{ Id: 0x4E, Extended: false },can.CanID{ Id: 0x4F, Extended: false },can.CanID{ Id: 0x50, Extended: false },can.CanID{ Id: 0x51, Extended: false },can.CanID{ Id: 0x52, Extended: false },can.CanID{ Id: 0x53, Extended: false },can.CanID{ Id: 0x54, Extended: false },can.CanID{ Id: 0x55, Extended: false },can.CanID{ Id: 0x56, Extended: false },can.CanID{ Id: 0x57, Extended: false },can.CanID{ Id: 0x58, Extended: false },can.CanID{ Id: 0x59, Extended: false },can.CanID{ Id: 0x5A, Extended: false },can.CanID{ Id: 0x5B, Extended: false },can.CanID{ Id: 0x5C, Extended: false },can.CanID{ Id: 0x5D, Extended: false },can.CanID{ Id: 0x5E, Extended: false },can.CanID{ Id: 0x5F, Extended: false },can.CanID{ Id: 0x60, Extended: false },can.CanID{ Id: 0x61, Extended: false },can.CanID{ Id: 0x62, Extended: false },can.CanID{ Id: 0x63, Extended: false }: var res = &BmsModule{} res.UnmarshalPacket(f.Data) res.Idx = id.Id - 0x40 return res, nil - case can.CanID{Id: 0x75, Extended: false}: + case can.CanID{ Id: 0x75, Extended: false }: var res = &BmsChargerResponse{} res.UnmarshalPacket(f.Data) return res, nil - case can.CanID{Id: 0x38, Extended: false}: + case can.CanID{ Id: 0x38, Extended: false }: var res = &ChassisIsolationFault{} res.UnmarshalPacket(f.Data) return res, nil - case can.CanID{Id: 0x37, Extended: false}: + case can.CanID{ Id: 0x37, Extended: false }: var res = &BmsImdInfo{} res.UnmarshalPacket(f.Data) return res, nil - case can.CanID{Id: 0x290, Extended: false}: + case can.CanID{ Id: 0x290, Extended: false }: var res = &DashboardPedalPercentages{} res.UnmarshalPacket(f.Data) return res, nil - case can.CanID{Id: 0x291, Extended: false}: + case can.CanID{ Id: 0x291, Extended: false }: var res = &CarState{} res.UnmarshalPacket(f.Data) return res, nil - case can.CanID{Id: 0x292, Extended: false}: + case can.CanID{ Id: 0x292, Extended: false }: var res = &DashboardPedalFault{} res.UnmarshalPacket(f.Data) return res, nil - case can.CanID{Id: 0x299, Extended: false}: + case can.CanID{ Id: 0x299, Extended: false }: var res = &DashboardSystemTimeoutTest{} res.UnmarshalPacket(f.Data) return res, nil - case can.CanID{Id: 0x29A, Extended: false}: + case can.CanID{ Id: 0x29A, Extended: false }: var res = &CarSpeed{} res.UnmarshalPacket(f.Data) return res, nil - case can.CanID{Id: 0x29B, Extended: false}: + case can.CanID{ Id: 0x29B, Extended: false }: var res = &FlightComputerLvBoardDisconnectCounts{} res.UnmarshalPacket(f.Data) return res, nil - case can.CanID{Id: 0x29C, Extended: false}: + case can.CanID{ Id: 0x29C, Extended: false }: var res = &FlightComputerHvBoardDisconnectCounts{} res.UnmarshalPacket(f.Data) return res, nil - case can.CanID{Id: 0x29D, Extended: false}: + case can.CanID{ Id: 0x29D, Extended: false }: var res = &FlightComputerInternalState{} res.UnmarshalPacket(f.Data) return res, nil - case can.CanID{Id: 0x19E, Extended: false}: + case can.CanID{ Id: 0x19E, Extended: false }: var res = &PowerToDrive{} res.UnmarshalPacket(f.Data) return res, nil - case can.CanID{Id: 0x19F, Extended: false}: + case can.CanID{ Id: 0x19F, Extended: false }: var res = &ArrayPower{} res.UnmarshalPacket(f.Data) return res, nil - case can.CanID{Id: 0x119, Extended: false}: + case can.CanID{ Id: 0x119, Extended: false }: var res = &ArrayEnergy{} res.UnmarshalPacket(f.Data) return res, nil - case can.CanID{Id: 0x120, Extended: false}: + case can.CanID{ Id: 0x120, Extended: false }: var res = &ArrayEnergyReset{} res.UnmarshalPacket(f.Data) return res, nil - case can.CanID{Id: 0x2B0, Extended: false}: + case can.CanID{ Id: 0x2B0, Extended: false }: var res = &VisionTurnSignalsCommand{} res.UnmarshalPacket(f.Data) return res, nil - case can.CanID{Id: 0x2B1, Extended: false}: + case can.CanID{ Id: 0x2B1, Extended: false }: var res = &VisionBrakeLightsCommand{} res.UnmarshalPacket(f.Data) return res, nil - case can.CanID{Id: 0x2B2, Extended: false}: + case can.CanID{ Id: 0x2B2, Extended: false }: var res = &VisionHeadlightsCommand{} res.UnmarshalPacket(f.Data) return res, nil - case can.CanID{Id: 0x2B3, Extended: false}: + case can.CanID{ Id: 0x2B3, Extended: false }: var res = &VisionHornCommand{} res.UnmarshalPacket(f.Data) return res, nil - case can.CanID{Id: 0x2B4, Extended: false}: + case can.CanID{ Id: 0x2B4, Extended: false }: var res = &VisionArrayLatchesCommand{} res.UnmarshalPacket(f.Data) return res, nil - case can.CanID{Id: 0x2B5, Extended: false}: + case can.CanID{ Id: 0x2B5, Extended: false }: var res = &VisionRearviewCommand{} res.UnmarshalPacket(f.Data) return res, nil - case can.CanID{Id: 0x610, Extended: false}, can.CanID{Id: 0x611, Extended: false}, can.CanID{Id: 0x612, Extended: false}, can.CanID{Id: 0x613, Extended: false}, can.CanID{Id: 0x614, Extended: false}, can.CanID{Id: 0x615, Extended: false}: + case can.CanID{ Id: 0x610, Extended: false },can.CanID{ Id: 0x611, Extended: false },can.CanID{ Id: 0x612, Extended: false },can.CanID{ Id: 0x613, Extended: false },can.CanID{ Id: 0x614, Extended: false },can.CanID{ Id: 0x615, Extended: false }: var res = &TrackerEnable{} res.UnmarshalPacket(f.Data) res.Idx = id.Id - 0x610 return res, nil - case can.CanID{Id: 0x19D, Extended: false}: + case can.CanID{ Id: 0x19D, Extended: false }: var res = &DistanceTraveled{} res.UnmarshalPacket(f.Data) return res, nil - case can.CanID{Id: 0x573, Extended: false}: + case can.CanID{ Id: 0x573, Extended: false }: var res = &ChargerState{} res.UnmarshalPacket(f.Data) return res, nil - case can.CanID{Id: 0x74, Extended: false}: + case can.CanID{ Id: 0x74, Extended: false }: var res = &ChargerBmsRequest{} res.UnmarshalPacket(f.Data) return res, nil - case can.CanID{Id: 0x576, Extended: false}: + case can.CanID{ Id: 0x576, Extended: false }: var res = &ChargerCurrentVoltage{} res.UnmarshalPacket(f.Data) return res, nil - case can.CanID{Id: 0x577, Extended: false}: + case can.CanID{ Id: 0x577, Extended: false }: var res = &ChargerPower{} res.UnmarshalPacket(f.Data) return res, nil - case can.CanID{Id: 0x18E54024, Extended: true}: + case can.CanID{ Id: 0x18E54024, Extended: true }: var res = &ThunderstruckControlMessage{} res.UnmarshalPacket(f.Data) return res, nil - case can.CanID{Id: 0x2B6, Extended: false}: + case can.CanID{ Id: 0x2B6, Extended: false }: var res = &VisionStatusFront{} res.UnmarshalPacket(f.Data) return res, nil - case can.CanID{Id: 0x2B7, Extended: false}: + case can.CanID{ Id: 0x2B7, Extended: false }: var res = &VisionStatusRear{} res.UnmarshalPacket(f.Data) return res, nil - case can.CanID{Id: 0x300, Extended: false}: + case can.CanID{ Id: 0x300, Extended: false }: var res = &LightsFrontId{} res.UnmarshalPacket(f.Data) return res, nil - case can.CanID{Id: 0x301, Extended: false}: + case can.CanID{ Id: 0x301, Extended: false }: var res = &LightsBackId{} res.UnmarshalPacket(f.Data) return res, nil - case can.CanID{Id: 0x302, Extended: false}: + case can.CanID{ Id: 0x302, Extended: false }: var res = &VisionId{} res.UnmarshalPacket(f.Data) return res, nil - case can.CanID{Id: 0x240, Extended: false}: + case can.CanID{ Id: 0x240, Extended: false }: var res = &SteeringPressCount1{} res.UnmarshalPacket(f.Data) return res, nil - case can.CanID{Id: 0x250, Extended: false}: + case can.CanID{ Id: 0x250, Extended: false }: var res = &SteeringPressCount2{} res.UnmarshalPacket(f.Data) return res, nil - case can.CanID{Id: 0x241, Extended: false}: + case can.CanID{ Id: 0x241, Extended: false }: var res = &SteeringButtonColors1{} res.UnmarshalPacket(f.Data) return res, nil - case can.CanID{Id: 0x251, Extended: false}: + case can.CanID{ Id: 0x251, Extended: false }: var res = &SteeringButtonColors2{} res.UnmarshalPacket(f.Data) return res, nil - case can.CanID{Id: 0x242, Extended: false}: + case can.CanID{ Id: 0x242, Extended: false }: var res = &SteeringHorn{} res.UnmarshalPacket(f.Data) return res, nil - case can.CanID{Id: 0x18EB2440, Extended: true}: + case can.CanID{ Id: 0x18EB2440, Extended: false }: var res = &ThunderstruckStatusMessage{} res.UnmarshalPacket(f.Data) return res, nil - case can.CanID{Id: 0x600, Extended: false}, can.CanID{Id: 0x601, Extended: false}, can.CanID{Id: 0x602, Extended: false}, can.CanID{Id: 0x603, Extended: false}, can.CanID{Id: 0x604, Extended: false}, can.CanID{Id: 0x605, Extended: false}: + case can.CanID{ Id: 0x600, Extended: false },can.CanID{ Id: 0x601, Extended: false },can.CanID{ Id: 0x602, Extended: false },can.CanID{ Id: 0x603, Extended: false },can.CanID{ Id: 0x604, Extended: false },can.CanID{ Id: 0x605, Extended: false }: var res = &TrackerData{} res.UnmarshalPacket(f.Data) res.Idx = id.Id - 0x600 return res, nil - case can.CanID{Id: 0x121, Extended: false}: + case can.CanID{ Id: 0x121, Extended: false }: var res = &TritiumMotorDriveL{} res.UnmarshalPacket(f.Data) return res, nil - case can.CanID{Id: 0x122, Extended: false}: + case can.CanID{ Id: 0x122, Extended: false }: var res = &TritiumMotorPowerL{} res.UnmarshalPacket(f.Data) return res, nil - case can.CanID{Id: 0x123, Extended: false}: + case can.CanID{ Id: 0x123, Extended: false }: var res = &TritiumResetL{} res.UnmarshalPacket(f.Data) return res, nil - case can.CanID{Id: 0x161, Extended: false}: + case can.CanID{ Id: 0x161, Extended: false }: var res = &TritiumMotorDriveR{} res.UnmarshalPacket(f.Data) return res, nil - case can.CanID{Id: 0x162, Extended: false}: + case can.CanID{ Id: 0x162, Extended: false }: var res = &TritiumMotorPowerR{} res.UnmarshalPacket(f.Data) return res, nil - case can.CanID{Id: 0x163, Extended: false}: + case can.CanID{ Id: 0x163, Extended: false }: var res = &TritiumResetR{} res.UnmarshalPacket(f.Data) return res, nil - case can.CanID{Id: 0x16, Extended: false}: + case can.CanID{ Id: 0x16, Extended: false }: var res = &BmsAhSet{} res.UnmarshalPacket(f.Data) return res, nil - case can.CanID{Id: 0x17, Extended: false}: + case can.CanID{ Id: 0x17, Extended: false }: var res = &BmsWhSet{} res.UnmarshalPacket(f.Data) return res, nil - case can.CanID{Id: 0x1A, Extended: false}: + case can.CanID{ Id: 0x1A, Extended: false }: var res = &BmsKill{} res.UnmarshalPacket(f.Data) return res, nil - case can.CanID{Id: 0x700, Extended: false}: + case can.CanID{ Id: 0x700, Extended: false }: var res = &TelemetryRtcReset{} res.UnmarshalPacket(f.Data) return res, nil - case can.CanID{Id: 0x140, Extended: false}: + case can.CanID{ Id: 0x140, Extended: false }: var res = &WsrIdentification{} res.UnmarshalPacket(f.Data) return res, nil - case can.CanID{Id: 0x141, Extended: false}: + case can.CanID{ Id: 0x141, Extended: false }: var res = &WsrStatusInformation{} res.UnmarshalPacket(f.Data) return res, nil - case can.CanID{Id: 0x142, Extended: false}: + case can.CanID{ Id: 0x142, Extended: false }: var res = &WsrBusMeasurement{} res.UnmarshalPacket(f.Data) return res, nil - case can.CanID{Id: 0x143, Extended: false}: + case can.CanID{ Id: 0x143, Extended: false }: var res = &WsrVelocity{} res.UnmarshalPacket(f.Data) return res, nil - case can.CanID{Id: 0x144, Extended: false}: + case can.CanID{ Id: 0x144, Extended: false }: var res = &WsrPhaseCurrent{} res.UnmarshalPacket(f.Data) return res, nil - case can.CanID{Id: 0x145, Extended: false}: + case can.CanID{ Id: 0x145, Extended: false }: var res = &WsrMotorVoltageVector{} res.UnmarshalPacket(f.Data) return res, nil - case can.CanID{Id: 0x146, Extended: false}: + case can.CanID{ Id: 0x146, Extended: false }: var res = &WsrMotorCurrentVector{} res.UnmarshalPacket(f.Data) return res, nil - case can.CanID{Id: 0x147, Extended: false}: + case can.CanID{ Id: 0x147, Extended: false }: var res = &WsrMotorBackemf{} res.UnmarshalPacket(f.Data) return res, nil - case can.CanID{Id: 0x148, Extended: false}: + case can.CanID{ Id: 0x148, Extended: false }: var res = &Wsr15165VoltageRail{} res.UnmarshalPacket(f.Data) return res, nil - case can.CanID{Id: 0x149, Extended: false}: + case can.CanID{ Id: 0x149, Extended: false }: var res = &Wsr2512VoltageRail{} res.UnmarshalPacket(f.Data) return res, nil - case can.CanID{Id: 0x14B, Extended: false}: + case can.CanID{ Id: 0x14B, Extended: false }: var res = &WsrHeatsinkMotorTemp{} res.UnmarshalPacket(f.Data) return res, nil - case can.CanID{Id: 0x14C, Extended: false}: + case can.CanID{ Id: 0x14C, Extended: false }: var res = &WsrDspBoardTemp{} res.UnmarshalPacket(f.Data) return res, nil - case can.CanID{Id: 0x14D, Extended: false}: + case can.CanID{ Id: 0x14D, Extended: false }: var res = &WsrReserved{} res.UnmarshalPacket(f.Data) return res, nil - case can.CanID{Id: 0x14E, Extended: false}: + case can.CanID{ Id: 0x14E, Extended: false }: var res = &WsrOdometerBusAmphoursMeasurement{} res.UnmarshalPacket(f.Data) return res, nil - case can.CanID{Id: 0x157, Extended: false}: + case can.CanID{ Id: 0x157, Extended: false }: var res = &WsrSlipSpeedMeasurement{} res.UnmarshalPacket(f.Data) return res, nil - case can.CanID{Id: 0x100, Extended: false}: + case can.CanID{ Id: 0x100, Extended: false }: var res = &WslIdentification{} res.UnmarshalPacket(f.Data) return res, nil - case can.CanID{Id: 0x101, Extended: false}: + case can.CanID{ Id: 0x101, Extended: false }: var res = &WslStatusInformation{} res.UnmarshalPacket(f.Data) return res, nil - case can.CanID{Id: 0x102, Extended: false}: + case can.CanID{ Id: 0x102, Extended: false }: var res = &WslBusMeasurement{} res.UnmarshalPacket(f.Data) return res, nil - case can.CanID{Id: 0x103, Extended: false}: + case can.CanID{ Id: 0x103, Extended: false }: var res = &WslVelocity{} res.UnmarshalPacket(f.Data) return res, nil - case can.CanID{Id: 0x104, Extended: false}: + case can.CanID{ Id: 0x104, Extended: false }: var res = &WslPhaseCurrent{} res.UnmarshalPacket(f.Data) return res, nil - case can.CanID{Id: 0x105, Extended: false}: + case can.CanID{ Id: 0x105, Extended: false }: var res = &WslMotorVoltageVector{} res.UnmarshalPacket(f.Data) return res, nil - case can.CanID{Id: 0x106, Extended: false}: + case can.CanID{ Id: 0x106, Extended: false }: var res = &WslMotorCurrentVector{} res.UnmarshalPacket(f.Data) return res, nil - case can.CanID{Id: 0x107, Extended: false}: + case can.CanID{ Id: 0x107, Extended: false }: var res = &WslMotorBackemf{} res.UnmarshalPacket(f.Data) return res, nil - case can.CanID{Id: 0x108, Extended: false}: + case can.CanID{ Id: 0x108, Extended: false }: var res = &Wsl15165VoltageRail{} res.UnmarshalPacket(f.Data) return res, nil - case can.CanID{Id: 0x109, Extended: false}: + case can.CanID{ Id: 0x109, Extended: false }: var res = &Wsl2512VoltageRail{} res.UnmarshalPacket(f.Data) return res, nil - case can.CanID{Id: 0x10B, Extended: false}: + case can.CanID{ Id: 0x10B, Extended: false }: var res = &WslHeatsinkMotorTemp{} res.UnmarshalPacket(f.Data) return res, nil - case can.CanID{Id: 0x10C, Extended: false}: + case can.CanID{ Id: 0x10C, Extended: false }: var res = &WslDspBoardTemp{} res.UnmarshalPacket(f.Data) return res, nil - case can.CanID{Id: 0x10E, Extended: false}: + case can.CanID{ Id: 0x10E, Extended: false }: var res = &WslOdometerBusAmphoursMeasurement{} res.UnmarshalPacket(f.Data) return res, nil - case can.CanID{Id: 0x10D, Extended: false}: + case can.CanID{ Id: 0x10D, Extended: false }: var res = &WslReserved{} res.UnmarshalPacket(f.Data) return res, nil - case can.CanID{Id: 0x117, Extended: false}: + case can.CanID{ Id: 0x117, Extended: false }: var res = &WslSlipSpeedMeasurement{} res.UnmarshalPacket(f.Data) return res, nil @@ -623,7 +623,8 @@ func FromCanFrame(f can.Frame) (Packet, error) { panic("This should never happen. CAN ID didn't match but was in ID map") } -func FromJson(name string, raw []byte) (Packet, error) { + +func FromJson (name string, raw []byte) (Packet, error) { switch name { case "bms_measurement": var res = &BmsMeasurement{} @@ -991,6 +992,8 @@ func FromJson(name string, raw []byte) (Packet, error) { } + + // BmsMeasurement is Voltages for main battery and aux pack type BmsMeasurement struct { // 0.01 V @@ -1035,14 +1038,15 @@ func (p *BmsMeasurement) String() string { return "bms_measurement" } + type BatteryStatusBatteryState struct { - Startup bool `json:"startup"` - Precharge bool `json:"precharge"` - Discharging bool `json:"discharging"` - LvOnly bool `json:"lv_only"` - Charging bool `json:"charging"` + Startup bool `json:"startup"` + Precharge bool `json:"precharge"` + Discharging bool `json:"discharging"` + LvOnly bool `json:"lv_only"` + Charging bool `json:"charging"` WallCharging bool `json:"wall_charging"` - Killed bool `json:"killed"` + Killed bool `json:"killed"` } func (p *BatteryStatusBatteryState) MarshalByte() byte { @@ -1082,14 +1086,14 @@ func (p *BatteryStatusBatteryState) UnmarshalByte(b byte) { } type BatteryStatusContactorState struct { - BatteryHighContactor bool `json:"battery_high_contactor"` - BatteryLowContactor bool `json:"battery_low_contactor"` + BatteryHighContactor bool `json:"battery_high_contactor"` + BatteryLowContactor bool `json:"battery_low_contactor"` BatteryVicorContactor bool `json:"battery_vicor_contactor"` - BatteryPreContactor bool `json:"battery_pre_contactor"` + BatteryPreContactor bool `json:"battery_pre_contactor"` BatteryHigh2Contactor bool `json:"battery_high2_contactor"` - BatteryLow2Contactor bool `json:"battery_low2_contactor"` - ChargerHighContactor bool `json:"charger_high_contactor"` - ChargerPreContactor bool `json:"charger_pre_contactor"` + BatteryLow2Contactor bool `json:"battery_low2_contactor"` + ChargerHighContactor bool `json:"charger_high_contactor"` + ChargerPreContactor bool `json:"charger_pre_contactor"` } func (p *BatteryStatusContactorState) MarshalByte() byte { @@ -1133,11 +1137,11 @@ func (p *BatteryStatusContactorState) UnmarshalByte(b byte) { } type BatteryStatusLvChannelStatus struct { - AuxFault bool `json:"aux_fault"` - MainFault bool `json:"main_fault"` - AuxPowerValid bool `json:"aux_power_valid"` - MainPowerValid bool `json:"main_power_valid"` - AuxPowerActive bool `json:"aux_power_active"` + AuxFault bool `json:"aux_fault"` + MainFault bool `json:"main_fault"` + AuxPowerValid bool `json:"aux_power_valid"` + MainPowerValid bool `json:"main_power_valid"` + AuxPowerActive bool `json:"aux_power_active"` MainPowerActive bool `json:"main_power_active"` } @@ -1174,14 +1178,14 @@ func (p *BatteryStatusLvChannelStatus) UnmarshalByte(b byte) { } type BatteryStatusLvControlStatus struct { - AuxVicorEnable bool `json:"aux_vicor_enable"` - BatVicorEnable bool `json:"bat_vicor_enable"` - AuxRelayHeld bool `json:"aux_relay_held"` - AuxRefEnable bool `json:"aux_ref_enable"` + AuxVicorEnable bool `json:"aux_vicor_enable"` + BatVicorEnable bool `json:"bat_vicor_enable"` + AuxRelayHeld bool `json:"aux_relay_held"` + AuxRefEnable bool `json:"aux_ref_enable"` AuxChargingEnable bool `json:"aux_charging_enable"` - KillHv bool `json:"kill_hv"` - KillLv bool `json:"kill_lv"` - StartButton bool `json:"start_button"` + KillHv bool `json:"kill_hv"` + KillLv bool `json:"kill_lv"` + StartButton bool `json:"start_button"` } func (p *BatteryStatusLvControlStatus) MarshalByte() byte { @@ -1245,13 +1249,14 @@ func (p *BatteryStatusPackChoice) UnmarshalByte(b byte) { p.SmallPack = (b & (1 << 1)) != 0 } + // BatteryStatus is Status bits for the battery type BatteryStatus struct { - BatteryState BatteryStatusBatteryState `json:"battery_state"` - ContactorState BatteryStatusContactorState `json:"contactor_state"` + BatteryState BatteryStatusBatteryState `json:"battery_state"` + ContactorState BatteryStatusContactorState `json:"contactor_state"` LvChannelStatus BatteryStatusLvChannelStatus `json:"lv_channel_status"` LvControlStatus BatteryStatusLvControlStatus `json:"lv_control_status"` - PackChoice BatteryStatusPackChoice `json:"pack_choice"` + PackChoice BatteryStatusPackChoice `json:"pack_choice"` } func (p *BatteryStatus) CanId() (can.CanID, error) { @@ -1292,12 +1297,13 @@ func (p *BatteryStatus) String() string { return "battery_status" } + type BmsKillReasonReason1 struct { - OVERVOLT bool `json:"OVERVOLT"` - UNDERVOLT bool `json:"UNDERVOLT"` - OVERTEMP bool `json:"OVERTEMP"` + OVERVOLT bool `json:"OVERVOLT"` + UNDERVOLT bool `json:"UNDERVOLT"` + OVERTEMP bool `json:"OVERTEMP"` TEMPDISCONNECT bool `json:"TEMP_DISCONNECT"` - COMMFAIL bool `json:"COMM_FAIL"` + COMMFAIL bool `json:"COMM_FAIL"` } func (p *BmsKillReasonReason1) MarshalByte() byte { @@ -1329,13 +1335,13 @@ func (p *BmsKillReasonReason1) UnmarshalByte(b byte) { } type BmsKillReasonReason2 struct { - HARDWARE bool `json:"HARDWARE"` - KILLPACKET bool `json:"KILL_PACKET"` - UKNOWN bool `json:"UKNOWN"` - OVERCURRENT bool `json:"OVERCURRENT"` + HARDWARE bool `json:"HARDWARE"` + KILLPACKET bool `json:"KILL_PACKET"` + UKNOWN bool `json:"UKNOWN"` + OVERCURRENT bool `json:"OVERCURRENT"` PRECHARGEFAIL bool `json:"PRECHARGE_FAIL"` - AUXOVERUNDER bool `json:"AUX_OVER_UNDER"` - AUXOVERTEMP bool `json:"AUX_OVERTEMP"` + AUXOVERUNDER bool `json:"AUX_OVER_UNDER"` + AUXOVERTEMP bool `json:"AUX_OVERTEMP"` } func (p *BmsKillReasonReason2) MarshalByte() byte { @@ -1374,12 +1380,13 @@ func (p *BmsKillReasonReason2) UnmarshalByte(b byte) { p.AUXOVERTEMP = (b & (1 << 6)) != 0 } + // BmsKillReason is Information for when the car kills type BmsKillReason struct { Reason1 BmsKillReasonReason1 `json:"reason1"` Reason2 BmsKillReasonReason2 `json:"reason2"` - Module uint16 `json:"module"` - Value float32 `json:"value"` + Module uint16 `json:"module"` + Value float32 `json:"value"` } func (p *BmsKillReason) CanId() (can.CanID, error) { @@ -1418,6 +1425,8 @@ func (p *BmsKillReason) String() string { return "bms_kill_reason" } + + // BmsModuleMinMax is min and max cell voltages and temperatures type BmsModuleMinMax struct { // 0.01 C @@ -1466,6 +1475,8 @@ func (p *BmsModuleMinMax) String() string { return "bms_module_min_max" } + + // BmsSoc is State of charge type BmsSoc struct { Soc float32 `json:"soc"` @@ -1501,6 +1512,8 @@ func (p *BmsSoc) String() string { return "bms_soc" } + + // BmsCapacity is State of charge type BmsCapacity struct { Ah float32 `json:"Ah"` @@ -1539,6 +1552,8 @@ func (p *BmsCapacity) String() string { return "bms_capacity" } + + // BmsCurrentlimit is reports BP params for current type BmsCurrentlimit struct { // 0.01 A @@ -1579,6 +1594,8 @@ func (p *BmsCurrentlimit) String() string { return "bms_currentlimit" } + + // BmsFanInfo is BP Fans type BmsFanInfo struct { // 1 RPM @@ -1627,6 +1644,8 @@ func (p *BmsFanInfo) String() string { return "bms_fan_info" } + + // BmsSetMinFanSpeed is packet which sets a minimum fan speed of BMS for a specific time frame in seconds type BmsSetMinFanSpeed struct { // 0 percent @@ -1667,6 +1686,8 @@ func (p *BmsSetMinFanSpeed) String() string { return "bms_set_min_fan_speed" } + + // BmsModule is Voltage and temperature for a single module type BmsModule struct { // 1 V @@ -1680,7 +1701,7 @@ type BmsModule struct { func (p *BmsModule) CanId() (can.CanID, error) { c := can.CanID{Extended: false} if p.Idx >= 36 { - return c, &UnknownIdError{0x40} + return c, &UnknownIdError{ 0x40 } } c.Id = 0x40 + p.Idx return c, nil @@ -1712,6 +1733,7 @@ func (p *BmsModule) String() string { return "bms_module" } + type BmsChargerResponseResponseFlags struct { ChargingReady bool `json:"charging_ready"` } @@ -1728,6 +1750,7 @@ func (p *BmsChargerResponseResponseFlags) UnmarshalByte(b byte) { p.ChargingReady = (b & (1 << 0)) != 0 } + // BmsChargerResponse is Response packet from BMS for indicating whether BMS is ready for charging type BmsChargerResponse struct { ResponseFlags BmsChargerResponseResponseFlags `json:"response_flags"` @@ -1763,6 +1786,7 @@ func (p *BmsChargerResponse) String() string { return "bms_charger_response" } + type ChassisIsolationFaultFaultDetected struct { IsolationFault bool `json:"isolation_fault"` } @@ -1779,6 +1803,7 @@ func (p *ChassisIsolationFaultFaultDetected) UnmarshalByte(b byte) { p.IsolationFault = (b & (1 << 0)) != 0 } + // ChassisIsolationFault is chassiss is not isolated from the battery type ChassisIsolationFault struct { FaultDetected ChassisIsolationFaultFaultDetected `json:"fault_detected"` @@ -1814,15 +1839,16 @@ func (p *ChassisIsolationFault) String() string { return "chassis_isolation_fault" } + type BmsImdInfoDImcStatus1 struct { - IsolationFault bool `json:"isolation_fault"` - ChassisFault bool `json:"chassis_fault"` - SystemFailure bool `json:"system_failure"` + IsolationFault bool `json:"isolation_fault"` + ChassisFault bool `json:"chassis_fault"` + SystemFailure bool `json:"system_failure"` CalibrationRunning bool `json:"calibration_running"` - SelfTestRunning bool `json:"self_test_running"` - IsolationWarning bool `json:"isolation_warning"` - Reserved bool `json:"reserved"` - Reserved2 bool `json:"reserved_2"` + SelfTestRunning bool `json:"self_test_running"` + IsolationWarning bool `json:"isolation_warning"` + Reserved bool `json:"reserved"` + Reserved2 bool `json:"reserved_2"` } func (p *BmsImdInfoDImcStatus1) MarshalByte() byte { @@ -1866,7 +1892,7 @@ func (p *BmsImdInfoDImcStatus1) UnmarshalByte(b byte) { } type BmsImdInfoDImcStatus2 struct { - Reserved bool `json:"reserved"` + Reserved bool `json:"reserved"` Reserved2 bool `json:"reserved_2"` Reserved3 bool `json:"reserved_3"` Reserved4 bool `json:"reserved_4"` @@ -1917,14 +1943,14 @@ func (p *BmsImdInfoDImcStatus2) UnmarshalByte(b byte) { } type BmsImdInfoDVifcStatus1 struct { - InsulationMeasurment bool `json:"insulation_measurment"` + InsulationMeasurment bool `json:"insulation_measurment"` ImcConnectivityNotImplemented bool `json:"imc_connectivity_not_implemented"` - ImcAliveSatusDetection bool `json:"imc_alive_satus_detection"` - Reserved bool `json:"reserved"` - VifcCommandNotImplemented bool `json:"vifc_command_not_implemented"` - Reserved2 bool `json:"reserved_2"` - Reserved3 bool `json:"reserved_3"` - Reserved4 bool `json:"reserved_4"` + ImcAliveSatusDetection bool `json:"imc_alive_satus_detection"` + Reserved bool `json:"reserved"` + VifcCommandNotImplemented bool `json:"vifc_command_not_implemented"` + Reserved2 bool `json:"reserved_2"` + Reserved3 bool `json:"reserved_3"` + Reserved4 bool `json:"reserved_4"` } func (p *BmsImdInfoDVifcStatus1) MarshalByte() byte { @@ -1968,14 +1994,14 @@ func (p *BmsImdInfoDVifcStatus1) UnmarshalByte(b byte) { } type BmsImdInfoDVifcStatus2 struct { - InsulationResistanceValue bool `json:"insulation_resistance_value"` - Reserved bool `json:"reserved"` - Reserved2 bool `json:"reserved_2"` - Reserved3 bool `json:"reserved_3"` - ImcSelfTestOverAll bool `json:"imc_self_test_overAll"` + InsulationResistanceValue bool `json:"insulation_resistance_value"` + Reserved bool `json:"reserved"` + Reserved2 bool `json:"reserved_2"` + Reserved3 bool `json:"reserved_3"` + ImcSelfTestOverAll bool `json:"imc_self_test_overAll"` ImcSelfTestParameterConfig bool `json:"imc_self_test_parameterConfig"` - Reserved4 bool `json:"reserved_4"` - Reserved5 bool `json:"reserved_5"` + Reserved4 bool `json:"reserved_4"` + Reserved5 bool `json:"reserved_5"` } func (p *BmsImdInfoDVifcStatus2) MarshalByte() byte { @@ -2018,11 +2044,12 @@ func (p *BmsImdInfoDVifcStatus2) UnmarshalByte(b byte) { p.Reserved5 = (b & (1 << 7)) != 0 } + // BmsImdInfo is information from chassis isolation type BmsImdInfo struct { - DImcRIso uint16 `json:"d_imc_r_iso"` - DImcStatus1 BmsImdInfoDImcStatus1 `json:"d_imc_status_1"` - DImcStatus2 BmsImdInfoDImcStatus2 `json:"d_imc_status_2"` + DImcRIso uint16 `json:"d_imc_r_iso"` + DImcStatus1 BmsImdInfoDImcStatus1 `json:"d_imc_status_1"` + DImcStatus2 BmsImdInfoDImcStatus2 `json:"d_imc_status_2"` DVifcStatus1 BmsImdInfoDVifcStatus1 `json:"d_vifc_status_1"` DVifcStatus2 BmsImdInfoDVifcStatus2 `json:"d_vifc_status_2"` } @@ -2065,6 +2092,8 @@ func (p *BmsImdInfo) String() string { return "bms_imd_info" } + + // DashboardPedalPercentages is ADC values from the brake and accelerator pedals. type DashboardPedalPercentages struct { AccelPedalValue uint8 `json:"accel_pedal_value"` @@ -2103,6 +2132,8 @@ func (p *DashboardPedalPercentages) String() string { return "dashboard_pedal_percentages" } + + // CarState is Car gear. Forward, neutral, reverse, etc. type CarState struct { State uint8 `json:"state"` @@ -2138,6 +2169,8 @@ func (p *CarState) String() string { return "car_state" } + + // DashboardPedalFault is Target speed that the driver should maintain. type DashboardPedalFault struct { BrakeFaultCount uint8 `json:"brake_fault_count"` @@ -2176,15 +2209,16 @@ func (p *DashboardPedalFault) String() string { return "dashboard_pedal_fault" } + type DashboardSystemTimeoutTestFlagSet0 struct { - SteeringDisconnected bool `json:"steering_disconnected"` + SteeringDisconnected bool `json:"steering_disconnected"` VisionFrontDisconnected bool `json:"vision_front_disconnected"` - VisionRearDisconnected bool `json:"vision_rear_disconnected"` - TelemetryDisconnected bool `json:"telemetry_disconnected"` - WslDisconnected bool `json:"wsl_disconnected"` - WsrDisconnected bool `json:"wsr_disconnected"` - FrontMpptDisconnected bool `json:"front_mppt_disconnected"` - RearMpptDisconnected bool `json:"rear_mppt_disconnected"` + VisionRearDisconnected bool `json:"vision_rear_disconnected"` + TelemetryDisconnected bool `json:"telemetry_disconnected"` + WslDisconnected bool `json:"wsl_disconnected"` + WsrDisconnected bool `json:"wsr_disconnected"` + FrontMpptDisconnected bool `json:"front_mppt_disconnected"` + RearMpptDisconnected bool `json:"rear_mppt_disconnected"` } func (p *DashboardSystemTimeoutTestFlagSet0) MarshalByte() byte { @@ -2227,6 +2261,7 @@ func (p *DashboardSystemTimeoutTestFlagSet0) UnmarshalByte(b byte) { p.RearMpptDisconnected = (b & (1 << 7)) != 0 } + // DashboardSystemTimeoutTest is Exposes whether each system that dashboard is supposed to listen for packets from has sent a packet. Used for testing. type DashboardSystemTimeoutTest struct { FlagSet0 DashboardSystemTimeoutTestFlagSet0 `json:"flag_set_0"` @@ -2262,6 +2297,8 @@ func (p *DashboardSystemTimeoutTest) String() string { return "dashboard_system_timeout_test" } + + // CarSpeed is speed of car in meters per second type CarSpeed struct { Speed float32 `json:"speed"` @@ -2297,12 +2334,14 @@ func (p *CarSpeed) String() string { return "car_speed" } + + // FlightComputerLvBoardDisconnectCounts is Number of times a board hasn't been heard from within the allowed timeout. type FlightComputerLvBoardDisconnectCounts struct { - FrontLights uint8 `json:"front_lights"` - RearLights uint8 `json:"rear_lights"` - Steering uint8 `json:"steering"` - Vision uint8 `json:"vision"` + FrontLights uint8 `json:"front_lights"` + RearLights uint8 `json:"rear_lights"` + Steering uint8 `json:"steering"` + Vision uint8 `json:"vision"` DriverDisplay uint8 `json:"driver_display"` CenterConsole uint8 `json:"center_console"` } @@ -2347,14 +2386,16 @@ func (p *FlightComputerLvBoardDisconnectCounts) String() string { return "flight_computer_lv_board_disconnect_counts" } + + // FlightComputerHvBoardDisconnectCounts is Number of times a board hasn't been heard from within the allowed timeout. type FlightComputerHvBoardDisconnectCounts struct { - Bms uint8 `json:"bms"` - Charger uint8 `json:"charger"` - Wsl uint8 `json:"wsl"` - Wsr uint8 `json:"wsr"` + Bms uint8 `json:"bms"` + Charger uint8 `json:"charger"` + Wsl uint8 `json:"wsl"` + Wsr uint8 `json:"wsr"` MpptFront uint8 `json:"mppt_front"` - MpptRear uint8 `json:"mppt_rear"` + MpptRear uint8 `json:"mppt_rear"` } func (p *FlightComputerHvBoardDisconnectCounts) CanId() (can.CanID, error) { @@ -2397,10 +2438,11 @@ func (p *FlightComputerHvBoardDisconnectCounts) String() string { return "flight_computer_hv_board_disconnect_counts" } + type FlightComputerInternalStateBms struct { - BatteryKill bool `json:"battery_kill"` + BatteryKill bool `json:"battery_kill"` CellsInChargingThreshold bool `json:"cells_in_charging_threshold"` - FirstPacketReceived bool `json:"first_packet_received"` + FirstPacketReceived bool `json:"first_packet_received"` } func (p *FlightComputerInternalStateBms) MarshalByte() byte { @@ -2457,7 +2499,7 @@ func (p *FlightComputerInternalStatePhoton3) UnmarshalByte(b byte) { type FlightComputerInternalStateWavesculptor struct { SendingReset bool `json:"sending_reset"` - RegenEnable bool `json:"regen_enable"` + RegenEnable bool `json:"regen_enable"` } func (p *FlightComputerInternalStateWavesculptor) MarshalByte() byte { @@ -2497,13 +2539,14 @@ func (p *FlightComputerInternalStateInternal) UnmarshalByte(b byte) { p.BrakePedalDisconnect = (b & (1 << 1)) != 0 } + // FlightComputerInternalState is internal bools type FlightComputerInternalState struct { - Bms FlightComputerInternalStateBms `json:"bms"` - Charger FlightComputerInternalStateCharger `json:"charger"` - Photon3 FlightComputerInternalStatePhoton3 `json:"photon3"` + Bms FlightComputerInternalStateBms `json:"bms"` + Charger FlightComputerInternalStateCharger `json:"charger"` + Photon3 FlightComputerInternalStatePhoton3 `json:"photon3"` Wavesculptor FlightComputerInternalStateWavesculptor `json:"wavesculptor"` - Internal FlightComputerInternalStateInternal `json:"internal"` + Internal FlightComputerInternalStateInternal `json:"internal"` } func (p *FlightComputerInternalState) CanId() (can.CanID, error) { @@ -2544,10 +2587,12 @@ func (p *FlightComputerInternalState) String() string { return "flight_computer_internal_state" } + + // PowerToDrive is calculated power required to drive the vehicle type PowerToDrive struct { MovingAverage100 int16 `json:"moving_average_100"` - MovingAverage1K int16 `json:"moving_average_1k"` + MovingAverage1K int16 `json:"moving_average_1k"` MovingAverage10K int16 `json:"moving_average_10k"` } @@ -2585,12 +2630,14 @@ func (p *PowerToDrive) String() string { return "power_to_drive" } + + // ArrayPower is array power calculated from current and voltage measurements type ArrayPower struct { FrontArrayChannel0 uint16 `json:"front_array_channel_0"` FrontArrayChannel1 uint16 `json:"front_array_channel_1"` - RearArrayChannel0 uint16 `json:"rear_array_channel_0"` - RearArrayChannel1 uint16 `json:"rear_array_channel_1"` + RearArrayChannel0 uint16 `json:"rear_array_channel_0"` + RearArrayChannel1 uint16 `json:"rear_array_channel_1"` } func (p *ArrayPower) CanId() (can.CanID, error) { @@ -2629,6 +2676,8 @@ func (p *ArrayPower) String() string { return "array_power" } + + // ArrayEnergy is cumulative energy received from the array type ArrayEnergy struct { // 0 Joule @@ -2665,6 +2714,8 @@ func (p *ArrayEnergy) String() string { return "array_energy" } + + // ArrayEnergyReset is resets cumulative energy received from the array type ArrayEnergyReset struct { // 0 Joule @@ -2701,12 +2752,13 @@ func (p *ArrayEnergyReset) String() string { return "array_energy_reset" } + type VisionTurnSignalsCommandLights struct { - LeftTurnSignal bool `json:"left_turn_signal"` + LeftTurnSignal bool `json:"left_turn_signal"` RightTurnSignal bool `json:"right_turn_signal"` - Spare1 bool `json:"spare_1"` - Spare2 bool `json:"spare_2"` - Spare3 bool `json:"spare_3"` + Spare1 bool `json:"spare_1"` + Spare2 bool `json:"spare_2"` + Spare3 bool `json:"spare_3"` } func (p *VisionTurnSignalsCommandLights) MarshalByte() byte { @@ -2737,6 +2789,7 @@ func (p *VisionTurnSignalsCommandLights) UnmarshalByte(b byte) { p.Spare3 = (b & (1 << 4)) != 0 } + // VisionTurnSignalsCommand is Command to have the vision board illuminate or turn off left, right, or both turn signals type VisionTurnSignalsCommand struct { Lights VisionTurnSignalsCommandLights `json:"lights"` @@ -2772,11 +2825,12 @@ func (p *VisionTurnSignalsCommand) String() string { return "vision_turn_signals_command" } + type VisionBrakeLightsCommandLights struct { BrakeLights bool `json:"brake_lights"` - Spare1 bool `json:"spare_1"` - Spare2 bool `json:"spare_2"` - Spare3 bool `json:"spare_3"` + Spare1 bool `json:"spare_1"` + Spare2 bool `json:"spare_2"` + Spare3 bool `json:"spare_3"` } func (p *VisionBrakeLightsCommandLights) MarshalByte() byte { @@ -2803,6 +2857,7 @@ func (p *VisionBrakeLightsCommandLights) UnmarshalByte(b byte) { p.Spare3 = (b & (1 << 3)) != 0 } + // VisionBrakeLightsCommand is Command to have the vision board illuminate or turn off the brake lights type VisionBrakeLightsCommand struct { Lights VisionBrakeLightsCommandLights `json:"lights"` @@ -2838,12 +2893,13 @@ func (p *VisionBrakeLightsCommand) String() string { return "vision_brake_lights_command" } + type VisionHeadlightsCommandLights struct { Headlights bool `json:"headlights"` - HighBeams bool `json:"high_beams"` - Spare1 bool `json:"spare_1"` - Spare2 bool `json:"spare_2"` - Spare3 bool `json:"spare_3"` + HighBeams bool `json:"high_beams"` + Spare1 bool `json:"spare_1"` + Spare2 bool `json:"spare_2"` + Spare3 bool `json:"spare_3"` } func (p *VisionHeadlightsCommandLights) MarshalByte() byte { @@ -2874,10 +2930,11 @@ func (p *VisionHeadlightsCommandLights) UnmarshalByte(b byte) { p.Spare3 = (b & (1 << 4)) != 0 } + // VisionHeadlightsCommand is Command to have the vision board illuminate or turn off the headlights and high beams type VisionHeadlightsCommand struct { - Lights VisionHeadlightsCommandLights `json:"lights"` - Brightness float32 `json:"brightness"` + Lights VisionHeadlightsCommandLights `json:"lights"` + Brightness float32 `json:"brightness"` } func (p *VisionHeadlightsCommand) CanId() (can.CanID, error) { @@ -2912,8 +2969,9 @@ func (p *VisionHeadlightsCommand) String() string { return "vision_headlights_command" } + type VisionHornCommandHorn struct { - Horn bool `json:"horn"` + Horn bool `json:"horn"` Spare bool `json:"spare"` } @@ -2933,6 +2991,7 @@ func (p *VisionHornCommandHorn) UnmarshalByte(b byte) { p.Spare = (b & (1 << 1)) != 0 } + // VisionHornCommand is Command the vision board honk the horn, must be repeatedly sent otherwise the vision board will stop honking after a bit. See high_power.h for details. type VisionHornCommand struct { Horn VisionHornCommandHorn `json:"horn"` @@ -2968,9 +3027,10 @@ func (p *VisionHornCommand) String() string { return "vision_horn_command" } + type VisionArrayLatchesCommandArrayLatches struct { ArrayFront bool `json:"array_front"` - ArrayRear bool `json:"array_rear"` + ArrayRear bool `json:"array_rear"` } func (p *VisionArrayLatchesCommandArrayLatches) MarshalByte() byte { @@ -2989,6 +3049,7 @@ func (p *VisionArrayLatchesCommandArrayLatches) UnmarshalByte(b byte) { p.ArrayRear = (b & (1 << 1)) != 0 } + // VisionArrayLatchesCommand is Command the vision board to open the array latches type VisionArrayLatchesCommand struct { ArrayLatches VisionArrayLatchesCommandArrayLatches `json:"array_latches"` @@ -3024,10 +3085,11 @@ func (p *VisionArrayLatchesCommand) String() string { return "vision_array_latches_command" } + type VisionRearviewCommandCameras struct { - Left bool `json:"left"` + Left bool `json:"left"` Right bool `json:"right"` - Rear bool `json:"rear"` + Rear bool `json:"rear"` } func (p *VisionRearviewCommandCameras) MarshalByte() byte { @@ -3050,6 +3112,7 @@ func (p *VisionRearviewCommandCameras) UnmarshalByte(b byte) { p.Rear = (b & (1 << 2)) != 0 } + // VisionRearviewCommand is Command the vision board turn on the rear view cameras type VisionRearviewCommand struct { Cameras VisionRearviewCommandCameras `json:"cameras"` @@ -3085,6 +3148,8 @@ func (p *VisionRearviewCommand) String() string { return "vision_rearview_command" } + + // TrackerEnable is Enables/disables power trackers. Use 0x610 for the channel transmitting the data packet on 0x600, 0x611 for 0x601, et cetera. Sending 1 in the enable byte turns the tracker on; sending 0 turns it off. type TrackerEnable struct { Enable uint8 `json:"enable"` @@ -3095,7 +3160,7 @@ type TrackerEnable struct { func (p *TrackerEnable) CanId() (can.CanID, error) { c := can.CanID{Extended: false} if p.Idx >= 6 { - return c, &UnknownIdError{0x610} + return c, &UnknownIdError{ 0x610 } } c.Id = 0x610 + p.Idx return c, nil @@ -3125,6 +3190,8 @@ func (p *TrackerEnable) String() string { return "tracker_enable" } + + // DistanceTraveled is distance of wavesculptor odometer type DistanceTraveled struct { // 0 m @@ -3161,6 +3228,7 @@ func (p *DistanceTraveled) String() string { return "distance_traveled" } + type ChargerStateStateFlags struct { ChargerPlugged bool `json:"charger_plugged"` } @@ -3178,14 +3246,14 @@ func (p *ChargerStateStateFlags) UnmarshalByte(b byte) { } type ChargerStateFault struct { - CHARGEROVERVOLT bool `json:"CHARGER_OVERVOLT"` - CHARGEROVERTEMP bool `json:"CHARGER_OVERTEMP"` - CHARGERCANTIMEOUT bool `json:"CHARGER_CAN_TIMEOUT"` - BATTERYHVKILL bool `json:"BATTERY_HV_KILL"` - BATTERYUNDERVOLT bool `json:"BATTERY_UNDERVOLT"` - BATTERYOVERVOLT bool `json:"BATTERY_OVERVOLT"` + CHARGEROVERVOLT bool `json:"CHARGER_OVERVOLT"` + CHARGEROVERTEMP bool `json:"CHARGER_OVERTEMP"` + CHARGERCANTIMEOUT bool `json:"CHARGER_CAN_TIMEOUT"` + BATTERYHVKILL bool `json:"BATTERY_HV_KILL"` + BATTERYUNDERVOLT bool `json:"BATTERY_UNDERVOLT"` + BATTERYOVERVOLT bool `json:"BATTERY_OVERVOLT"` BATTERYCELLOVERTEMP bool `json:"BATTERY_CELL_OVERTEMP"` - BATTERYCANTIMEOUT bool `json:"BATTERY_CAN_TIMEOUT"` + BATTERYCANTIMEOUT bool `json:"BATTERY_CAN_TIMEOUT"` } func (p *ChargerStateFault) MarshalByte() byte { @@ -3228,12 +3296,13 @@ func (p *ChargerStateFault) UnmarshalByte(b byte) { p.BATTERYCANTIMEOUT = (b & (1 << 7)) != 0 } + // ChargerState is Notifies whether the J1772 cable is plugged. type ChargerState struct { StateFlags ChargerStateStateFlags `json:"state_flags"` // 0.001 C - ChargerMaxTemp uint16 `json:"charger_max_temp"` - Fault ChargerStateFault `json:"fault"` + ChargerMaxTemp uint16 `json:"charger_max_temp"` + Fault ChargerStateFault `json:"fault"` // 0 A ChargingCurrent float32 `json:"charging_current"` } @@ -3274,6 +3343,7 @@ func (p *ChargerState) String() string { return "charger_state" } + type ChargerBmsRequestRequestFlags struct { ChargingRequested bool `json:"charging_requested"` } @@ -3290,6 +3360,7 @@ func (p *ChargerBmsRequestRequestFlags) UnmarshalByte(b byte) { p.ChargingRequested = (b & (1 << 0)) != 0 } + // ChargerBmsRequest is Request packet for sending contactor commands from the charger to BP. type ChargerBmsRequest struct { RequestFlags ChargerBmsRequestRequestFlags `json:"request_flags"` @@ -3325,6 +3396,8 @@ func (p *ChargerBmsRequest) String() string { return "charger_bms_request" } + + // ChargerCurrentVoltage is Packet to request charging current/voltage set type ChargerCurrentVoltage struct { // 0 A @@ -3365,6 +3438,8 @@ func (p *ChargerCurrentVoltage) String() string { return "charger_current_voltage" } + + // ChargerPower is Outputs the amount of power that the chargers are delivering. type ChargerPower struct { // 0 W @@ -3401,6 +3476,8 @@ func (p *ChargerPower) String() string { return "charger_power" } + + // ThunderstruckControlMessage is Control packet for thunderstruck chargers type ThunderstruckControlMessage struct { // 1 V @@ -3453,15 +3530,16 @@ func (p *ThunderstruckControlMessage) String() string { return "thunderstruck_control_message" } + type VisionStatusFrontLights struct { - LeftTurnSignal bool `json:"left_turn_signal"` + LeftTurnSignal bool `json:"left_turn_signal"` RightTurnSignal bool `json:"right_turn_signal"` - BrakeLights bool `json:"brake_lights"` - Headlights bool `json:"headlights"` - HighBeams bool `json:"high_beams"` - Spare1 bool `json:"spare_1"` - Spare2 bool `json:"spare_2"` - Spare3 bool `json:"spare_3"` + BrakeLights bool `json:"brake_lights"` + Headlights bool `json:"headlights"` + HighBeams bool `json:"high_beams"` + Spare1 bool `json:"spare_1"` + Spare2 bool `json:"spare_2"` + Spare3 bool `json:"spare_3"` } func (p *VisionStatusFrontLights) MarshalByte() byte { @@ -3505,7 +3583,7 @@ func (p *VisionStatusFrontLights) UnmarshalByte(b byte) { } type VisionStatusFrontHorn struct { - Horn bool `json:"horn"` + Horn bool `json:"horn"` Spare bool `json:"spare"` } @@ -3526,9 +3604,9 @@ func (p *VisionStatusFrontHorn) UnmarshalByte(b byte) { } type VisionStatusFrontCameras struct { - Left bool `json:"left"` + Left bool `json:"left"` Right bool `json:"right"` - Rear bool `json:"rear"` + Rear bool `json:"rear"` } func (p *VisionStatusFrontCameras) MarshalByte() byte { @@ -3554,8 +3632,8 @@ func (p *VisionStatusFrontCameras) UnmarshalByte(b byte) { type VisionStatusFrontArrayLatches struct { ArrayFront0 bool `json:"array_front_0"` ArrayFront1 bool `json:"array_front_1"` - ArrayRear0 bool `json:"array_rear_0"` - ArrayRear1 bool `json:"array_rear_1"` + ArrayRear0 bool `json:"array_rear_0"` + ArrayRear1 bool `json:"array_rear_1"` } func (p *VisionStatusFrontArrayLatches) MarshalByte() byte { @@ -3582,11 +3660,12 @@ func (p *VisionStatusFrontArrayLatches) UnmarshalByte(b byte) { p.ArrayRear1 = (b & (1 << 3)) != 0 } + // VisionStatusFront is Status of the front vision board outputs type VisionStatusFront struct { - Lights VisionStatusFrontLights `json:"lights"` - Horn VisionStatusFrontHorn `json:"horn"` - Cameras VisionStatusFrontCameras `json:"cameras"` + Lights VisionStatusFrontLights `json:"lights"` + Horn VisionStatusFrontHorn `json:"horn"` + Cameras VisionStatusFrontCameras `json:"cameras"` ArrayLatches VisionStatusFrontArrayLatches `json:"array_latches"` } @@ -3626,15 +3705,16 @@ func (p *VisionStatusFront) String() string { return "vision_status_front" } + type VisionStatusRearLights struct { - LeftTurnSignal bool `json:"left_turn_signal"` + LeftTurnSignal bool `json:"left_turn_signal"` RightTurnSignal bool `json:"right_turn_signal"` - BrakeLights bool `json:"brake_lights"` - Headlights bool `json:"headlights"` - HighBeams bool `json:"high_beams"` - Spare1 bool `json:"spare_1"` - Spare2 bool `json:"spare_2"` - Spare3 bool `json:"spare_3"` + BrakeLights bool `json:"brake_lights"` + Headlights bool `json:"headlights"` + HighBeams bool `json:"high_beams"` + Spare1 bool `json:"spare_1"` + Spare2 bool `json:"spare_2"` + Spare3 bool `json:"spare_3"` } func (p *VisionStatusRearLights) MarshalByte() byte { @@ -3678,7 +3758,7 @@ func (p *VisionStatusRearLights) UnmarshalByte(b byte) { } type VisionStatusRearHorn struct { - Horn bool `json:"horn"` + Horn bool `json:"horn"` Spare bool `json:"spare"` } @@ -3699,9 +3779,9 @@ func (p *VisionStatusRearHorn) UnmarshalByte(b byte) { } type VisionStatusRearCameras struct { - Left bool `json:"left"` + Left bool `json:"left"` Right bool `json:"right"` - Rear bool `json:"rear"` + Rear bool `json:"rear"` } func (p *VisionStatusRearCameras) MarshalByte() byte { @@ -3727,8 +3807,8 @@ func (p *VisionStatusRearCameras) UnmarshalByte(b byte) { type VisionStatusRearArrayLatches struct { ArrayFront0 bool `json:"array_front_0"` ArrayFront1 bool `json:"array_front_1"` - ArrayRear0 bool `json:"array_rear_0"` - ArrayRear1 bool `json:"array_rear_1"` + ArrayRear0 bool `json:"array_rear_0"` + ArrayRear1 bool `json:"array_rear_1"` } func (p *VisionStatusRearArrayLatches) MarshalByte() byte { @@ -3755,11 +3835,12 @@ func (p *VisionStatusRearArrayLatches) UnmarshalByte(b byte) { p.ArrayRear1 = (b & (1 << 3)) != 0 } + // VisionStatusRear is Status of the rear vision board outputs type VisionStatusRear struct { - Lights VisionStatusRearLights `json:"lights"` - Horn VisionStatusRearHorn `json:"horn"` - Cameras VisionStatusRearCameras `json:"cameras"` + Lights VisionStatusRearLights `json:"lights"` + Horn VisionStatusRearHorn `json:"horn"` + Cameras VisionStatusRearCameras `json:"cameras"` ArrayLatches VisionStatusRearArrayLatches `json:"array_latches"` } @@ -3799,6 +3880,8 @@ func (p *VisionStatusRear) String() string { return "vision_status_rear" } + + // LightsFrontId is Unique identification packet for front lights board type LightsFrontId struct { BoardId uint16 `json:"board_id"` @@ -3806,7 +3889,7 @@ type LightsFrontId struct { McuTemp int16 `json:"mcu_temp"` // 0.001 V BusVoltage uint16 `json:"bus_voltage"` - FaultCode uint16 `json:"fault_code"` + FaultCode uint16 `json:"fault_code"` } func (p *LightsFrontId) CanId() (can.CanID, error) { @@ -3845,6 +3928,8 @@ func (p *LightsFrontId) String() string { return "lights_front_id" } + + // LightsBackId is Unique identification packet for back lights board type LightsBackId struct { BoardId uint16 `json:"board_id"` @@ -3852,7 +3937,7 @@ type LightsBackId struct { McuTemp int16 `json:"mcu_temp"` // 0.001 V BusVoltage uint16 `json:"bus_voltage"` - FaultCode uint16 `json:"fault_code"` + FaultCode uint16 `json:"fault_code"` } func (p *LightsBackId) CanId() (can.CanID, error) { @@ -3891,6 +3976,8 @@ func (p *LightsBackId) String() string { return "lights_back_id" } + + // VisionId is Unique identification packet for vision type VisionId struct { BoardId uint16 `json:"board_id"` @@ -3898,7 +3985,7 @@ type VisionId struct { McuTemp int16 `json:"mcu_temp"` // 0.001 V BusVoltage uint16 `json:"bus_voltage"` - FaultCode uint16 `json:"fault_code"` + FaultCode uint16 `json:"fault_code"` } func (p *VisionId) CanId() (can.CanID, error) { @@ -3937,6 +4024,8 @@ func (p *VisionId) String() string { return "vision_id" } + + // SteeringPressCount1 is Shows whether each button has been toggled an even ("on") or odd ("off") number of times. type SteeringPressCount1 struct { Button0 uint8 `json:"button0"` @@ -3990,11 +4079,13 @@ func (p *SteeringPressCount1) String() string { return "steering_press_count_1" } + + // SteeringPressCount2 is Shows whether each button has been toggled an even ("on") or odd ("off") number of times. type SteeringPressCount2 struct { - Button7 uint8 `json:"button7"` - Button8 uint8 `json:"button8"` - Button9 uint8 `json:"button9"` + Button7 uint8 `json:"button7"` + Button8 uint8 `json:"button8"` + Button9 uint8 `json:"button9"` Button10 uint8 `json:"button10"` } @@ -4034,6 +4125,8 @@ func (p *SteeringPressCount2) String() string { return "steering_press_count_2" } + + // SteeringButtonColors1 is This packet controls each button's color. Each byte is a hex color code. type SteeringButtonColors1 struct { Button0 uint8 `json:"button0"` @@ -4087,11 +4180,13 @@ func (p *SteeringButtonColors1) String() string { return "steering_button_colors_1" } + + // SteeringButtonColors2 is This packet controls each button's color. Each byte is a hex color code. type SteeringButtonColors2 struct { - Button7 uint8 `json:"button7"` - Button8 uint8 `json:"button8"` - Button9 uint8 `json:"button9"` + Button7 uint8 `json:"button7"` + Button8 uint8 `json:"button8"` + Button9 uint8 `json:"button9"` Button10 uint8 `json:"button10"` } @@ -4131,6 +4226,8 @@ func (p *SteeringButtonColors2) String() string { return "steering_button_colors_2" } + + // SteeringHorn is This packet controls the state of the horn. type SteeringHorn struct { Horn uint8 `json:"horn"` @@ -4166,6 +4263,8 @@ func (p *SteeringHorn) String() string { return "steering_horn" } + + // ThunderstruckStatusMessage is Status packet for thunderstruck chargers type ThunderstruckStatusMessage struct { // 1 V @@ -4183,7 +4282,7 @@ type ThunderstruckStatusMessage struct { } func (p *ThunderstruckStatusMessage) CanId() (can.CanID, error) { - c := can.CanID{Extended: true} + c := can.CanID{Extended: false} c.Id = 0x18EB2440 return c, nil } @@ -4222,6 +4321,8 @@ func (p *ThunderstruckStatusMessage) String() string { return "thunderstruck_status_message" } + + // TrackerData is Tracker data. Each channel transmits on a specific ID, which should be specified along with the tracker, most likely 0x600-0x603. type TrackerData struct { // 0.01 V @@ -4239,7 +4340,7 @@ type TrackerData struct { func (p *TrackerData) CanId() (can.CanID, error) { c := can.CanID{Extended: false} if p.Idx >= 6 { - return c, &UnknownIdError{0x600} + return c, &UnknownIdError{ 0x600 } } c.Id = 0x600 + p.Idx return c, nil @@ -4275,10 +4376,12 @@ func (p *TrackerData) String() string { return "tracker_data" } + + // TritiumMotorDriveL is Tritium Motor Drive Command type TritiumMotorDriveL struct { MotorVelocity float32 `json:"motor_velocity"` - MotorCurrent float32 `json:"motor_current"` + MotorCurrent float32 `json:"motor_current"` } func (p *TritiumMotorDriveL) CanId() (can.CanID, error) { @@ -4313,9 +4416,11 @@ func (p *TritiumMotorDriveL) String() string { return "tritium_motor_drive_l" } + + // TritiumMotorPowerL is Tritium Motor Power Command type TritiumMotorPowerL struct { - Reserved float32 `json:"reserved"` + Reserved float32 `json:"reserved"` BusCurrent float32 `json:"bus_current"` } @@ -4351,6 +4456,8 @@ func (p *TritiumMotorPowerL) String() string { return "tritium_motor_power_l" } + + // TritiumResetL is Tritium Reset Command type TritiumResetL struct { Unused1 float32 `json:"unused1"` @@ -4389,10 +4496,12 @@ func (p *TritiumResetL) String() string { return "tritium_reset_l" } + + // TritiumMotorDriveR is Tritium Motor Drive Command type TritiumMotorDriveR struct { MotorVelocity float32 `json:"motor_velocity"` - MotorCurrent float32 `json:"motor_current"` + MotorCurrent float32 `json:"motor_current"` } func (p *TritiumMotorDriveR) CanId() (can.CanID, error) { @@ -4427,9 +4536,11 @@ func (p *TritiumMotorDriveR) String() string { return "tritium_motor_drive_r" } + + // TritiumMotorPowerR is Tritium Motor Power Command type TritiumMotorPowerR struct { - Reserved float32 `json:"reserved"` + Reserved float32 `json:"reserved"` BusCurrent float32 `json:"bus_current"` } @@ -4465,6 +4576,8 @@ func (p *TritiumMotorPowerR) String() string { return "tritium_motor_power_r" } + + // TritiumResetR is Tritium Reset Command type TritiumResetR struct { Unused1 float32 `json:"unused1"` @@ -4503,6 +4616,8 @@ func (p *TritiumResetR) String() string { return "tritium_reset_r" } + + // BmsAhSet is write state of charge, use with caution type BmsAhSet struct { Ah uint32 `json:"ah"` @@ -4538,6 +4653,8 @@ func (p *BmsAhSet) String() string { return "bms_ah_set" } + + // BmsWhSet is write state of charge, use with caution type BmsWhSet struct { Wh uint32 `json:"wh"` @@ -4573,6 +4690,7 @@ func (p *BmsWhSet) String() string { return "bms_wh_set" } + type BmsKillKillType struct { KILLHARD bool `json:"KILL_HARD"` } @@ -4589,6 +4707,7 @@ func (p *BmsKillKillType) UnmarshalByte(b byte) { p.KILLHARD = (b & (1 << 0)) != 0 } + // BmsKill is packet to cause BMS kill type BmsKill struct { KillType BmsKillKillType `json:"kill_type"` @@ -4624,12 +4743,14 @@ func (p *BmsKill) String() string { return "bms_kill" } + + // TelemetryRtcReset is Reset telemetry's real-time clock (RTC). type TelemetryRtcReset struct { - Year uint8 `json:"year"` - Month uint8 `json:"month"` - Day uint8 `json:"day"` - Hour uint8 `json:"hour"` + Year uint8 `json:"year"` + Month uint8 `json:"month"` + Day uint8 `json:"day"` + Hour uint8 `json:"hour"` Minute uint8 `json:"minute"` Second uint8 `json:"second"` } @@ -4674,9 +4795,11 @@ func (p *TelemetryRtcReset) String() string { return "telemetry_rtc_reset" } + + // WsrIdentification is WS RIGHT Identification Information type WsrIdentification struct { - TritiumId uint32 `json:"tritium_id"` + TritiumId uint32 `json:"tritium_id"` SerialNumber uint32 `json:"serial_number"` } @@ -4712,15 +4835,16 @@ func (p *WsrIdentification) String() string { return "wsr_identification" } + type WsrStatusInformationLimitFlags struct { - OutputVoltagePwm bool `json:"output_voltage_pwm"` - MotorCurrent bool `json:"motor_current"` - Velocity bool `json:"velocity"` - BusCurrent bool `json:"bus_current"` - BusVoltageUpperLimit bool `json:"bus_voltage_upper_limit"` - BusVoltageLowerLimit bool `json:"bus_voltage_lower_limit"` + OutputVoltagePwm bool `json:"output_voltage_pwm"` + MotorCurrent bool `json:"motor_current"` + Velocity bool `json:"velocity"` + BusCurrent bool `json:"bus_current"` + BusVoltageUpperLimit bool `json:"bus_voltage_upper_limit"` + BusVoltageLowerLimit bool `json:"bus_voltage_lower_limit"` IpmTemperatureOrMotorTemperature bool `json:"ipm_temperature_or_motor_temperature"` - Reserved bool `json:"reserved"` + Reserved bool `json:"reserved"` } func (p *WsrStatusInformationLimitFlags) MarshalByte() byte { @@ -4764,14 +4888,14 @@ func (p *WsrStatusInformationLimitFlags) UnmarshalByte(b byte) { } type WsrStatusInformationErrorFlags0 struct { - HardwareOverCurrent bool `json:"hardware_over_current"` - SoftwareOverCurrent bool `json:"software_over_current"` - DcBusOverVoltage bool `json:"dc_bus_over_voltage"` + HardwareOverCurrent bool `json:"hardware_over_current"` + SoftwareOverCurrent bool `json:"software_over_current"` + DcBusOverVoltage bool `json:"dc_bus_over_voltage"` BadMotorPositionHallSequence bool `json:"bad_motor_position_hall_sequence"` - WatchdogCausedLastReset bool `json:"watchdog_caused_last_reset"` - ConfigReadError bool `json:"config_read_error"` - LvRailUnderVoltageLockOut bool `json:"lv_rail_under_voltage_lock_out"` - DesaturationFault bool `json:"desaturation_fault"` + WatchdogCausedLastReset bool `json:"watchdog_caused_last_reset"` + ConfigReadError bool `json:"config_read_error"` + LvRailUnderVoltageLockOut bool `json:"lv_rail_under_voltage_lock_out"` + DesaturationFault bool `json:"desaturation_fault"` } func (p *WsrStatusInformationErrorFlags0) MarshalByte() byte { @@ -4816,13 +4940,13 @@ func (p *WsrStatusInformationErrorFlags0) UnmarshalByte(b byte) { type WsrStatusInformationErrorFlags1 struct { MotorOverSpeed bool `json:"motor_over_speed"` - Reserved9 bool `json:"reserved_9"` - Reserved10 bool `json:"reserved_10"` - Reserved11 bool `json:"reserved_11"` - Reserved12 bool `json:"reserved_12"` - Reserved13 bool `json:"reserved_13"` - Reserved14 bool `json:"reserved_14"` - Reserved15 bool `json:"reserved_15"` + Reserved9 bool `json:"reserved_9"` + Reserved10 bool `json:"reserved_10"` + Reserved11 bool `json:"reserved_11"` + Reserved12 bool `json:"reserved_12"` + Reserved13 bool `json:"reserved_13"` + Reserved14 bool `json:"reserved_14"` + Reserved15 bool `json:"reserved_15"` } func (p *WsrStatusInformationErrorFlags1) MarshalByte() byte { @@ -4865,14 +4989,15 @@ func (p *WsrStatusInformationErrorFlags1) UnmarshalByte(b byte) { p.Reserved15 = (b & (1 << 7)) != 0 } + // WsrStatusInformation is WS RIGHT Status Information type WsrStatusInformation struct { - LimitFlags WsrStatusInformationLimitFlags `json:"limit_flags"` - LimitFlagsReserved uint8 `json:"limit_flags_reserved"` - ErrorFlags0 WsrStatusInformationErrorFlags0 `json:"error_flags_0"` - ErrorFlags1 WsrStatusInformationErrorFlags1 `json:"error_flags_1"` - ActiveMotor uint16 `json:"active_motor"` - Reserved uint16 `json:"reserved"` + LimitFlags WsrStatusInformationLimitFlags `json:"limit_flags"` + LimitFlagsReserved uint8 `json:"limit_flags_reserved"` + ErrorFlags0 WsrStatusInformationErrorFlags0 `json:"error_flags_0"` + ErrorFlags1 WsrStatusInformationErrorFlags1 `json:"error_flags_1"` + ActiveMotor uint16 `json:"active_motor"` + Reserved uint16 `json:"reserved"` } func (p *WsrStatusInformation) CanId() (can.CanID, error) { @@ -4915,6 +5040,8 @@ func (p *WsrStatusInformation) String() string { return "wsr_status_information" } + + // WsrBusMeasurement is WS RIGHT Bus Measurement type WsrBusMeasurement struct { // 0 V @@ -4955,6 +5082,8 @@ func (p *WsrBusMeasurement) String() string { return "wsr_bus_measurement" } + + // WsrVelocity is WS RIGHT Velocity Measurement type WsrVelocity struct { // 0 rpm @@ -4995,6 +5124,8 @@ func (p *WsrVelocity) String() string { return "wsr_velocity" } + + // WsrPhaseCurrent is WS RIGHT Phase Current Measurement type WsrPhaseCurrent struct { // 0 A rms @@ -5035,6 +5166,8 @@ func (p *WsrPhaseCurrent) String() string { return "wsr_phase_current" } + + // WsrMotorVoltageVector is WS RIGHT Motor Voltage Vector Measurement type WsrMotorVoltageVector struct { // 0 V @@ -5075,6 +5208,8 @@ func (p *WsrMotorVoltageVector) String() string { return "wsr_motor_voltage_vector" } + + // WsrMotorCurrentVector is WS RIGHT Motor Current Vector Measurement type WsrMotorCurrentVector struct { // 0 A @@ -5115,6 +5250,8 @@ func (p *WsrMotorCurrentVector) String() string { return "wsr_motor_current_vector" } + + // WsrMotorBackemf is WS RIGHT Motor BackEMF Measurement / Prediction type WsrMotorBackemf struct { // 0 V @@ -5155,6 +5292,8 @@ func (p *WsrMotorBackemf) String() string { return "wsr_motor_backemf" } + + // Wsr15165VoltageRail is WS RIGHT 15 and 1.65 Voltage Rail Measurement type Wsr15165VoltageRail struct { // 0 V @@ -5195,6 +5334,8 @@ func (p *Wsr15165VoltageRail) String() string { return "wsr_15_165_voltage_rail" } + + // Wsr2512VoltageRail is WS RIGHT 2.5V and 1.2V Voltage Rail Measurement type Wsr2512VoltageRail struct { // 0 V @@ -5235,6 +5376,8 @@ func (p *Wsr2512VoltageRail) String() string { return "wsr_25_12_voltage_rail" } + + // WsrHeatsinkMotorTemp is WS RIGHT Heat-sink & Motor Temperature Measurement type WsrHeatsinkMotorTemp struct { // 0 C @@ -5275,6 +5418,8 @@ func (p *WsrHeatsinkMotorTemp) String() string { return "wsr_heatsink_motor_temp" } + + // WsrDspBoardTemp is WS RIGHT DPS Board Temperature Measurement type WsrDspBoardTemp struct { // 0 C @@ -5315,6 +5460,8 @@ func (p *WsrDspBoardTemp) String() string { return "wsr_dsp_board_temp" } + + // WsrReserved is WS RIGHT Reserved type WsrReserved struct { Reserved0 float32 `json:"reserved0"` @@ -5353,6 +5500,8 @@ func (p *WsrReserved) String() string { return "wsr_reserved" } + + // WsrOdometerBusAmphoursMeasurement is WS RIGHT Odometer and Bus AmpHours Measurement type WsrOdometerBusAmphoursMeasurement struct { // 0 m @@ -5393,6 +5542,8 @@ func (p *WsrOdometerBusAmphoursMeasurement) String() string { return "wsr_odometer_bus_amphours_measurement" } + + // WsrSlipSpeedMeasurement is WS RIGHT Slip Speed Measurement type WsrSlipSpeedMeasurement struct { // 0 C @@ -5433,9 +5584,11 @@ func (p *WsrSlipSpeedMeasurement) String() string { return "wsr_slip_speed_measurement" } + + // WslIdentification is WS LEFT Identification Information type WslIdentification struct { - TritiumId uint32 `json:"tritium_id"` + TritiumId uint32 `json:"tritium_id"` SerialNumber uint32 `json:"serial_number"` } @@ -5471,15 +5624,16 @@ func (p *WslIdentification) String() string { return "wsl_identification" } + type WslStatusInformationLimitFlags struct { - OutputVoltagePwm bool `json:"output_voltage_pwm"` - MotorCurrent bool `json:"motor_current"` - Velocity bool `json:"velocity"` - BusCurrent bool `json:"bus_current"` - BusVoltageUpperLimit bool `json:"bus_voltage_upper_limit"` - BusVoltageLowerLimit bool `json:"bus_voltage_lower_limit"` + OutputVoltagePwm bool `json:"output_voltage_pwm"` + MotorCurrent bool `json:"motor_current"` + Velocity bool `json:"velocity"` + BusCurrent bool `json:"bus_current"` + BusVoltageUpperLimit bool `json:"bus_voltage_upper_limit"` + BusVoltageLowerLimit bool `json:"bus_voltage_lower_limit"` IpmTemperatureOrMotorTemperature bool `json:"ipm_temperature_or_motor_temperature"` - Reserved bool `json:"reserved"` + Reserved bool `json:"reserved"` } func (p *WslStatusInformationLimitFlags) MarshalByte() byte { @@ -5523,14 +5677,14 @@ func (p *WslStatusInformationLimitFlags) UnmarshalByte(b byte) { } type WslStatusInformationErrorFlags0 struct { - HardwareOverCurrent bool `json:"hardware_over_current"` - SoftwareOverCurrent bool `json:"software_over_current"` - DcBusOverVoltage bool `json:"dc_bus_over_voltage"` + HardwareOverCurrent bool `json:"hardware_over_current"` + SoftwareOverCurrent bool `json:"software_over_current"` + DcBusOverVoltage bool `json:"dc_bus_over_voltage"` BadMotorPositionHallSequence bool `json:"bad_motor_position_hall_sequence"` - WatchdogCausedLastReset bool `json:"watchdog_caused_last_reset"` - ConfigReadError bool `json:"config_read_error"` - LvRailUnderVoltageLockOut bool `json:"lv_rail_under_voltage_lock_out"` - DesaturationFault bool `json:"desaturation_fault"` + WatchdogCausedLastReset bool `json:"watchdog_caused_last_reset"` + ConfigReadError bool `json:"config_read_error"` + LvRailUnderVoltageLockOut bool `json:"lv_rail_under_voltage_lock_out"` + DesaturationFault bool `json:"desaturation_fault"` } func (p *WslStatusInformationErrorFlags0) MarshalByte() byte { @@ -5575,13 +5729,13 @@ func (p *WslStatusInformationErrorFlags0) UnmarshalByte(b byte) { type WslStatusInformationErrorFlags1 struct { MotorOverSpeed bool `json:"motor_over_speed"` - Reserved9 bool `json:"reserved_9"` - Reserved10 bool `json:"reserved_10"` - Reserved11 bool `json:"reserved_11"` - Reserved12 bool `json:"reserved_12"` - Reserved13 bool `json:"reserved_13"` - Reserved14 bool `json:"reserved_14"` - Reserved15 bool `json:"reserved_15"` + Reserved9 bool `json:"reserved_9"` + Reserved10 bool `json:"reserved_10"` + Reserved11 bool `json:"reserved_11"` + Reserved12 bool `json:"reserved_12"` + Reserved13 bool `json:"reserved_13"` + Reserved14 bool `json:"reserved_14"` + Reserved15 bool `json:"reserved_15"` } func (p *WslStatusInformationErrorFlags1) MarshalByte() byte { @@ -5624,14 +5778,15 @@ func (p *WslStatusInformationErrorFlags1) UnmarshalByte(b byte) { p.Reserved15 = (b & (1 << 7)) != 0 } + // WslStatusInformation is WS LEFT Status Information type WslStatusInformation struct { - LimitFlags WslStatusInformationLimitFlags `json:"limit_flags"` - LimitFlagsReserved uint8 `json:"limit_flags_reserved"` - ErrorFlags0 WslStatusInformationErrorFlags0 `json:"error_flags_0"` - ErrorFlags1 WslStatusInformationErrorFlags1 `json:"error_flags_1"` - ActiveMotor uint16 `json:"active_motor"` - Reserved uint16 `json:"reserved"` + LimitFlags WslStatusInformationLimitFlags `json:"limit_flags"` + LimitFlagsReserved uint8 `json:"limit_flags_reserved"` + ErrorFlags0 WslStatusInformationErrorFlags0 `json:"error_flags_0"` + ErrorFlags1 WslStatusInformationErrorFlags1 `json:"error_flags_1"` + ActiveMotor uint16 `json:"active_motor"` + Reserved uint16 `json:"reserved"` } func (p *WslStatusInformation) CanId() (can.CanID, error) { @@ -5674,6 +5829,8 @@ func (p *WslStatusInformation) String() string { return "wsl_status_information" } + + // WslBusMeasurement is WS LEFT Bus Measurement type WslBusMeasurement struct { // 0 V @@ -5714,6 +5871,8 @@ func (p *WslBusMeasurement) String() string { return "wsl_bus_measurement" } + + // WslVelocity is WS LEFT Velocity Measurement type WslVelocity struct { // 0 rpm @@ -5754,6 +5913,8 @@ func (p *WslVelocity) String() string { return "wsl_velocity" } + + // WslPhaseCurrent is WS LEFT Phase Current Measurement type WslPhaseCurrent struct { // 0 A rms @@ -5794,6 +5955,8 @@ func (p *WslPhaseCurrent) String() string { return "wsl_phase_current" } + + // WslMotorVoltageVector is WS LEFT Motor Voltage Vector Measurement type WslMotorVoltageVector struct { // 0 V @@ -5834,6 +5997,8 @@ func (p *WslMotorVoltageVector) String() string { return "wsl_motor_voltage_vector" } + + // WslMotorCurrentVector is WS LEFT Motor Current Vector Measurement type WslMotorCurrentVector struct { // 0 A @@ -5874,6 +6039,8 @@ func (p *WslMotorCurrentVector) String() string { return "wsl_motor_current_vector" } + + // WslMotorBackemf is WS LEFT Motor BackEMF Measurement / Prediction type WslMotorBackemf struct { // 0 V @@ -5914,6 +6081,8 @@ func (p *WslMotorBackemf) String() string { return "wsl_motor_backemf" } + + // Wsl15165VoltageRail is WS LEFT 15 and 1.65 Voltage Rail Measurement type Wsl15165VoltageRail struct { // 0 V @@ -5954,6 +6123,8 @@ func (p *Wsl15165VoltageRail) String() string { return "wsl_15_165_voltage_rail" } + + // Wsl2512VoltageRail is WS LEFT 2.5V and 1.2V Voltage Rail Measurement type Wsl2512VoltageRail struct { // 0 V @@ -5994,6 +6165,8 @@ func (p *Wsl2512VoltageRail) String() string { return "wsl_25_12_voltage_rail" } + + // WslHeatsinkMotorTemp is WS LEFT Heat-sink & Motor Temperature Measurement type WslHeatsinkMotorTemp struct { // 0 C @@ -6034,6 +6207,8 @@ func (p *WslHeatsinkMotorTemp) String() string { return "wsl_heatsink_motor_temp" } + + // WslDspBoardTemp is WS LEFT DPS Board Temperature Measurement type WslDspBoardTemp struct { // 0 C @@ -6074,6 +6249,8 @@ func (p *WslDspBoardTemp) String() string { return "wsl_dsp_board_temp" } + + // WslOdometerBusAmphoursMeasurement is WS LEFT Odometer and Bus AmpHours Measurement type WslOdometerBusAmphoursMeasurement struct { // 0 m @@ -6114,6 +6291,8 @@ func (p *WslOdometerBusAmphoursMeasurement) String() string { return "wsl_odometer_bus_amphours_measurement" } + + // WslReserved is WS LEFT Reserved type WslReserved struct { Reserved0 float32 `json:"reserved0"` @@ -6152,6 +6331,8 @@ func (p *WslReserved) String() string { return "wsl_reserved" } + + // WslSlipSpeedMeasurement is WS LEFT Slip Speed Measurement type WslSlipSpeedMeasurement struct { // 0 C @@ -6192,6 +6373,8 @@ func (p *WslSlipSpeedMeasurement) String() string { return "wsl_slip_speed_measurement" } + + // The json representation that was used to generate this data. // can be used to share the parsing data for i.e dynamic python gui. -const SkylabDefinitions = `{"packets":[{"name":"bms_measurement","description":"Voltages for main battery and aux pack","id":16,"endian":"little","data":[{"name":"battery_voltage","type":"uint16_t","units":"V","conversion":0.01},{"name":"aux_voltage","type":"uint16_t","units":"V","conversion":0.001},{"name":"current","type":"float","units":"A","conversion":1}]},{"name":"battery_status","description":"Status bits for the battery","id":17,"endian":"little","data":[{"name":"battery_state","type":"bitfield","bits":[{"name":"startup"},{"name":"precharge"},{"name":"discharging"},{"name":"lv_only"},{"name":"charging"},{"name":"wall_charging"},{"name":"killed"}]},{"name":"contactor_state","type":"bitfield","bits":[{"name":"battery_high_contactor"},{"name":"battery_low_contactor"},{"name":"battery_vicor_contactor"},{"name":"battery_pre_contactor"},{"name":"battery_high2_contactor"},{"name":"battery_low2_contactor"},{"name":"charger_high_contactor"},{"name":"charger_pre_contactor"}]},{"name":"lv_channel_status","type":"bitfield","bits":[{"name":"aux_fault"},{"name":"main_fault"},{"name":"aux_power_valid"},{"name":"main_power_valid"},{"name":"aux_power_active"},{"name":"main_power_active"}]},{"name":"lv_control_status","type":"bitfield","bits":[{"name":"aux_vicor_enable"},{"name":"bat_vicor_enable"},{"name":"aux_relay_held"},{"name":"aux_ref_enable"},{"name":"aux_charging_enable"},{"name":"kill_hv"},{"name":"kill_lv"},{"name":"start_button"}]},{"name":"pack_choice","type":"bitfield","bits":[{"name":"large_pack"},{"name":"small_pack"}]}]},{"name":"bms_kill_reason","description":"Information for when the car kills","id":18,"endian":"little","data":[{"name":"reason1","type":"bitfield","bits":[{"name":"OVERVOLT"},{"name":"UNDERVOLT"},{"name":"OVERTEMP"},{"name":"TEMP_DISCONNECT"},{"name":"COMM_FAIL"}]},{"name":"reason2","type":"bitfield","bits":[{"name":"HARDWARE"},{"name":"KILL_PACKET"},{"name":"UKNOWN"},{"name":"OVERCURRENT"},{"name":"PRECHARGE_FAIL"},{"name":"AUX_OVER_UNDER"},{"name":"AUX_OVERTEMP"}]},{"name":"module","type":"uint16_t"},{"name":"value","type":"float"}]},{"name":"bms_module_min_max","description":"min and max cell voltages and temperatures","id":19,"endian":"little","data":[{"name":"module_max_temp","type":"int16_t","units":"C","conversion":0.01},{"name":"module_min_temp","type":"int16_t","units":"C","conversion":0.01},{"name":"module_max_voltage","type":"uint16_t","units":"V","conversion":0.001},{"name":"module_min_voltage","type":"uint16_t","units":"V","conversion":0.001}]},{"name":"bms_soc","description":"State of charge","id":20,"endian":"little","data":[{"name":"soc","type":"float","conversion":1}]},{"name":"bms_capacity","description":"State of charge","id":21,"endian":"little","data":[{"name":"Ah","type":"float","conversion":1},{"name":"Wh","type":"float","conversion":1}]},{"name":"bms_currentlimit","description":"reports BP params for current","id":24,"endian":"little","data":[{"name":"current_max","type":"int16_t","units":"A","conversion":0.01},{"name":"current_min","type":"int16_t","units":"A","conversion":0.01}]},{"name":"bms_fan_info","description":"BP Fans","id":25,"endian":"little","data":[{"name":"fan1","type":"uint16_t","units":"RPM","conversion":1},{"name":"fan2","type":"uint16_t","units":"RPM","conversion":1},{"name":"fan3","type":"uint16_t","units":"RPM","conversion":1},{"name":"fan4","type":"uint16_t","units":"RPM","conversion":1}]},{"name":"bms_set_min_fan_speed","description":"packet which sets a minimum fan speed of BMS for a specific time frame in seconds","id":27,"endian":"little","data":[{"name":"fan_percentage","type":"float","units":"percent"},{"name":"time","type":"uint16_t","units":"s"}]},{"name":"bms_module","description":"Voltage and temperature for a single module","id":64,"endian":"little","repeat":36,"offset":1,"data":[{"name":"voltage","type":"float","units":"V","conversion":1},{"name":"temperature","type":"float","units":"C","conversion":1}]},{"name":"bms_charger_response","description":"Response packet from BMS for indicating whether BMS is ready for charging","id":117,"endian":"little","data":[{"name":"response_flags","type":"bitfield","bits":[{"name":"charging_ready"}]}]},{"name":"chassis_isolation_fault","description":"chassiss is not isolated from the battery","id":56,"data":[{"name":"fault_detected","type":"bitfield","bits":[{"name":"isolation_fault"}]}]},{"name":"bms_imd_info","description":"information from chassis isolation","id":55,"data":[{"name":"d_imc_r_iso","type":"uint16_t"},{"name":"d_imc_status_1","type":"bitfield","bits":[{"name":"isolation_fault"},{"name":"chassis_fault"},{"name":"system_failure"},{"name":"calibration_running"},{"name":"self_test_running"},{"name":"isolation_warning"},{"name":"reserved"},{"name":"reserved_2"}]},{"name":"d_imc_status_2","type":"bitfield","bits":[{"name":"reserved"},{"name":"reserved_2"},{"name":"reserved_3"},{"name":"reserved_4"},{"name":"reserved_5"},{"name":"reserved_6"},{"name":"reserved_7"},{"name":"reserved_8"}]},{"name":"d_vifc_status_1","type":"bitfield","bits":[{"name":"insulation_measurment"},{"name":"imc_connectivity_not_implemented"},{"name":"imc_alive_satus_detection"},{"name":"reserved"},{"name":"vifc_command_not_implemented"},{"name":"reserved_2"},{"name":"reserved_3"},{"name":"reserved_4"}]},{"name":"d_vifc_status_2","type":"bitfield","bits":[{"name":"insulation_resistance_value"},{"name":"reserved"},{"name":"reserved_2"},{"name":"reserved_3"},{"name":"imc_self_test_overAll"},{"name":"imc_self_test_parameterConfig"},{"name":"reserved_4"},{"name":"reserved_5"}]}]},{"name":"dashboard_pedal_percentages","description":"ADC values from the brake and accelerator pedals.","id":656,"endian":"little","data":[{"name":"accel_pedal_value","type":"uint8_t"},{"name":"brake_pedal_value","type":"uint8_t"}]},{"name":"car_state","description":"Car gear. Forward, neutral, reverse, etc.","id":657,"endian":"little","data":[{"name":"state","type":"uint8_t"}]},{"name":"dashboard_pedal_fault","description":"Target speed that the driver should maintain.","id":658,"endian":"little","data":[{"name":"brake_fault_count","type":"uint8_t"},{"name":"accel_fault_count","type":"uint8_t"}]},{"name":"dashboard_system_timeout_test","description":"Exposes whether each system that dashboard is supposed to listen for packets from has sent a packet. Used for testing.","id":665,"endian":"little","data":[{"name":"flag_set_0","type":"bitfield","bits":[{"name":"steering_disconnected"},{"name":"vision_front_disconnected"},{"name":"vision_rear_disconnected"},{"name":"telemetry_disconnected"},{"name":"wsl_disconnected"},{"name":"wsr_disconnected"},{"name":"front_mppt_disconnected"},{"name":"rear_mppt_disconnected"}]}]},{"name":"car_speed","description":"speed of car in meters per second","id":666,"endian":"little","data":[{"name":"speed","type":"float"}]},{"name":"flight_computer_lv_board_disconnect_counts","description":"Number of times a board hasn't been heard from within the allowed timeout.","id":667,"endian":"little","data":[{"name":"front_lights","type":"uint8_t"},{"name":"rear_lights","type":"uint8_t"},{"name":"steering","type":"uint8_t"},{"name":"vision","type":"uint8_t"},{"name":"driver_display","type":"uint8_t"},{"name":"center_console","type":"uint8_t"}]},{"name":"flight_computer_hv_board_disconnect_counts","description":"Number of times a board hasn't been heard from within the allowed timeout.","id":668,"endian":"little","data":[{"name":"bms","type":"uint8_t"},{"name":"charger","type":"uint8_t"},{"name":"wsl","type":"uint8_t"},{"name":"wsr","type":"uint8_t"},{"name":"mppt_front","type":"uint8_t"},{"name":"mppt_rear","type":"uint8_t"}]},{"name":"flight_computer_internal_state","description":"internal bools","id":669,"endian":"little","data":[{"name":"bms","type":"bitfield","bits":[{"name":"battery_kill"},{"name":"cells_in_charging_threshold"},{"name":"first_packet_received"}]},{"name":"charger","type":"bitfield","bits":[{"name":"proximity_detected"}]},{"name":"photon3","type":"bitfield","bits":[{"name":"enable"}]},{"name":"wavesculptor","type":"bitfield","bits":[{"name":"sending_reset"},{"name":"regen_enable"}]},{"name":"internal","type":"bitfield","bits":[{"name":"accel_pedal_disconnect"},{"name":"brake_pedal_disconnect"}]}]},{"name":"power_to_drive","description":"calculated power required to drive the vehicle","id":414,"endian":"little","data":[{"name":"moving_average_100","type":"int16_t"},{"name":"moving_average_1k","type":"int16_t"},{"name":"moving_average_10k","type":"int16_t"}]},{"name":"array_power","description":"array power calculated from current and voltage measurements","id":415,"endian":"little","data":[{"name":"front_array_channel_0","type":"uint16_t"},{"name":"front_array_channel_1","type":"uint16_t"},{"name":"rear_array_channel_0","type":"uint16_t"},{"name":"rear_array_channel_1","type":"uint16_t"}]},{"name":"array_energy","description":"cumulative energy received from the array","id":281,"endian":"little","data":[{"name":"energy","type":"float","units":"Joule"}]},{"name":"array_energy_reset","description":"resets cumulative energy received from the array","id":288,"endian":"little","data":[{"name":"energy","type":"float","units":"Joule"}]},{"name":"vision_turn_signals_command","description":"Command to have the vision board illuminate or turn off left, right, or both turn signals","id":688,"data":[{"name":"lights","type":"bitfield","bits":[{"name":"left_turn_signal"},{"name":"right_turn_signal"},{"name":"spare_1"},{"name":"spare_2"},{"name":"spare_3"}]}]},{"name":"vision_brake_lights_command","description":"Command to have the vision board illuminate or turn off the brake lights","id":689,"data":[{"name":"lights","type":"bitfield","bits":[{"name":"brake_lights"},{"name":"spare_1"},{"name":"spare_2"},{"name":"spare_3"}]}]},{"name":"vision_headlights_command","description":"Command to have the vision board illuminate or turn off the headlights and high beams","id":690,"data":[{"name":"lights","type":"bitfield","bits":[{"name":"headlights"},{"name":"high_beams"},{"name":"spare_1"},{"name":"spare_2"},{"name":"spare_3"}]},{"name":"brightness","type":"float"}]},{"name":"vision_horn_command","description":"Command the vision board honk the horn, must be repeatedly sent otherwise the vision board will stop honking after a bit. See high_power.h for details.","id":691,"data":[{"name":"horn","type":"bitfield","bits":[{"name":"horn"},{"name":"spare"}]}]},{"name":"vision_array_latches_command","description":"Command the vision board to open the array latches","id":692,"data":[{"name":"array_latches","type":"bitfield","bits":[{"name":"array_front"},{"name":"array_rear"}]}]},{"name":"vision_rearview_command","description":"Command the vision board turn on the rear view cameras","id":693,"data":[{"name":"cameras","type":"bitfield","bits":[{"name":"left"},{"name":"right"},{"name":"rear"}]}]},{"name":"tracker_enable","description":"Enables/disables power trackers. Use 0x610 for the channel transmitting the data packet on 0x600, 0x611 for 0x601, et cetera. Sending 1 in the enable byte turns the tracker on; sending 0 turns it off.","id":1552,"endian":"little","repeat":6,"offset":1,"data":[{"name":"enable","type":"uint8_t"}]},{"name":"distance_traveled","description":"distance of wavesculptor odometer","id":413,"endian":"little","data":[{"name":"trip_distance","type":"float","units":"m"}]},{"name":"charger_state","description":"Notifies whether the J1772 cable is plugged.","id":1395,"data":[{"name":"state_flags","type":"bitfield","bits":[{"name":"charger_plugged"}]},{"name":"charger_max_temp","type":"uint16_t","units":"C","conversion":0.001},{"name":"fault","type":"bitfield","bits":[{"name":"CHARGER_OVERVOLT"},{"name":"CHARGER_OVERTEMP"},{"name":"CHARGER_CAN_TIMEOUT"},{"name":"BATTERY_HV_KILL"},{"name":"BATTERY_UNDERVOLT"},{"name":"BATTERY_OVERVOLT"},{"name":"BATTERY_CELL_OVERTEMP"},{"name":"BATTERY_CAN_TIMEOUT"}]},{"name":"charging_current","type":"float","units":"A"}]},{"name":"charger_bms_request","description":"Request packet for sending contactor commands from the charger to BP.","id":116,"data":[{"name":"request_flags","type":"bitfield","bits":[{"name":"charging_requested"}]}]},{"name":"charger_current_voltage","description":"Packet to request charging current/voltage set","id":1398,"data":[{"name":"max_current","type":"float","units":"A"},{"name":"max_capacity","type":"float","units":"kWh"}]},{"name":"charger_power","description":"Outputs the amount of power that the chargers are delivering.","id":1399,"data":[{"name":"power","type":"float","units":"W"}]},{"name":"thunderstruck_control_message","description":"Control packet for thunderstruck chargers","id":417677348,"endian":"little","is_extended":true,"data":[{"name":"Enable","type":"uint8_t","units":"V","conversion":1},{"name":"CHARGE_VOLTAGE","type":"uint16_t","units":"V","conversion":1},{"name":"CHARGE_CURRENT","type":"uint16_t","units":"V","conversion":1},{"name":"LED_BLINK_PATTERN","type":"uint8_t","units":"V","conversion":1},{"name":"RESERVED","type":"uint16_t","units":"V","conversion":1}]},{"name":"vision_status_front","description":"Status of the front vision board outputs","id":694,"data":[{"name":"lights","type":"bitfield","bits":[{"name":"left_turn_signal"},{"name":"right_turn_signal"},{"name":"brake_lights"},{"name":"headlights"},{"name":"high_beams"},{"name":"spare_1"},{"name":"spare_2"},{"name":"spare_3"}]},{"name":"horn","type":"bitfield","bits":[{"name":"horn"},{"name":"spare"}]},{"name":"cameras","type":"bitfield","bits":[{"name":"left"},{"name":"right"},{"name":"rear"}]},{"name":"array_latches","type":"bitfield","bits":[{"name":"array_front_0"},{"name":"array_front_1"},{"name":"array_rear_0"},{"name":"array_rear_1"}]}]},{"name":"vision_status_rear","description":"Status of the rear vision board outputs","id":695,"data":[{"name":"lights","type":"bitfield","bits":[{"name":"left_turn_signal"},{"name":"right_turn_signal"},{"name":"brake_lights"},{"name":"headlights"},{"name":"high_beams"},{"name":"spare_1"},{"name":"spare_2"},{"name":"spare_3"}]},{"name":"horn","type":"bitfield","bits":[{"name":"horn"},{"name":"spare"}]},{"name":"cameras","type":"bitfield","bits":[{"name":"left"},{"name":"right"},{"name":"rear"}]},{"name":"array_latches","type":"bitfield","bits":[{"name":"array_front_0"},{"name":"array_front_1"},{"name":"array_rear_0"},{"name":"array_rear_1"}]}]},{"name":"lights_front_id","description":"Unique identification packet for front lights board","id":768,"data":[{"name":"board_id","type":"uint16_t"},{"name":"mcu_temp","type":"int16_t","units":"C","conversion":0.01},{"name":"bus_voltage","type":"uint16_t","units":"V","conversion":0.001},{"name":"fault_code","type":"uint16_t"}]},{"name":"lights_back_id","description":"Unique identification packet for back lights board","id":769,"data":[{"name":"board_id","type":"uint16_t"},{"name":"mcu_temp","type":"int16_t","units":"C","conversion":0.01},{"name":"bus_voltage","type":"uint16_t","units":"V","conversion":0.001},{"name":"fault_code","type":"uint16_t"}]},{"name":"vision_id","description":"Unique identification packet for vision","id":770,"data":[{"name":"board_id","type":"uint16_t"},{"name":"mcu_temp","type":"int16_t","units":"C","conversion":0.01},{"name":"bus_voltage","type":"uint16_t","units":"V","conversion":0.001},{"name":"fault_code","type":"uint16_t"}]},{"name":"steering_press_count_1","description":"Shows whether each button has been toggled an even (\"on\") or odd (\"off\") number of times.","id":576,"data":[{"name":"button0","type":"uint8_t"},{"name":"button1","type":"uint8_t"},{"name":"button2","type":"uint8_t"},{"name":"button3","type":"uint8_t"},{"name":"button4","type":"uint8_t"},{"name":"button5","type":"uint8_t"},{"name":"button6","type":"uint8_t"}]},{"name":"steering_press_count_2","description":"Shows whether each button has been toggled an even (\"on\") or odd (\"off\") number of times.","id":592,"data":[{"name":"button7","type":"uint8_t"},{"name":"button8","type":"uint8_t"},{"name":"button9","type":"uint8_t"},{"name":"button10","type":"uint8_t"}]},{"name":"steering_button_colors_1","description":"This packet controls each button's color. Each byte is a hex color code.","id":577,"data":[{"name":"button0","type":"uint8_t"},{"name":"button1","type":"uint8_t"},{"name":"button2","type":"uint8_t"},{"name":"button3","type":"uint8_t"},{"name":"button4","type":"uint8_t"},{"name":"button5","type":"uint8_t"},{"name":"button6","type":"uint8_t"}]},{"name":"steering_button_colors_2","description":"This packet controls each button's color. Each byte is a hex color code.","id":593,"data":[{"name":"button7","type":"uint8_t"},{"name":"button8","type":"uint8_t"},{"name":"button9","type":"uint8_t"},{"name":"button10","type":"uint8_t"}]},{"name":"steering_horn","description":"This packet controls the state of the horn.","id":578,"data":[{"name":"horn","type":"uint8_t"}]},{"name":"thunderstruck_status_message","description":"Status packet for thunderstruck chargers","id":418063424,"endian":"little","is_extended":true,"data":[{"name":"STATUS_FLAGS","type":"uint8_t","units":"V","conversion":1},{"name":"CHARGE_FLAGS","type":"uint8_t","units":"V","conversion":1},{"name":"OUTPUT_VOLTAGE","type":"uint16_t","units":"V","conversion":1},{"name":"OUTPUT_CURRENT","type":"uint16_t","units":"V","conversion":1},{"name":"CHARGER_TEMP","type":"uint8_t","units":"V","conversion":1},{"name":"RESERVED","type":"uint8_t","units":"V","conversion":1}]},{"name":"tracker_data","description":"Tracker data. Each channel transmits on a specific ID, which should be specified along with the tracker, most likely 0x600-0x603.","id":1536,"endian":"little","repeat":6,"offset":1,"data":[{"name":"array_voltage","type":"uint16_t","units":"V","conversion":0.01},{"name":"array_current","type":"uint16_t","units":"A","conversion":0.001},{"name":"battery_voltage","type":"uint16_t","units":"V","conversion":0.01},{"name":"temperature","type":"uint16_t","units":"C","conversion":0.01}]},{"name":"tritium_motor_drive_l","description":"Tritium Motor Drive Command","id":289,"endian":"little","data":[{"name":"motor_velocity","type":"float"},{"name":"motor_current","type":"float"}]},{"name":"tritium_motor_power_l","description":"Tritium Motor Power Command","id":290,"endian":"little","data":[{"name":"reserved","type":"float"},{"name":"bus_current","type":"float"}]},{"name":"tritium_reset_l","description":"Tritium Reset Command","id":291,"endian":"little","data":[{"name":"unused1","type":"float"},{"name":"unused2","type":"float"}]},{"name":"tritium_motor_drive_r","description":"Tritium Motor Drive Command","id":353,"endian":"little","data":[{"name":"motor_velocity","type":"float"},{"name":"motor_current","type":"float"}]},{"name":"tritium_motor_power_r","description":"Tritium Motor Power Command","id":354,"endian":"little","data":[{"name":"reserved","type":"float"},{"name":"bus_current","type":"float"}]},{"name":"tritium_reset_r","description":"Tritium Reset Command","id":355,"endian":"little","data":[{"name":"unused1","type":"float"},{"name":"unused2","type":"float"}]},{"name":"bms_ah_set","description":"write state of charge, use with caution","id":22,"endian":"little","data":[{"name":"ah","type":"uint32_t","conversion":0.00001}]},{"name":"bms_wh_set","description":"write state of charge, use with caution","id":23,"endian":"little","data":[{"name":"wh","type":"uint32_t","conversion":0.00001}]},{"name":"bms_kill","description":"packet to cause BMS kill","id":26,"endian":"little","data":[{"name":"kill_type","type":"bitfield","bits":[{"name":"KILL_HARD"}]}]},{"name":"telemetry_rtc_reset","description":"Reset telemetry's real-time clock (RTC).","id":1792,"data":[{"name":"year","type":"uint8_t"},{"name":"month","type":"uint8_t"},{"name":"day","type":"uint8_t"},{"name":"hour","type":"uint8_t"},{"name":"minute","type":"uint8_t"},{"name":"second","type":"uint8_t"}]},{"name":"wsr_identification","description":"WS RIGHT Identification Information","id":320,"endian":"little","data":[{"name":"tritium_id","type":"uint32_t"},{"name":"serial_number","type":"uint32_t"}]},{"name":"wsr_status_information","description":"WS RIGHT Status Information","id":321,"endian":"little","data":[{"name":"limit_flags","type":"bitfield","bits":[{"name":"output_voltage_pwm"},{"name":"motor_current"},{"name":"velocity"},{"name":"bus_current"},{"name":"bus_voltage_upper_limit"},{"name":"bus_voltage_lower_limit"},{"name":"ipm_temperature_or_motor_temperature"},{"name":"reserved"}]},{"name":"limit_flags_reserved","type":"uint8_t"},{"name":"error_flags_0","type":"bitfield","bits":[{"name":"hardware_over_current"},{"name":"software_over_current"},{"name":"dc_bus_over_voltage"},{"name":"bad_motor_position_hall_sequence"},{"name":"watchdog_caused_last_reset"},{"name":"config_read_error"},{"name":"lv_rail_under_voltage_lock_out"},{"name":"desaturation_fault"}]},{"name":"error_flags_1","type":"bitfield","bits":[{"name":"motor_over_speed"},{"name":"reserved_9"},{"name":"reserved_10"},{"name":"reserved_11"},{"name":"reserved_12"},{"name":"reserved_13"},{"name":"reserved_14"},{"name":"reserved_15"}]},{"name":"active_motor","type":"uint16_t"},{"name":"reserved","type":"uint16_t"}]},{"name":"wsr_bus_measurement","description":"WS RIGHT Bus Measurement","id":322,"endian":"little","data":[{"name":"bus_voltage","type":"float","units":"V"},{"name":"bus_current","type":"float","units":"A"}]},{"name":"wsr_velocity","description":"WS RIGHT Velocity Measurement","id":323,"endian":"little","data":[{"name":"motor_velocity","type":"float","units":"rpm"},{"name":"vehicle_velocity","type":"float","units":"m/s"}]},{"name":"wsr_phase_current","description":"WS RIGHT Phase Current Measurement","id":324,"endian":"little","data":[{"name":"phase_b_current","type":"float","units":"A rms"},{"name":"phase_c_current","type":"float","units":"A rms"}]},{"name":"wsr_motor_voltage_vector","description":"WS RIGHT Motor Voltage Vector Measurement","id":325,"endian":"little","data":[{"name":"vq","type":"float","units":"V"},{"name":"vd","type":"float","units":"V"}]},{"name":"wsr_motor_current_vector","description":"WS RIGHT Motor Current Vector Measurement","id":326,"endian":"little","data":[{"name":"iq","type":"float","units":"A"},{"name":"id","type":"float","units":"A"}]},{"name":"wsr_motor_backemf","description":"WS RIGHT Motor BackEMF Measurement / Prediction","id":327,"endian":"little","data":[{"name":"bemfq","type":"float","units":"V"},{"name":"bemfd","type":"float","units":"V"}]},{"name":"wsr_15_165_voltage_rail","description":"WS RIGHT 15 and 1.65 Voltage Rail Measurement","id":328,"endian":"little","data":[{"name":"reference_165v","type":"float","units":"V"},{"name":"supply_15v","type":"float","units":"V"}]},{"name":"wsr_25_12_voltage_rail","description":"WS RIGHT 2.5V and 1.2V Voltage Rail Measurement","id":329,"endian":"little","data":[{"name":"supply_12v","type":"float","units":"V"},{"name":"supply_25v","type":"float","units":"V"}]},{"name":"wsr_heatsink_motor_temp","description":"WS RIGHT Heat-sink \u0026 Motor Temperature Measurement","id":331,"endian":"little","data":[{"name":"motor_temp","type":"float","units":"C"},{"name":"heatsink_temp","type":"float","units":"C"}]},{"name":"wsr_dsp_board_temp","description":"WS RIGHT DPS Board Temperature Measurement","id":332,"endian":"little","data":[{"name":"dsp_board_temp","type":"float","units":"C"},{"name":"reserved","type":"float","units":"C"}]},{"name":"wsr_reserved","description":"WS RIGHT Reserved","id":333,"endian":"little","data":[{"name":"reserved0","type":"float"},{"name":"reserved1","type":"float"}]},{"name":"wsr_odometer_bus_amphours_measurement","description":"WS RIGHT Odometer and Bus AmpHours Measurement","id":334,"endian":"little","data":[{"name":"odometer","type":"float","units":"m"},{"name":"dc_bus_amphours","type":"float","units":"Ah"}]},{"name":"wsr_slip_speed_measurement","description":"WS RIGHT Slip Speed Measurement","id":343,"endian":"little","data":[{"name":"reserved","type":"float","units":"C"},{"name":"slip_speed","type":"float","units":"Hz"}]},{"name":"wsl_identification","description":"WS LEFT Identification Information","id":256,"endian":"little","data":[{"name":"tritium_id","type":"uint32_t"},{"name":"serial_number","type":"uint32_t"}]},{"name":"wsl_status_information","description":"WS LEFT Status Information","id":257,"endian":"little","data":[{"name":"limit_flags","type":"bitfield","bits":[{"name":"output_voltage_pwm"},{"name":"motor_current"},{"name":"velocity"},{"name":"bus_current"},{"name":"bus_voltage_upper_limit"},{"name":"bus_voltage_lower_limit"},{"name":"ipm_temperature_or_motor_temperature"},{"name":"reserved"}]},{"name":"limit_flags_reserved","type":"uint8_t"},{"name":"error_flags_0","type":"bitfield","bits":[{"name":"hardware_over_current"},{"name":"software_over_current"},{"name":"dc_bus_over_voltage"},{"name":"bad_motor_position_hall_sequence"},{"name":"watchdog_caused_last_reset"},{"name":"config_read_error"},{"name":"lv_rail_under_voltage_lock_out"},{"name":"desaturation_fault"}]},{"name":"error_flags_1","type":"bitfield","bits":[{"name":"motor_over_speed"},{"name":"reserved_9"},{"name":"reserved_10"},{"name":"reserved_11"},{"name":"reserved_12"},{"name":"reserved_13"},{"name":"reserved_14"},{"name":"reserved_15"}]},{"name":"active_motor","type":"uint16_t"},{"name":"reserved","type":"uint16_t"}]},{"name":"wsl_bus_measurement","description":"WS LEFT Bus Measurement","id":258,"endian":"little","data":[{"name":"bus_voltage","type":"float","units":"V"},{"name":"bus_current","type":"float","units":"A"}]},{"name":"wsl_velocity","description":"WS LEFT Velocity Measurement","id":259,"endian":"little","data":[{"name":"motor_velocity","type":"float","units":"rpm"},{"name":"vehicle_velocity","type":"float","units":"m/s"}]},{"name":"wsl_phase_current","description":"WS LEFT Phase Current Measurement","id":260,"endian":"little","data":[{"name":"phase_b_current","type":"float","units":"A rms"},{"name":"phase_c_current","type":"float","units":"A rms"}]},{"name":"wsl_motor_voltage_vector","description":"WS LEFT Motor Voltage Vector Measurement","id":261,"endian":"little","data":[{"name":"vq","type":"float","units":"V"},{"name":"vd","type":"float","units":"V"}]},{"name":"wsl_motor_current_vector","description":"WS LEFT Motor Current Vector Measurement","id":262,"endian":"little","data":[{"name":"iq","type":"float","units":"A"},{"name":"id","type":"float","units":"A"}]},{"name":"wsl_motor_backemf","description":"WS LEFT Motor BackEMF Measurement / Prediction","id":263,"endian":"little","data":[{"name":"bemfq","type":"float","units":"V"},{"name":"bemfd","type":"float","units":"V"}]},{"name":"wsl_15_165_voltage_rail","description":"WS LEFT 15 and 1.65 Voltage Rail Measurement","id":264,"endian":"little","data":[{"name":"reference_165v","type":"float","units":"V"},{"name":"supply_15v","type":"float","units":"V"}]},{"name":"wsl_25_12_voltage_rail","description":"WS LEFT 2.5V and 1.2V Voltage Rail Measurement","id":265,"endian":"little","data":[{"name":"supply_12v","type":"float","units":"V"},{"name":"supply_25v","type":"float","units":"V"}]},{"name":"wsl_heatsink_motor_temp","description":"WS LEFT Heat-sink \u0026 Motor Temperature Measurement","id":267,"endian":"little","data":[{"name":"motor_temp","type":"float","units":"C"},{"name":"heatsink_temp","type":"float","units":"C"}]},{"name":"wsl_dsp_board_temp","description":"WS LEFT DPS Board Temperature Measurement","id":268,"endian":"little","data":[{"name":"dsp_board_temp","type":"float","units":"C"},{"name":"reserved","type":"float","units":"C"}]},{"name":"wsl_odometer_bus_amphours_measurement","description":"WS LEFT Odometer and Bus AmpHours Measurement","id":270,"endian":"little","data":[{"name":"odometer","type":"float","units":"m"},{"name":"dc_bus_amphours","type":"float","units":"Ah"}]},{"name":"wsl_reserved","description":"WS LEFT Reserved","id":269,"endian":"little","data":[{"name":"reserved0","type":"float"},{"name":"reserved1","type":"float"}]},{"name":"wsl_slip_speed_measurement","description":"WS LEFT Slip Speed Measurement","id":279,"endian":"little","data":[{"name":"reserved","type":"float","units":"C"},{"name":"slip_speed","type":"float","units":"Hz"}]}],"boards":[{"name":"bms","transmit":["bms_measurement","bms_capacity","bms_charger_response","battery_status","bms_kill_reason","bms_module_min_max","bms_soc","bms_currentlimit","bms_fan_info","bms_module"],"receive":["bms_kill","bms_wh_set","bms_ah_set","bms_set_min_fan_speed","charger_bms_request","chassis_isolation_fault"]},{"name":"bridge_board","transmit":["chassis_isolation_fault"],"receive":["bms_imd_info","battery_status"]},{"name":"charger","transmit":["charger_state","charger_bms_request","charger_power","thunderstruck_control_message"],"receive":["bms_charger_response","battery_status","bms_module_min_max","bms_measurement","charger_current_voltage","bms_capacity","thunderstruck_status_message"]},{"name":"flight_computer","transmit":["tracker_enable","vision_turn_signals_command","vision_brake_lights_command","vision_headlights_command","vision_horn_command","tritium_motor_drive_l","tritium_motor_drive_r","steering_button_colors_1","steering_button_colors_2","tritium_reset_l","tritium_reset_r","dashboard_pedal_percentages","car_state","car_speed","dashboard_pedal_fault","flight_computer_hv_board_disconnect_counts","flight_computer_lv_board_disconnect_counts","flight_computer_internal_state","power_to_drive","array_power","array_energy","distance_traveled"],"receive":["bms_module_min_max","charger_state","steering_press_count_1","steering_press_count_2","wsl_velocity","wsr_velocity","steering_horn","bms_kill_reason","bms_measurement","tracker_data","vision_status_front","vision_status_rear","wsl_odometer_bus_amphours_measurement","array_energy_reset","wsr_odometer_bus_amphours_measurement"]},{"name":"g4_example","transmit":["vision_status_front","vision_headlights_command","demo_packet"],"receive":["vision_turn_signals_command","vision_brake_lights_command","vision_headlights_command","vision_horn_command","demo_packet"]},{"name":"lights","transmit":["vision_status_front","vision_status_rear","lights_front_id","lights_back_id"],"receive":["vision_turn_signals_command","vision_brake_lights_command","vision_headlights_command","bms_kill_reason"]},{"name":"skylab2_demo","transmit":["vision_status_front","vision_headlights_command"],"receive":["vision_turn_signals_command","vision_brake_lights_command","vision_headlights_command","vision_horn_command"]},{"name":"steering","transmit":["steering_press_count_1","steering_press_count_2","steering_horn"],"receive":["steering_button_colors_1","steering_button_colors_2"]},{"name":"vision","transmit":["vision_status_front","vision_id"],"receive":["vision_turn_signals_command","vision_brake_lights_command","vision_headlights_command","vision_horn_command","vision_array_latches_command","vision_rearview_command"]}]}` +const SkylabDefinitions = `{"packets":[{"name":"bms_measurement","description":"Voltages for main battery and aux pack","id":16,"endian":"little","data":[{"name":"battery_voltage","type":"uint16_t","units":"V","conversion":0.01},{"name":"aux_voltage","type":"uint16_t","units":"V","conversion":0.001},{"name":"current","type":"float","units":"A","conversion":1}]},{"name":"battery_status","description":"Status bits for the battery","id":17,"endian":"little","data":[{"name":"battery_state","type":"bitfield","bits":[{"name":"startup"},{"name":"precharge"},{"name":"discharging"},{"name":"lv_only"},{"name":"charging"},{"name":"wall_charging"},{"name":"killed"}]},{"name":"contactor_state","type":"bitfield","bits":[{"name":"battery_high_contactor"},{"name":"battery_low_contactor"},{"name":"battery_vicor_contactor"},{"name":"battery_pre_contactor"},{"name":"battery_high2_contactor"},{"name":"battery_low2_contactor"},{"name":"charger_high_contactor"},{"name":"charger_pre_contactor"}]},{"name":"lv_channel_status","type":"bitfield","bits":[{"name":"aux_fault"},{"name":"main_fault"},{"name":"aux_power_valid"},{"name":"main_power_valid"},{"name":"aux_power_active"},{"name":"main_power_active"}]},{"name":"lv_control_status","type":"bitfield","bits":[{"name":"aux_vicor_enable"},{"name":"bat_vicor_enable"},{"name":"aux_relay_held"},{"name":"aux_ref_enable"},{"name":"aux_charging_enable"},{"name":"kill_hv"},{"name":"kill_lv"},{"name":"start_button"}]},{"name":"pack_choice","type":"bitfield","bits":[{"name":"large_pack"},{"name":"small_pack"}]}]},{"name":"bms_kill_reason","description":"Information for when the car kills","id":18,"endian":"little","data":[{"name":"reason1","type":"bitfield","bits":[{"name":"OVERVOLT"},{"name":"UNDERVOLT"},{"name":"OVERTEMP"},{"name":"TEMP_DISCONNECT"},{"name":"COMM_FAIL"}]},{"name":"reason2","type":"bitfield","bits":[{"name":"HARDWARE"},{"name":"KILL_PACKET"},{"name":"UKNOWN"},{"name":"OVERCURRENT"},{"name":"PRECHARGE_FAIL"},{"name":"AUX_OVER_UNDER"},{"name":"AUX_OVERTEMP"}]},{"name":"module","type":"uint16_t"},{"name":"value","type":"float"}]},{"name":"bms_module_min_max","description":"min and max cell voltages and temperatures","id":19,"endian":"little","data":[{"name":"module_max_temp","type":"int16_t","units":"C","conversion":0.01},{"name":"module_min_temp","type":"int16_t","units":"C","conversion":0.01},{"name":"module_max_voltage","type":"uint16_t","units":"V","conversion":0.001},{"name":"module_min_voltage","type":"uint16_t","units":"V","conversion":0.001}]},{"name":"bms_soc","description":"State of charge","id":20,"endian":"little","data":[{"name":"soc","type":"float","conversion":1}]},{"name":"bms_capacity","description":"State of charge","id":21,"endian":"little","data":[{"name":"Ah","type":"float","conversion":1},{"name":"Wh","type":"float","conversion":1}]},{"name":"bms_currentlimit","description":"reports BP params for current","id":24,"endian":"little","data":[{"name":"current_max","type":"int16_t","units":"A","conversion":0.01},{"name":"current_min","type":"int16_t","units":"A","conversion":0.01}]},{"name":"bms_fan_info","description":"BP Fans","id":25,"endian":"little","data":[{"name":"fan1","type":"uint16_t","units":"RPM","conversion":1},{"name":"fan2","type":"uint16_t","units":"RPM","conversion":1},{"name":"fan3","type":"uint16_t","units":"RPM","conversion":1},{"name":"fan4","type":"uint16_t","units":"RPM","conversion":1}]},{"name":"bms_set_min_fan_speed","description":"packet which sets a minimum fan speed of BMS for a specific time frame in seconds","id":27,"endian":"little","data":[{"name":"fan_percentage","type":"float","units":"percent"},{"name":"time","type":"uint16_t","units":"s"}]},{"name":"bms_module","description":"Voltage and temperature for a single module","id":64,"endian":"little","repeat":36,"offset":1,"data":[{"name":"voltage","type":"float","units":"V","conversion":1},{"name":"temperature","type":"float","units":"C","conversion":1}]},{"name":"bms_charger_response","description":"Response packet from BMS for indicating whether BMS is ready for charging","id":117,"endian":"little","data":[{"name":"response_flags","type":"bitfield","bits":[{"name":"charging_ready"}]}]},{"name":"chassis_isolation_fault","description":"chassiss is not isolated from the battery","id":56,"data":[{"name":"fault_detected","type":"bitfield","bits":[{"name":"isolation_fault"}]}]},{"name":"bms_imd_info","description":"information from chassis isolation","id":55,"data":[{"name":"d_imc_r_iso","type":"uint16_t"},{"name":"d_imc_status_1","type":"bitfield","bits":[{"name":"isolation_fault"},{"name":"chassis_fault"},{"name":"system_failure"},{"name":"calibration_running"},{"name":"self_test_running"},{"name":"isolation_warning"},{"name":"reserved"},{"name":"reserved_2"}]},{"name":"d_imc_status_2","type":"bitfield","bits":[{"name":"reserved"},{"name":"reserved_2"},{"name":"reserved_3"},{"name":"reserved_4"},{"name":"reserved_5"},{"name":"reserved_6"},{"name":"reserved_7"},{"name":"reserved_8"}]},{"name":"d_vifc_status_1","type":"bitfield","bits":[{"name":"insulation_measurment"},{"name":"imc_connectivity_not_implemented"},{"name":"imc_alive_satus_detection"},{"name":"reserved"},{"name":"vifc_command_not_implemented"},{"name":"reserved_2"},{"name":"reserved_3"},{"name":"reserved_4"}]},{"name":"d_vifc_status_2","type":"bitfield","bits":[{"name":"insulation_resistance_value"},{"name":"reserved"},{"name":"reserved_2"},{"name":"reserved_3"},{"name":"imc_self_test_overAll"},{"name":"imc_self_test_parameterConfig"},{"name":"reserved_4"},{"name":"reserved_5"}]}]},{"name":"dashboard_pedal_percentages","description":"ADC values from the brake and accelerator pedals.","id":656,"endian":"little","data":[{"name":"accel_pedal_value","type":"uint8_t"},{"name":"brake_pedal_value","type":"uint8_t"}]},{"name":"car_state","description":"Car gear. Forward, neutral, reverse, etc.","id":657,"endian":"little","data":[{"name":"state","type":"uint8_t"}]},{"name":"dashboard_pedal_fault","description":"Target speed that the driver should maintain.","id":658,"endian":"little","data":[{"name":"brake_fault_count","type":"uint8_t"},{"name":"accel_fault_count","type":"uint8_t"}]},{"name":"dashboard_system_timeout_test","description":"Exposes whether each system that dashboard is supposed to listen for packets from has sent a packet. Used for testing.","id":665,"endian":"little","data":[{"name":"flag_set_0","type":"bitfield","bits":[{"name":"steering_disconnected"},{"name":"vision_front_disconnected"},{"name":"vision_rear_disconnected"},{"name":"telemetry_disconnected"},{"name":"wsl_disconnected"},{"name":"wsr_disconnected"},{"name":"front_mppt_disconnected"},{"name":"rear_mppt_disconnected"}]}]},{"name":"car_speed","description":"speed of car in meters per second","id":666,"endian":"little","data":[{"name":"speed","type":"float"}]},{"name":"flight_computer_lv_board_disconnect_counts","description":"Number of times a board hasn't been heard from within the allowed timeout.","id":667,"endian":"little","data":[{"name":"front_lights","type":"uint8_t"},{"name":"rear_lights","type":"uint8_t"},{"name":"steering","type":"uint8_t"},{"name":"vision","type":"uint8_t"},{"name":"driver_display","type":"uint8_t"},{"name":"center_console","type":"uint8_t"}]},{"name":"flight_computer_hv_board_disconnect_counts","description":"Number of times a board hasn't been heard from within the allowed timeout.","id":668,"endian":"little","data":[{"name":"bms","type":"uint8_t"},{"name":"charger","type":"uint8_t"},{"name":"wsl","type":"uint8_t"},{"name":"wsr","type":"uint8_t"},{"name":"mppt_front","type":"uint8_t"},{"name":"mppt_rear","type":"uint8_t"}]},{"name":"flight_computer_internal_state","description":"internal bools","id":669,"endian":"little","data":[{"name":"bms","type":"bitfield","bits":[{"name":"battery_kill"},{"name":"cells_in_charging_threshold"},{"name":"first_packet_received"}]},{"name":"charger","type":"bitfield","bits":[{"name":"proximity_detected"}]},{"name":"photon3","type":"bitfield","bits":[{"name":"enable"}]},{"name":"wavesculptor","type":"bitfield","bits":[{"name":"sending_reset"},{"name":"regen_enable"}]},{"name":"internal","type":"bitfield","bits":[{"name":"accel_pedal_disconnect"},{"name":"brake_pedal_disconnect"}]}]},{"name":"power_to_drive","description":"calculated power required to drive the vehicle","id":414,"endian":"little","data":[{"name":"moving_average_100","type":"int16_t"},{"name":"moving_average_1k","type":"int16_t"},{"name":"moving_average_10k","type":"int16_t"}]},{"name":"array_power","description":"array power calculated from current and voltage measurements","id":415,"endian":"little","data":[{"name":"front_array_channel_0","type":"uint16_t"},{"name":"front_array_channel_1","type":"uint16_t"},{"name":"rear_array_channel_0","type":"uint16_t"},{"name":"rear_array_channel_1","type":"uint16_t"}]},{"name":"array_energy","description":"cumulative energy received from the array","id":281,"endian":"little","data":[{"name":"energy","type":"float","units":"Joule"}]},{"name":"array_energy_reset","description":"resets cumulative energy received from the array","id":288,"endian":"little","data":[{"name":"energy","type":"float","units":"Joule"}]},{"name":"vision_turn_signals_command","description":"Command to have the vision board illuminate or turn off left, right, or both turn signals","id":688,"data":[{"name":"lights","type":"bitfield","bits":[{"name":"left_turn_signal"},{"name":"right_turn_signal"},{"name":"spare_1"},{"name":"spare_2"},{"name":"spare_3"}]}]},{"name":"vision_brake_lights_command","description":"Command to have the vision board illuminate or turn off the brake lights","id":689,"data":[{"name":"lights","type":"bitfield","bits":[{"name":"brake_lights"},{"name":"spare_1"},{"name":"spare_2"},{"name":"spare_3"}]}]},{"name":"vision_headlights_command","description":"Command to have the vision board illuminate or turn off the headlights and high beams","id":690,"data":[{"name":"lights","type":"bitfield","bits":[{"name":"headlights"},{"name":"high_beams"},{"name":"spare_1"},{"name":"spare_2"},{"name":"spare_3"}]},{"name":"brightness","type":"float"}]},{"name":"vision_horn_command","description":"Command the vision board honk the horn, must be repeatedly sent otherwise the vision board will stop honking after a bit. See high_power.h for details.","id":691,"data":[{"name":"horn","type":"bitfield","bits":[{"name":"horn"},{"name":"spare"}]}]},{"name":"vision_array_latches_command","description":"Command the vision board to open the array latches","id":692,"data":[{"name":"array_latches","type":"bitfield","bits":[{"name":"array_front"},{"name":"array_rear"}]}]},{"name":"vision_rearview_command","description":"Command the vision board turn on the rear view cameras","id":693,"data":[{"name":"cameras","type":"bitfield","bits":[{"name":"left"},{"name":"right"},{"name":"rear"}]}]},{"name":"tracker_enable","description":"Enables/disables power trackers. Use 0x610 for the channel transmitting the data packet on 0x600, 0x611 for 0x601, et cetera. Sending 1 in the enable byte turns the tracker on; sending 0 turns it off.","id":1552,"endian":"little","repeat":6,"offset":1,"data":[{"name":"enable","type":"uint8_t"}]},{"name":"distance_traveled","description":"distance of wavesculptor odometer","id":413,"endian":"little","data":[{"name":"trip_distance","type":"float","units":"m"}]},{"name":"charger_state","description":"Notifies whether the J1772 cable is plugged.","id":1395,"data":[{"name":"state_flags","type":"bitfield","bits":[{"name":"charger_plugged"}]},{"name":"charger_max_temp","type":"uint16_t","units":"C","conversion":0.001},{"name":"fault","type":"bitfield","bits":[{"name":"CHARGER_OVERVOLT"},{"name":"CHARGER_OVERTEMP"},{"name":"CHARGER_CAN_TIMEOUT"},{"name":"BATTERY_HV_KILL"},{"name":"BATTERY_UNDERVOLT"},{"name":"BATTERY_OVERVOLT"},{"name":"BATTERY_CELL_OVERTEMP"},{"name":"BATTERY_CAN_TIMEOUT"}]},{"name":"charging_current","type":"float","units":"A"}]},{"name":"charger_bms_request","description":"Request packet for sending contactor commands from the charger to BP.","id":116,"data":[{"name":"request_flags","type":"bitfield","bits":[{"name":"charging_requested"}]}]},{"name":"charger_current_voltage","description":"Packet to request charging current/voltage set","id":1398,"data":[{"name":"max_current","type":"float","units":"A"},{"name":"max_capacity","type":"float","units":"kWh"}]},{"name":"charger_power","description":"Outputs the amount of power that the chargers are delivering.","id":1399,"data":[{"name":"power","type":"float","units":"W"}]},{"name":"thunderstruck_control_message","description":"Control packet for thunderstruck chargers","id":417677348,"endian":"little","is_extended":true,"data":[{"name":"Enable","type":"uint8_t","units":"V","conversion":1},{"name":"CHARGE_VOLTAGE","type":"uint16_t","units":"V","conversion":1},{"name":"CHARGE_CURRENT","type":"uint16_t","units":"V","conversion":1},{"name":"LED_BLINK_PATTERN","type":"uint8_t","units":"V","conversion":1},{"name":"RESERVED","type":"uint16_t","units":"V","conversion":1}]},{"name":"vision_status_front","description":"Status of the front vision board outputs","id":694,"data":[{"name":"lights","type":"bitfield","bits":[{"name":"left_turn_signal"},{"name":"right_turn_signal"},{"name":"brake_lights"},{"name":"headlights"},{"name":"high_beams"},{"name":"spare_1"},{"name":"spare_2"},{"name":"spare_3"}]},{"name":"horn","type":"bitfield","bits":[{"name":"horn"},{"name":"spare"}]},{"name":"cameras","type":"bitfield","bits":[{"name":"left"},{"name":"right"},{"name":"rear"}]},{"name":"array_latches","type":"bitfield","bits":[{"name":"array_front_0"},{"name":"array_front_1"},{"name":"array_rear_0"},{"name":"array_rear_1"}]}]},{"name":"vision_status_rear","description":"Status of the rear vision board outputs","id":695,"data":[{"name":"lights","type":"bitfield","bits":[{"name":"left_turn_signal"},{"name":"right_turn_signal"},{"name":"brake_lights"},{"name":"headlights"},{"name":"high_beams"},{"name":"spare_1"},{"name":"spare_2"},{"name":"spare_3"}]},{"name":"horn","type":"bitfield","bits":[{"name":"horn"},{"name":"spare"}]},{"name":"cameras","type":"bitfield","bits":[{"name":"left"},{"name":"right"},{"name":"rear"}]},{"name":"array_latches","type":"bitfield","bits":[{"name":"array_front_0"},{"name":"array_front_1"},{"name":"array_rear_0"},{"name":"array_rear_1"}]}]},{"name":"lights_front_id","description":"Unique identification packet for front lights board","id":768,"data":[{"name":"board_id","type":"uint16_t"},{"name":"mcu_temp","type":"int16_t","units":"C","conversion":0.01},{"name":"bus_voltage","type":"uint16_t","units":"V","conversion":0.001},{"name":"fault_code","type":"uint16_t"}]},{"name":"lights_back_id","description":"Unique identification packet for back lights board","id":769,"data":[{"name":"board_id","type":"uint16_t"},{"name":"mcu_temp","type":"int16_t","units":"C","conversion":0.01},{"name":"bus_voltage","type":"uint16_t","units":"V","conversion":0.001},{"name":"fault_code","type":"uint16_t"}]},{"name":"vision_id","description":"Unique identification packet for vision","id":770,"data":[{"name":"board_id","type":"uint16_t"},{"name":"mcu_temp","type":"int16_t","units":"C","conversion":0.01},{"name":"bus_voltage","type":"uint16_t","units":"V","conversion":0.001},{"name":"fault_code","type":"uint16_t"}]},{"name":"steering_press_count_1","description":"Shows whether each button has been toggled an even (\"on\") or odd (\"off\") number of times.","id":576,"data":[{"name":"button0","type":"uint8_t"},{"name":"button1","type":"uint8_t"},{"name":"button2","type":"uint8_t"},{"name":"button3","type":"uint8_t"},{"name":"button4","type":"uint8_t"},{"name":"button5","type":"uint8_t"},{"name":"button6","type":"uint8_t"}]},{"name":"steering_press_count_2","description":"Shows whether each button has been toggled an even (\"on\") or odd (\"off\") number of times.","id":592,"data":[{"name":"button7","type":"uint8_t"},{"name":"button8","type":"uint8_t"},{"name":"button9","type":"uint8_t"},{"name":"button10","type":"uint8_t"}]},{"name":"steering_button_colors_1","description":"This packet controls each button's color. Each byte is a hex color code.","id":577,"data":[{"name":"button0","type":"uint8_t"},{"name":"button1","type":"uint8_t"},{"name":"button2","type":"uint8_t"},{"name":"button3","type":"uint8_t"},{"name":"button4","type":"uint8_t"},{"name":"button5","type":"uint8_t"},{"name":"button6","type":"uint8_t"}]},{"name":"steering_button_colors_2","description":"This packet controls each button's color. Each byte is a hex color code.","id":593,"data":[{"name":"button7","type":"uint8_t"},{"name":"button8","type":"uint8_t"},{"name":"button9","type":"uint8_t"},{"name":"button10","type":"uint8_t"}]},{"name":"steering_horn","description":"This packet controls the state of the horn.","id":578,"data":[{"name":"horn","type":"uint8_t"}]},{"name":"thunderstruck_status_message","description":"Status packet for thunderstruck chargers","id":418063424,"endian":"little","data":[{"name":"STATUS_FLAGS","type":"uint8_t","units":"V","conversion":1},{"name":"CHARGE_FLAGS","type":"uint8_t","units":"V","conversion":1},{"name":"OUTPUT_VOLTAGE","type":"uint16_t","units":"V","conversion":1},{"name":"OUTPUT_CURRENT","type":"uint16_t","units":"V","conversion":1},{"name":"CHARGER_TEMP","type":"uint8_t","units":"V","conversion":1},{"name":"RESERVED","type":"uint8_t","units":"V","conversion":1}]},{"name":"tracker_data","description":"Tracker data. Each channel transmits on a specific ID, which should be specified along with the tracker, most likely 0x600-0x603.","id":1536,"endian":"little","repeat":6,"offset":1,"data":[{"name":"array_voltage","type":"uint16_t","units":"V","conversion":0.01},{"name":"array_current","type":"uint16_t","units":"A","conversion":0.001},{"name":"battery_voltage","type":"uint16_t","units":"V","conversion":0.01},{"name":"temperature","type":"uint16_t","units":"C","conversion":0.01}]},{"name":"tritium_motor_drive_l","description":"Tritium Motor Drive Command","id":289,"endian":"little","data":[{"name":"motor_velocity","type":"float"},{"name":"motor_current","type":"float"}]},{"name":"tritium_motor_power_l","description":"Tritium Motor Power Command","id":290,"endian":"little","data":[{"name":"reserved","type":"float"},{"name":"bus_current","type":"float"}]},{"name":"tritium_reset_l","description":"Tritium Reset Command","id":291,"endian":"little","data":[{"name":"unused1","type":"float"},{"name":"unused2","type":"float"}]},{"name":"tritium_motor_drive_r","description":"Tritium Motor Drive Command","id":353,"endian":"little","data":[{"name":"motor_velocity","type":"float"},{"name":"motor_current","type":"float"}]},{"name":"tritium_motor_power_r","description":"Tritium Motor Power Command","id":354,"endian":"little","data":[{"name":"reserved","type":"float"},{"name":"bus_current","type":"float"}]},{"name":"tritium_reset_r","description":"Tritium Reset Command","id":355,"endian":"little","data":[{"name":"unused1","type":"float"},{"name":"unused2","type":"float"}]},{"name":"bms_ah_set","description":"write state of charge, use with caution","id":22,"endian":"little","data":[{"name":"ah","type":"uint32_t","conversion":0.00001}]},{"name":"bms_wh_set","description":"write state of charge, use with caution","id":23,"endian":"little","data":[{"name":"wh","type":"uint32_t","conversion":0.00001}]},{"name":"bms_kill","description":"packet to cause BMS kill","id":26,"endian":"little","data":[{"name":"kill_type","type":"bitfield","bits":[{"name":"KILL_HARD"}]}]},{"name":"telemetry_rtc_reset","description":"Reset telemetry's real-time clock (RTC).","id":1792,"data":[{"name":"year","type":"uint8_t"},{"name":"month","type":"uint8_t"},{"name":"day","type":"uint8_t"},{"name":"hour","type":"uint8_t"},{"name":"minute","type":"uint8_t"},{"name":"second","type":"uint8_t"}]},{"name":"wsr_identification","description":"WS RIGHT Identification Information","id":320,"endian":"little","data":[{"name":"tritium_id","type":"uint32_t"},{"name":"serial_number","type":"uint32_t"}]},{"name":"wsr_status_information","description":"WS RIGHT Status Information","id":321,"endian":"little","data":[{"name":"limit_flags","type":"bitfield","bits":[{"name":"output_voltage_pwm"},{"name":"motor_current"},{"name":"velocity"},{"name":"bus_current"},{"name":"bus_voltage_upper_limit"},{"name":"bus_voltage_lower_limit"},{"name":"ipm_temperature_or_motor_temperature"},{"name":"reserved"}]},{"name":"limit_flags_reserved","type":"uint8_t"},{"name":"error_flags_0","type":"bitfield","bits":[{"name":"hardware_over_current"},{"name":"software_over_current"},{"name":"dc_bus_over_voltage"},{"name":"bad_motor_position_hall_sequence"},{"name":"watchdog_caused_last_reset"},{"name":"config_read_error"},{"name":"lv_rail_under_voltage_lock_out"},{"name":"desaturation_fault"}]},{"name":"error_flags_1","type":"bitfield","bits":[{"name":"motor_over_speed"},{"name":"reserved_9"},{"name":"reserved_10"},{"name":"reserved_11"},{"name":"reserved_12"},{"name":"reserved_13"},{"name":"reserved_14"},{"name":"reserved_15"}]},{"name":"active_motor","type":"uint16_t"},{"name":"reserved","type":"uint16_t"}]},{"name":"wsr_bus_measurement","description":"WS RIGHT Bus Measurement","id":322,"endian":"little","data":[{"name":"bus_voltage","type":"float","units":"V"},{"name":"bus_current","type":"float","units":"A"}]},{"name":"wsr_velocity","description":"WS RIGHT Velocity Measurement","id":323,"endian":"little","data":[{"name":"motor_velocity","type":"float","units":"rpm"},{"name":"vehicle_velocity","type":"float","units":"m/s"}]},{"name":"wsr_phase_current","description":"WS RIGHT Phase Current Measurement","id":324,"endian":"little","data":[{"name":"phase_b_current","type":"float","units":"A rms"},{"name":"phase_c_current","type":"float","units":"A rms"}]},{"name":"wsr_motor_voltage_vector","description":"WS RIGHT Motor Voltage Vector Measurement","id":325,"endian":"little","data":[{"name":"vq","type":"float","units":"V"},{"name":"vd","type":"float","units":"V"}]},{"name":"wsr_motor_current_vector","description":"WS RIGHT Motor Current Vector Measurement","id":326,"endian":"little","data":[{"name":"iq","type":"float","units":"A"},{"name":"id","type":"float","units":"A"}]},{"name":"wsr_motor_backemf","description":"WS RIGHT Motor BackEMF Measurement / Prediction","id":327,"endian":"little","data":[{"name":"bemfq","type":"float","units":"V"},{"name":"bemfd","type":"float","units":"V"}]},{"name":"wsr_15_165_voltage_rail","description":"WS RIGHT 15 and 1.65 Voltage Rail Measurement","id":328,"endian":"little","data":[{"name":"reference_165v","type":"float","units":"V"},{"name":"supply_15v","type":"float","units":"V"}]},{"name":"wsr_25_12_voltage_rail","description":"WS RIGHT 2.5V and 1.2V Voltage Rail Measurement","id":329,"endian":"little","data":[{"name":"supply_12v","type":"float","units":"V"},{"name":"supply_25v","type":"float","units":"V"}]},{"name":"wsr_heatsink_motor_temp","description":"WS RIGHT Heat-sink \u0026 Motor Temperature Measurement","id":331,"endian":"little","data":[{"name":"motor_temp","type":"float","units":"C"},{"name":"heatsink_temp","type":"float","units":"C"}]},{"name":"wsr_dsp_board_temp","description":"WS RIGHT DPS Board Temperature Measurement","id":332,"endian":"little","data":[{"name":"dsp_board_temp","type":"float","units":"C"},{"name":"reserved","type":"float","units":"C"}]},{"name":"wsr_reserved","description":"WS RIGHT Reserved","id":333,"endian":"little","data":[{"name":"reserved0","type":"float"},{"name":"reserved1","type":"float"}]},{"name":"wsr_odometer_bus_amphours_measurement","description":"WS RIGHT Odometer and Bus AmpHours Measurement","id":334,"endian":"little","data":[{"name":"odometer","type":"float","units":"m"},{"name":"dc_bus_amphours","type":"float","units":"Ah"}]},{"name":"wsr_slip_speed_measurement","description":"WS RIGHT Slip Speed Measurement","id":343,"endian":"little","data":[{"name":"reserved","type":"float","units":"C"},{"name":"slip_speed","type":"float","units":"Hz"}]},{"name":"wsl_identification","description":"WS LEFT Identification Information","id":256,"endian":"little","data":[{"name":"tritium_id","type":"uint32_t"},{"name":"serial_number","type":"uint32_t"}]},{"name":"wsl_status_information","description":"WS LEFT Status Information","id":257,"endian":"little","data":[{"name":"limit_flags","type":"bitfield","bits":[{"name":"output_voltage_pwm"},{"name":"motor_current"},{"name":"velocity"},{"name":"bus_current"},{"name":"bus_voltage_upper_limit"},{"name":"bus_voltage_lower_limit"},{"name":"ipm_temperature_or_motor_temperature"},{"name":"reserved"}]},{"name":"limit_flags_reserved","type":"uint8_t"},{"name":"error_flags_0","type":"bitfield","bits":[{"name":"hardware_over_current"},{"name":"software_over_current"},{"name":"dc_bus_over_voltage"},{"name":"bad_motor_position_hall_sequence"},{"name":"watchdog_caused_last_reset"},{"name":"config_read_error"},{"name":"lv_rail_under_voltage_lock_out"},{"name":"desaturation_fault"}]},{"name":"error_flags_1","type":"bitfield","bits":[{"name":"motor_over_speed"},{"name":"reserved_9"},{"name":"reserved_10"},{"name":"reserved_11"},{"name":"reserved_12"},{"name":"reserved_13"},{"name":"reserved_14"},{"name":"reserved_15"}]},{"name":"active_motor","type":"uint16_t"},{"name":"reserved","type":"uint16_t"}]},{"name":"wsl_bus_measurement","description":"WS LEFT Bus Measurement","id":258,"endian":"little","data":[{"name":"bus_voltage","type":"float","units":"V"},{"name":"bus_current","type":"float","units":"A"}]},{"name":"wsl_velocity","description":"WS LEFT Velocity Measurement","id":259,"endian":"little","data":[{"name":"motor_velocity","type":"float","units":"rpm"},{"name":"vehicle_velocity","type":"float","units":"m/s"}]},{"name":"wsl_phase_current","description":"WS LEFT Phase Current Measurement","id":260,"endian":"little","data":[{"name":"phase_b_current","type":"float","units":"A rms"},{"name":"phase_c_current","type":"float","units":"A rms"}]},{"name":"wsl_motor_voltage_vector","description":"WS LEFT Motor Voltage Vector Measurement","id":261,"endian":"little","data":[{"name":"vq","type":"float","units":"V"},{"name":"vd","type":"float","units":"V"}]},{"name":"wsl_motor_current_vector","description":"WS LEFT Motor Current Vector Measurement","id":262,"endian":"little","data":[{"name":"iq","type":"float","units":"A"},{"name":"id","type":"float","units":"A"}]},{"name":"wsl_motor_backemf","description":"WS LEFT Motor BackEMF Measurement / Prediction","id":263,"endian":"little","data":[{"name":"bemfq","type":"float","units":"V"},{"name":"bemfd","type":"float","units":"V"}]},{"name":"wsl_15_165_voltage_rail","description":"WS LEFT 15 and 1.65 Voltage Rail Measurement","id":264,"endian":"little","data":[{"name":"reference_165v","type":"float","units":"V"},{"name":"supply_15v","type":"float","units":"V"}]},{"name":"wsl_25_12_voltage_rail","description":"WS LEFT 2.5V and 1.2V Voltage Rail Measurement","id":265,"endian":"little","data":[{"name":"supply_12v","type":"float","units":"V"},{"name":"supply_25v","type":"float","units":"V"}]},{"name":"wsl_heatsink_motor_temp","description":"WS LEFT Heat-sink \u0026 Motor Temperature Measurement","id":267,"endian":"little","data":[{"name":"motor_temp","type":"float","units":"C"},{"name":"heatsink_temp","type":"float","units":"C"}]},{"name":"wsl_dsp_board_temp","description":"WS LEFT DPS Board Temperature Measurement","id":268,"endian":"little","data":[{"name":"dsp_board_temp","type":"float","units":"C"},{"name":"reserved","type":"float","units":"C"}]},{"name":"wsl_odometer_bus_amphours_measurement","description":"WS LEFT Odometer and Bus AmpHours Measurement","id":270,"endian":"little","data":[{"name":"odometer","type":"float","units":"m"},{"name":"dc_bus_amphours","type":"float","units":"Ah"}]},{"name":"wsl_reserved","description":"WS LEFT Reserved","id":269,"endian":"little","data":[{"name":"reserved0","type":"float"},{"name":"reserved1","type":"float"}]},{"name":"wsl_slip_speed_measurement","description":"WS LEFT Slip Speed Measurement","id":279,"endian":"little","data":[{"name":"reserved","type":"float","units":"C"},{"name":"slip_speed","type":"float","units":"Hz"}]}],"boards":[{"name":"bms","transmit":["bms_measurement","bms_capacity","bms_charger_response","battery_status","bms_kill_reason","bms_module_min_max","bms_soc","bms_currentlimit","bms_fan_info","bms_module"],"receive":["bms_kill","bms_wh_set","bms_ah_set","bms_set_min_fan_speed","charger_bms_request","chassis_isolation_fault"]},{"name":"bridge_board","transmit":["chassis_isolation_fault"],"receive":["bms_imd_info","battery_status"]},{"name":"charger","transmit":["charger_state","charger_bms_request","charger_power","thunderstruck_control_message"],"receive":["bms_charger_response","battery_status","bms_module_min_max","bms_measurement","charger_current_voltage","bms_capacity","thunderstruck_status_message"]},{"name":"flight_computer","transmit":["tracker_enable","vision_turn_signals_command","vision_brake_lights_command","vision_headlights_command","vision_horn_command","tritium_motor_drive_l","tritium_motor_drive_r","steering_button_colors_1","steering_button_colors_2","tritium_reset_l","tritium_reset_r","dashboard_pedal_percentages","car_state","car_speed","dashboard_pedal_fault","flight_computer_hv_board_disconnect_counts","flight_computer_lv_board_disconnect_counts","flight_computer_internal_state","power_to_drive","array_power","array_energy","distance_traveled"],"receive":["bms_module_min_max","charger_state","steering_press_count_1","steering_press_count_2","wsl_velocity","wsr_velocity","steering_horn","bms_kill_reason","bms_measurement","tracker_data","vision_status_front","vision_status_rear","wsl_odometer_bus_amphours_measurement","array_energy_reset","wsr_odometer_bus_amphours_measurement"]},{"name":"g4_example","transmit":["vision_status_front","vision_headlights_command","demo_packet"],"receive":["vision_turn_signals_command","vision_brake_lights_command","vision_headlights_command","vision_horn_command","demo_packet"]},{"name":"lights","transmit":["vision_status_front","vision_status_rear","lights_front_id","lights_back_id"],"receive":["vision_turn_signals_command","vision_brake_lights_command","vision_headlights_command","bms_kill_reason"]},{"name":"skylab2_demo","transmit":["vision_status_front","vision_headlights_command"],"receive":["vision_turn_signals_command","vision_brake_lights_command","vision_headlights_command","vision_horn_command"]},{"name":"steering","transmit":["steering_press_count_1","steering_press_count_2","steering_horn"],"receive":["steering_button_colors_1","steering_button_colors_2"]},{"name":"vision","transmit":["vision_status_front","vision_id"],"receive":["vision_turn_signals_command","vision_brake_lights_command","vision_headlights_command","vision_horn_command","vision_array_latches_command","vision_rearview_command"]}]}` diff --git a/skylab/skylab_gen_test.go b/skylab/skylab_gen_test.go index 12da8c6..1acbae6 100644 --- a/skylab/skylab_gen_test.go +++ b/skylab/skylab_gen_test.go @@ -1,10 +1,13 @@ + package skylab import ( - "encoding/json" "testing" + "reflect" + "encoding/json" ) + func TestMarshalUnmarshalBmsMeasurement(t *testing.T) { v := &BmsMeasurement{} bin, err := v.MarshalPacket() @@ -37,8 +40,25 @@ func TestJSONBmsMeasurement(t *testing.T) { default: t.Fatalf("didn't match type: %T, %v", underlying, underlying) } + } + +func TestCanFrameBmsMeasurement(t *testing.T) { + v := &BmsMeasurement{} + frame, err := ToCanFrame(v) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + + retpkt, err := FromCanFrame(frame) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + if !reflect.DeepEqual(v, retpkt) { + t.Fatalf("decoded packet did not match sent %v got %v", v, retpkt) + } +} func TestMarshalUnmarshalBatteryStatus(t *testing.T) { v := &BatteryStatus{} bin, err := v.MarshalPacket() @@ -71,8 +91,25 @@ func TestJSONBatteryStatus(t *testing.T) { default: t.Fatalf("didn't match type: %T, %v", underlying, underlying) } + } + +func TestCanFrameBatteryStatus(t *testing.T) { + v := &BatteryStatus{} + frame, err := ToCanFrame(v) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + + retpkt, err := FromCanFrame(frame) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + if !reflect.DeepEqual(v, retpkt) { + t.Fatalf("decoded packet did not match sent %v got %v", v, retpkt) + } +} func TestMarshalUnmarshalBmsKillReason(t *testing.T) { v := &BmsKillReason{} bin, err := v.MarshalPacket() @@ -105,8 +142,25 @@ func TestJSONBmsKillReason(t *testing.T) { default: t.Fatalf("didn't match type: %T, %v", underlying, underlying) } + } + +func TestCanFrameBmsKillReason(t *testing.T) { + v := &BmsKillReason{} + frame, err := ToCanFrame(v) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + + retpkt, err := FromCanFrame(frame) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + if !reflect.DeepEqual(v, retpkt) { + t.Fatalf("decoded packet did not match sent %v got %v", v, retpkt) + } +} func TestMarshalUnmarshalBmsModuleMinMax(t *testing.T) { v := &BmsModuleMinMax{} bin, err := v.MarshalPacket() @@ -139,8 +193,25 @@ func TestJSONBmsModuleMinMax(t *testing.T) { default: t.Fatalf("didn't match type: %T, %v", underlying, underlying) } + } + +func TestCanFrameBmsModuleMinMax(t *testing.T) { + v := &BmsModuleMinMax{} + frame, err := ToCanFrame(v) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + + retpkt, err := FromCanFrame(frame) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + if !reflect.DeepEqual(v, retpkt) { + t.Fatalf("decoded packet did not match sent %v got %v", v, retpkt) + } +} func TestMarshalUnmarshalBmsSoc(t *testing.T) { v := &BmsSoc{} bin, err := v.MarshalPacket() @@ -173,8 +244,25 @@ func TestJSONBmsSoc(t *testing.T) { default: t.Fatalf("didn't match type: %T, %v", underlying, underlying) } + } + +func TestCanFrameBmsSoc(t *testing.T) { + v := &BmsSoc{} + frame, err := ToCanFrame(v) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + + retpkt, err := FromCanFrame(frame) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + if !reflect.DeepEqual(v, retpkt) { + t.Fatalf("decoded packet did not match sent %v got %v", v, retpkt) + } +} func TestMarshalUnmarshalBmsCapacity(t *testing.T) { v := &BmsCapacity{} bin, err := v.MarshalPacket() @@ -207,8 +295,25 @@ func TestJSONBmsCapacity(t *testing.T) { default: t.Fatalf("didn't match type: %T, %v", underlying, underlying) } + } + +func TestCanFrameBmsCapacity(t *testing.T) { + v := &BmsCapacity{} + frame, err := ToCanFrame(v) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + + retpkt, err := FromCanFrame(frame) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + if !reflect.DeepEqual(v, retpkt) { + t.Fatalf("decoded packet did not match sent %v got %v", v, retpkt) + } +} func TestMarshalUnmarshalBmsCurrentlimit(t *testing.T) { v := &BmsCurrentlimit{} bin, err := v.MarshalPacket() @@ -241,8 +346,25 @@ func TestJSONBmsCurrentlimit(t *testing.T) { default: t.Fatalf("didn't match type: %T, %v", underlying, underlying) } + } + +func TestCanFrameBmsCurrentlimit(t *testing.T) { + v := &BmsCurrentlimit{} + frame, err := ToCanFrame(v) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + + retpkt, err := FromCanFrame(frame) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + if !reflect.DeepEqual(v, retpkt) { + t.Fatalf("decoded packet did not match sent %v got %v", v, retpkt) + } +} func TestMarshalUnmarshalBmsFanInfo(t *testing.T) { v := &BmsFanInfo{} bin, err := v.MarshalPacket() @@ -275,8 +397,25 @@ func TestJSONBmsFanInfo(t *testing.T) { default: t.Fatalf("didn't match type: %T, %v", underlying, underlying) } + } + +func TestCanFrameBmsFanInfo(t *testing.T) { + v := &BmsFanInfo{} + frame, err := ToCanFrame(v) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + + retpkt, err := FromCanFrame(frame) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + if !reflect.DeepEqual(v, retpkt) { + t.Fatalf("decoded packet did not match sent %v got %v", v, retpkt) + } +} func TestMarshalUnmarshalBmsSetMinFanSpeed(t *testing.T) { v := &BmsSetMinFanSpeed{} bin, err := v.MarshalPacket() @@ -309,8 +448,25 @@ func TestJSONBmsSetMinFanSpeed(t *testing.T) { default: t.Fatalf("didn't match type: %T, %v", underlying, underlying) } + } + +func TestCanFrameBmsSetMinFanSpeed(t *testing.T) { + v := &BmsSetMinFanSpeed{} + frame, err := ToCanFrame(v) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + + retpkt, err := FromCanFrame(frame) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + if !reflect.DeepEqual(v, retpkt) { + t.Fatalf("decoded packet did not match sent %v got %v", v, retpkt) + } +} func TestMarshalUnmarshalBmsModule(t *testing.T) { v := &BmsModule{} bin, err := v.MarshalPacket() @@ -343,8 +499,25 @@ func TestJSONBmsModule(t *testing.T) { default: t.Fatalf("didn't match type: %T, %v", underlying, underlying) } + } + +func TestCanFrameBmsModule(t *testing.T) { + v := &BmsModule{} + frame, err := ToCanFrame(v) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + + retpkt, err := FromCanFrame(frame) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + if !reflect.DeepEqual(v, retpkt) { + t.Fatalf("decoded packet did not match sent %v got %v", v, retpkt) + } +} func TestMarshalUnmarshalBmsChargerResponse(t *testing.T) { v := &BmsChargerResponse{} bin, err := v.MarshalPacket() @@ -377,8 +550,25 @@ func TestJSONBmsChargerResponse(t *testing.T) { default: t.Fatalf("didn't match type: %T, %v", underlying, underlying) } + } + +func TestCanFrameBmsChargerResponse(t *testing.T) { + v := &BmsChargerResponse{} + frame, err := ToCanFrame(v) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + + retpkt, err := FromCanFrame(frame) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + if !reflect.DeepEqual(v, retpkt) { + t.Fatalf("decoded packet did not match sent %v got %v", v, retpkt) + } +} func TestMarshalUnmarshalChassisIsolationFault(t *testing.T) { v := &ChassisIsolationFault{} bin, err := v.MarshalPacket() @@ -411,8 +601,25 @@ func TestJSONChassisIsolationFault(t *testing.T) { default: t.Fatalf("didn't match type: %T, %v", underlying, underlying) } + } + +func TestCanFrameChassisIsolationFault(t *testing.T) { + v := &ChassisIsolationFault{} + frame, err := ToCanFrame(v) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + + retpkt, err := FromCanFrame(frame) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + if !reflect.DeepEqual(v, retpkt) { + t.Fatalf("decoded packet did not match sent %v got %v", v, retpkt) + } +} func TestMarshalUnmarshalBmsImdInfo(t *testing.T) { v := &BmsImdInfo{} bin, err := v.MarshalPacket() @@ -445,8 +652,25 @@ func TestJSONBmsImdInfo(t *testing.T) { default: t.Fatalf("didn't match type: %T, %v", underlying, underlying) } + } + +func TestCanFrameBmsImdInfo(t *testing.T) { + v := &BmsImdInfo{} + frame, err := ToCanFrame(v) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + + retpkt, err := FromCanFrame(frame) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + if !reflect.DeepEqual(v, retpkt) { + t.Fatalf("decoded packet did not match sent %v got %v", v, retpkt) + } +} func TestMarshalUnmarshalDashboardPedalPercentages(t *testing.T) { v := &DashboardPedalPercentages{} bin, err := v.MarshalPacket() @@ -479,8 +703,25 @@ func TestJSONDashboardPedalPercentages(t *testing.T) { default: t.Fatalf("didn't match type: %T, %v", underlying, underlying) } + } + +func TestCanFrameDashboardPedalPercentages(t *testing.T) { + v := &DashboardPedalPercentages{} + frame, err := ToCanFrame(v) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + + retpkt, err := FromCanFrame(frame) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + if !reflect.DeepEqual(v, retpkt) { + t.Fatalf("decoded packet did not match sent %v got %v", v, retpkt) + } +} func TestMarshalUnmarshalCarState(t *testing.T) { v := &CarState{} bin, err := v.MarshalPacket() @@ -513,8 +754,25 @@ func TestJSONCarState(t *testing.T) { default: t.Fatalf("didn't match type: %T, %v", underlying, underlying) } + } + +func TestCanFrameCarState(t *testing.T) { + v := &CarState{} + frame, err := ToCanFrame(v) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + + retpkt, err := FromCanFrame(frame) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + if !reflect.DeepEqual(v, retpkt) { + t.Fatalf("decoded packet did not match sent %v got %v", v, retpkt) + } +} func TestMarshalUnmarshalDashboardPedalFault(t *testing.T) { v := &DashboardPedalFault{} bin, err := v.MarshalPacket() @@ -547,8 +805,25 @@ func TestJSONDashboardPedalFault(t *testing.T) { default: t.Fatalf("didn't match type: %T, %v", underlying, underlying) } + } + +func TestCanFrameDashboardPedalFault(t *testing.T) { + v := &DashboardPedalFault{} + frame, err := ToCanFrame(v) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + + retpkt, err := FromCanFrame(frame) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + if !reflect.DeepEqual(v, retpkt) { + t.Fatalf("decoded packet did not match sent %v got %v", v, retpkt) + } +} func TestMarshalUnmarshalDashboardSystemTimeoutTest(t *testing.T) { v := &DashboardSystemTimeoutTest{} bin, err := v.MarshalPacket() @@ -581,8 +856,25 @@ func TestJSONDashboardSystemTimeoutTest(t *testing.T) { default: t.Fatalf("didn't match type: %T, %v", underlying, underlying) } + } + +func TestCanFrameDashboardSystemTimeoutTest(t *testing.T) { + v := &DashboardSystemTimeoutTest{} + frame, err := ToCanFrame(v) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + + retpkt, err := FromCanFrame(frame) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + if !reflect.DeepEqual(v, retpkt) { + t.Fatalf("decoded packet did not match sent %v got %v", v, retpkt) + } +} func TestMarshalUnmarshalCarSpeed(t *testing.T) { v := &CarSpeed{} bin, err := v.MarshalPacket() @@ -615,8 +907,25 @@ func TestJSONCarSpeed(t *testing.T) { default: t.Fatalf("didn't match type: %T, %v", underlying, underlying) } + } + +func TestCanFrameCarSpeed(t *testing.T) { + v := &CarSpeed{} + frame, err := ToCanFrame(v) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + + retpkt, err := FromCanFrame(frame) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + if !reflect.DeepEqual(v, retpkt) { + t.Fatalf("decoded packet did not match sent %v got %v", v, retpkt) + } +} func TestMarshalUnmarshalFlightComputerLvBoardDisconnectCounts(t *testing.T) { v := &FlightComputerLvBoardDisconnectCounts{} bin, err := v.MarshalPacket() @@ -649,8 +958,25 @@ func TestJSONFlightComputerLvBoardDisconnectCounts(t *testing.T) { default: t.Fatalf("didn't match type: %T, %v", underlying, underlying) } + } + +func TestCanFrameFlightComputerLvBoardDisconnectCounts(t *testing.T) { + v := &FlightComputerLvBoardDisconnectCounts{} + frame, err := ToCanFrame(v) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + + retpkt, err := FromCanFrame(frame) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + if !reflect.DeepEqual(v, retpkt) { + t.Fatalf("decoded packet did not match sent %v got %v", v, retpkt) + } +} func TestMarshalUnmarshalFlightComputerHvBoardDisconnectCounts(t *testing.T) { v := &FlightComputerHvBoardDisconnectCounts{} bin, err := v.MarshalPacket() @@ -683,8 +1009,25 @@ func TestJSONFlightComputerHvBoardDisconnectCounts(t *testing.T) { default: t.Fatalf("didn't match type: %T, %v", underlying, underlying) } + } + +func TestCanFrameFlightComputerHvBoardDisconnectCounts(t *testing.T) { + v := &FlightComputerHvBoardDisconnectCounts{} + frame, err := ToCanFrame(v) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + + retpkt, err := FromCanFrame(frame) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + if !reflect.DeepEqual(v, retpkt) { + t.Fatalf("decoded packet did not match sent %v got %v", v, retpkt) + } +} func TestMarshalUnmarshalFlightComputerInternalState(t *testing.T) { v := &FlightComputerInternalState{} bin, err := v.MarshalPacket() @@ -717,8 +1060,25 @@ func TestJSONFlightComputerInternalState(t *testing.T) { default: t.Fatalf("didn't match type: %T, %v", underlying, underlying) } + } + +func TestCanFrameFlightComputerInternalState(t *testing.T) { + v := &FlightComputerInternalState{} + frame, err := ToCanFrame(v) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + + retpkt, err := FromCanFrame(frame) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + if !reflect.DeepEqual(v, retpkt) { + t.Fatalf("decoded packet did not match sent %v got %v", v, retpkt) + } +} func TestMarshalUnmarshalPowerToDrive(t *testing.T) { v := &PowerToDrive{} bin, err := v.MarshalPacket() @@ -751,8 +1111,25 @@ func TestJSONPowerToDrive(t *testing.T) { default: t.Fatalf("didn't match type: %T, %v", underlying, underlying) } + } + +func TestCanFramePowerToDrive(t *testing.T) { + v := &PowerToDrive{} + frame, err := ToCanFrame(v) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + + retpkt, err := FromCanFrame(frame) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + if !reflect.DeepEqual(v, retpkt) { + t.Fatalf("decoded packet did not match sent %v got %v", v, retpkt) + } +} func TestMarshalUnmarshalArrayPower(t *testing.T) { v := &ArrayPower{} bin, err := v.MarshalPacket() @@ -785,8 +1162,25 @@ func TestJSONArrayPower(t *testing.T) { default: t.Fatalf("didn't match type: %T, %v", underlying, underlying) } + } + +func TestCanFrameArrayPower(t *testing.T) { + v := &ArrayPower{} + frame, err := ToCanFrame(v) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + + retpkt, err := FromCanFrame(frame) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + if !reflect.DeepEqual(v, retpkt) { + t.Fatalf("decoded packet did not match sent %v got %v", v, retpkt) + } +} func TestMarshalUnmarshalArrayEnergy(t *testing.T) { v := &ArrayEnergy{} bin, err := v.MarshalPacket() @@ -819,8 +1213,25 @@ func TestJSONArrayEnergy(t *testing.T) { default: t.Fatalf("didn't match type: %T, %v", underlying, underlying) } + } + +func TestCanFrameArrayEnergy(t *testing.T) { + v := &ArrayEnergy{} + frame, err := ToCanFrame(v) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + + retpkt, err := FromCanFrame(frame) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + if !reflect.DeepEqual(v, retpkt) { + t.Fatalf("decoded packet did not match sent %v got %v", v, retpkt) + } +} func TestMarshalUnmarshalArrayEnergyReset(t *testing.T) { v := &ArrayEnergyReset{} bin, err := v.MarshalPacket() @@ -853,8 +1264,25 @@ func TestJSONArrayEnergyReset(t *testing.T) { default: t.Fatalf("didn't match type: %T, %v", underlying, underlying) } + } + +func TestCanFrameArrayEnergyReset(t *testing.T) { + v := &ArrayEnergyReset{} + frame, err := ToCanFrame(v) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + + retpkt, err := FromCanFrame(frame) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + if !reflect.DeepEqual(v, retpkt) { + t.Fatalf("decoded packet did not match sent %v got %v", v, retpkt) + } +} func TestMarshalUnmarshalVisionTurnSignalsCommand(t *testing.T) { v := &VisionTurnSignalsCommand{} bin, err := v.MarshalPacket() @@ -887,8 +1315,25 @@ func TestJSONVisionTurnSignalsCommand(t *testing.T) { default: t.Fatalf("didn't match type: %T, %v", underlying, underlying) } + } + +func TestCanFrameVisionTurnSignalsCommand(t *testing.T) { + v := &VisionTurnSignalsCommand{} + frame, err := ToCanFrame(v) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + + retpkt, err := FromCanFrame(frame) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + if !reflect.DeepEqual(v, retpkt) { + t.Fatalf("decoded packet did not match sent %v got %v", v, retpkt) + } +} func TestMarshalUnmarshalVisionBrakeLightsCommand(t *testing.T) { v := &VisionBrakeLightsCommand{} bin, err := v.MarshalPacket() @@ -921,8 +1366,25 @@ func TestJSONVisionBrakeLightsCommand(t *testing.T) { default: t.Fatalf("didn't match type: %T, %v", underlying, underlying) } + } + +func TestCanFrameVisionBrakeLightsCommand(t *testing.T) { + v := &VisionBrakeLightsCommand{} + frame, err := ToCanFrame(v) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + + retpkt, err := FromCanFrame(frame) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + if !reflect.DeepEqual(v, retpkt) { + t.Fatalf("decoded packet did not match sent %v got %v", v, retpkt) + } +} func TestMarshalUnmarshalVisionHeadlightsCommand(t *testing.T) { v := &VisionHeadlightsCommand{} bin, err := v.MarshalPacket() @@ -955,8 +1417,25 @@ func TestJSONVisionHeadlightsCommand(t *testing.T) { default: t.Fatalf("didn't match type: %T, %v", underlying, underlying) } + } + +func TestCanFrameVisionHeadlightsCommand(t *testing.T) { + v := &VisionHeadlightsCommand{} + frame, err := ToCanFrame(v) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + + retpkt, err := FromCanFrame(frame) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + if !reflect.DeepEqual(v, retpkt) { + t.Fatalf("decoded packet did not match sent %v got %v", v, retpkt) + } +} func TestMarshalUnmarshalVisionHornCommand(t *testing.T) { v := &VisionHornCommand{} bin, err := v.MarshalPacket() @@ -989,8 +1468,25 @@ func TestJSONVisionHornCommand(t *testing.T) { default: t.Fatalf("didn't match type: %T, %v", underlying, underlying) } + } + +func TestCanFrameVisionHornCommand(t *testing.T) { + v := &VisionHornCommand{} + frame, err := ToCanFrame(v) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + + retpkt, err := FromCanFrame(frame) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + if !reflect.DeepEqual(v, retpkt) { + t.Fatalf("decoded packet did not match sent %v got %v", v, retpkt) + } +} func TestMarshalUnmarshalVisionArrayLatchesCommand(t *testing.T) { v := &VisionArrayLatchesCommand{} bin, err := v.MarshalPacket() @@ -1023,8 +1519,25 @@ func TestJSONVisionArrayLatchesCommand(t *testing.T) { default: t.Fatalf("didn't match type: %T, %v", underlying, underlying) } + } + +func TestCanFrameVisionArrayLatchesCommand(t *testing.T) { + v := &VisionArrayLatchesCommand{} + frame, err := ToCanFrame(v) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + + retpkt, err := FromCanFrame(frame) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + if !reflect.DeepEqual(v, retpkt) { + t.Fatalf("decoded packet did not match sent %v got %v", v, retpkt) + } +} func TestMarshalUnmarshalVisionRearviewCommand(t *testing.T) { v := &VisionRearviewCommand{} bin, err := v.MarshalPacket() @@ -1057,8 +1570,25 @@ func TestJSONVisionRearviewCommand(t *testing.T) { default: t.Fatalf("didn't match type: %T, %v", underlying, underlying) } + } + +func TestCanFrameVisionRearviewCommand(t *testing.T) { + v := &VisionRearviewCommand{} + frame, err := ToCanFrame(v) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + + retpkt, err := FromCanFrame(frame) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + if !reflect.DeepEqual(v, retpkt) { + t.Fatalf("decoded packet did not match sent %v got %v", v, retpkt) + } +} func TestMarshalUnmarshalTrackerEnable(t *testing.T) { v := &TrackerEnable{} bin, err := v.MarshalPacket() @@ -1091,8 +1621,25 @@ func TestJSONTrackerEnable(t *testing.T) { default: t.Fatalf("didn't match type: %T, %v", underlying, underlying) } + } + +func TestCanFrameTrackerEnable(t *testing.T) { + v := &TrackerEnable{} + frame, err := ToCanFrame(v) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + + retpkt, err := FromCanFrame(frame) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + if !reflect.DeepEqual(v, retpkt) { + t.Fatalf("decoded packet did not match sent %v got %v", v, retpkt) + } +} func TestMarshalUnmarshalDistanceTraveled(t *testing.T) { v := &DistanceTraveled{} bin, err := v.MarshalPacket() @@ -1125,8 +1672,25 @@ func TestJSONDistanceTraveled(t *testing.T) { default: t.Fatalf("didn't match type: %T, %v", underlying, underlying) } + } + +func TestCanFrameDistanceTraveled(t *testing.T) { + v := &DistanceTraveled{} + frame, err := ToCanFrame(v) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + + retpkt, err := FromCanFrame(frame) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + if !reflect.DeepEqual(v, retpkt) { + t.Fatalf("decoded packet did not match sent %v got %v", v, retpkt) + } +} func TestMarshalUnmarshalChargerState(t *testing.T) { v := &ChargerState{} bin, err := v.MarshalPacket() @@ -1159,8 +1723,25 @@ func TestJSONChargerState(t *testing.T) { default: t.Fatalf("didn't match type: %T, %v", underlying, underlying) } + } + +func TestCanFrameChargerState(t *testing.T) { + v := &ChargerState{} + frame, err := ToCanFrame(v) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + + retpkt, err := FromCanFrame(frame) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + if !reflect.DeepEqual(v, retpkt) { + t.Fatalf("decoded packet did not match sent %v got %v", v, retpkt) + } +} func TestMarshalUnmarshalChargerBmsRequest(t *testing.T) { v := &ChargerBmsRequest{} bin, err := v.MarshalPacket() @@ -1193,8 +1774,25 @@ func TestJSONChargerBmsRequest(t *testing.T) { default: t.Fatalf("didn't match type: %T, %v", underlying, underlying) } + } + +func TestCanFrameChargerBmsRequest(t *testing.T) { + v := &ChargerBmsRequest{} + frame, err := ToCanFrame(v) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + + retpkt, err := FromCanFrame(frame) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + if !reflect.DeepEqual(v, retpkt) { + t.Fatalf("decoded packet did not match sent %v got %v", v, retpkt) + } +} func TestMarshalUnmarshalChargerCurrentVoltage(t *testing.T) { v := &ChargerCurrentVoltage{} bin, err := v.MarshalPacket() @@ -1227,8 +1825,25 @@ func TestJSONChargerCurrentVoltage(t *testing.T) { default: t.Fatalf("didn't match type: %T, %v", underlying, underlying) } + } + +func TestCanFrameChargerCurrentVoltage(t *testing.T) { + v := &ChargerCurrentVoltage{} + frame, err := ToCanFrame(v) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + + retpkt, err := FromCanFrame(frame) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + if !reflect.DeepEqual(v, retpkt) { + t.Fatalf("decoded packet did not match sent %v got %v", v, retpkt) + } +} func TestMarshalUnmarshalChargerPower(t *testing.T) { v := &ChargerPower{} bin, err := v.MarshalPacket() @@ -1261,8 +1876,25 @@ func TestJSONChargerPower(t *testing.T) { default: t.Fatalf("didn't match type: %T, %v", underlying, underlying) } + } + +func TestCanFrameChargerPower(t *testing.T) { + v := &ChargerPower{} + frame, err := ToCanFrame(v) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + + retpkt, err := FromCanFrame(frame) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + if !reflect.DeepEqual(v, retpkt) { + t.Fatalf("decoded packet did not match sent %v got %v", v, retpkt) + } +} func TestMarshalUnmarshalThunderstruckControlMessage(t *testing.T) { v := &ThunderstruckControlMessage{} bin, err := v.MarshalPacket() @@ -1295,8 +1927,25 @@ func TestJSONThunderstruckControlMessage(t *testing.T) { default: t.Fatalf("didn't match type: %T, %v", underlying, underlying) } + } + +func TestCanFrameThunderstruckControlMessage(t *testing.T) { + v := &ThunderstruckControlMessage{} + frame, err := ToCanFrame(v) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + + retpkt, err := FromCanFrame(frame) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + if !reflect.DeepEqual(v, retpkt) { + t.Fatalf("decoded packet did not match sent %v got %v", v, retpkt) + } +} func TestMarshalUnmarshalVisionStatusFront(t *testing.T) { v := &VisionStatusFront{} bin, err := v.MarshalPacket() @@ -1329,8 +1978,25 @@ func TestJSONVisionStatusFront(t *testing.T) { default: t.Fatalf("didn't match type: %T, %v", underlying, underlying) } + } + +func TestCanFrameVisionStatusFront(t *testing.T) { + v := &VisionStatusFront{} + frame, err := ToCanFrame(v) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + + retpkt, err := FromCanFrame(frame) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + if !reflect.DeepEqual(v, retpkt) { + t.Fatalf("decoded packet did not match sent %v got %v", v, retpkt) + } +} func TestMarshalUnmarshalVisionStatusRear(t *testing.T) { v := &VisionStatusRear{} bin, err := v.MarshalPacket() @@ -1363,8 +2029,25 @@ func TestJSONVisionStatusRear(t *testing.T) { default: t.Fatalf("didn't match type: %T, %v", underlying, underlying) } + } + +func TestCanFrameVisionStatusRear(t *testing.T) { + v := &VisionStatusRear{} + frame, err := ToCanFrame(v) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + + retpkt, err := FromCanFrame(frame) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + if !reflect.DeepEqual(v, retpkt) { + t.Fatalf("decoded packet did not match sent %v got %v", v, retpkt) + } +} func TestMarshalUnmarshalLightsFrontId(t *testing.T) { v := &LightsFrontId{} bin, err := v.MarshalPacket() @@ -1397,8 +2080,25 @@ func TestJSONLightsFrontId(t *testing.T) { default: t.Fatalf("didn't match type: %T, %v", underlying, underlying) } + } + +func TestCanFrameLightsFrontId(t *testing.T) { + v := &LightsFrontId{} + frame, err := ToCanFrame(v) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + + retpkt, err := FromCanFrame(frame) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + if !reflect.DeepEqual(v, retpkt) { + t.Fatalf("decoded packet did not match sent %v got %v", v, retpkt) + } +} func TestMarshalUnmarshalLightsBackId(t *testing.T) { v := &LightsBackId{} bin, err := v.MarshalPacket() @@ -1431,8 +2131,25 @@ func TestJSONLightsBackId(t *testing.T) { default: t.Fatalf("didn't match type: %T, %v", underlying, underlying) } + } + +func TestCanFrameLightsBackId(t *testing.T) { + v := &LightsBackId{} + frame, err := ToCanFrame(v) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + + retpkt, err := FromCanFrame(frame) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + if !reflect.DeepEqual(v, retpkt) { + t.Fatalf("decoded packet did not match sent %v got %v", v, retpkt) + } +} func TestMarshalUnmarshalVisionId(t *testing.T) { v := &VisionId{} bin, err := v.MarshalPacket() @@ -1465,8 +2182,25 @@ func TestJSONVisionId(t *testing.T) { default: t.Fatalf("didn't match type: %T, %v", underlying, underlying) } + } + +func TestCanFrameVisionId(t *testing.T) { + v := &VisionId{} + frame, err := ToCanFrame(v) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + + retpkt, err := FromCanFrame(frame) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + if !reflect.DeepEqual(v, retpkt) { + t.Fatalf("decoded packet did not match sent %v got %v", v, retpkt) + } +} func TestMarshalUnmarshalSteeringPressCount1(t *testing.T) { v := &SteeringPressCount1{} bin, err := v.MarshalPacket() @@ -1499,8 +2233,25 @@ func TestJSONSteeringPressCount1(t *testing.T) { default: t.Fatalf("didn't match type: %T, %v", underlying, underlying) } + } + +func TestCanFrameSteeringPressCount1(t *testing.T) { + v := &SteeringPressCount1{} + frame, err := ToCanFrame(v) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + + retpkt, err := FromCanFrame(frame) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + if !reflect.DeepEqual(v, retpkt) { + t.Fatalf("decoded packet did not match sent %v got %v", v, retpkt) + } +} func TestMarshalUnmarshalSteeringPressCount2(t *testing.T) { v := &SteeringPressCount2{} bin, err := v.MarshalPacket() @@ -1533,8 +2284,25 @@ func TestJSONSteeringPressCount2(t *testing.T) { default: t.Fatalf("didn't match type: %T, %v", underlying, underlying) } + } + +func TestCanFrameSteeringPressCount2(t *testing.T) { + v := &SteeringPressCount2{} + frame, err := ToCanFrame(v) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + + retpkt, err := FromCanFrame(frame) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + if !reflect.DeepEqual(v, retpkt) { + t.Fatalf("decoded packet did not match sent %v got %v", v, retpkt) + } +} func TestMarshalUnmarshalSteeringButtonColors1(t *testing.T) { v := &SteeringButtonColors1{} bin, err := v.MarshalPacket() @@ -1567,8 +2335,25 @@ func TestJSONSteeringButtonColors1(t *testing.T) { default: t.Fatalf("didn't match type: %T, %v", underlying, underlying) } + } + +func TestCanFrameSteeringButtonColors1(t *testing.T) { + v := &SteeringButtonColors1{} + frame, err := ToCanFrame(v) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + + retpkt, err := FromCanFrame(frame) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + if !reflect.DeepEqual(v, retpkt) { + t.Fatalf("decoded packet did not match sent %v got %v", v, retpkt) + } +} func TestMarshalUnmarshalSteeringButtonColors2(t *testing.T) { v := &SteeringButtonColors2{} bin, err := v.MarshalPacket() @@ -1601,8 +2386,25 @@ func TestJSONSteeringButtonColors2(t *testing.T) { default: t.Fatalf("didn't match type: %T, %v", underlying, underlying) } + } + +func TestCanFrameSteeringButtonColors2(t *testing.T) { + v := &SteeringButtonColors2{} + frame, err := ToCanFrame(v) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + + retpkt, err := FromCanFrame(frame) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + if !reflect.DeepEqual(v, retpkt) { + t.Fatalf("decoded packet did not match sent %v got %v", v, retpkt) + } +} func TestMarshalUnmarshalSteeringHorn(t *testing.T) { v := &SteeringHorn{} bin, err := v.MarshalPacket() @@ -1635,8 +2437,25 @@ func TestJSONSteeringHorn(t *testing.T) { default: t.Fatalf("didn't match type: %T, %v", underlying, underlying) } + } + +func TestCanFrameSteeringHorn(t *testing.T) { + v := &SteeringHorn{} + frame, err := ToCanFrame(v) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + + retpkt, err := FromCanFrame(frame) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + if !reflect.DeepEqual(v, retpkt) { + t.Fatalf("decoded packet did not match sent %v got %v", v, retpkt) + } +} func TestMarshalUnmarshalThunderstruckStatusMessage(t *testing.T) { v := &ThunderstruckStatusMessage{} bin, err := v.MarshalPacket() @@ -1669,8 +2488,25 @@ func TestJSONThunderstruckStatusMessage(t *testing.T) { default: t.Fatalf("didn't match type: %T, %v", underlying, underlying) } + } + +func TestCanFrameThunderstruckStatusMessage(t *testing.T) { + v := &ThunderstruckStatusMessage{} + frame, err := ToCanFrame(v) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + + retpkt, err := FromCanFrame(frame) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + if !reflect.DeepEqual(v, retpkt) { + t.Fatalf("decoded packet did not match sent %v got %v", v, retpkt) + } +} func TestMarshalUnmarshalTrackerData(t *testing.T) { v := &TrackerData{} bin, err := v.MarshalPacket() @@ -1703,8 +2539,25 @@ func TestJSONTrackerData(t *testing.T) { default: t.Fatalf("didn't match type: %T, %v", underlying, underlying) } + } + +func TestCanFrameTrackerData(t *testing.T) { + v := &TrackerData{} + frame, err := ToCanFrame(v) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + + retpkt, err := FromCanFrame(frame) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + if !reflect.DeepEqual(v, retpkt) { + t.Fatalf("decoded packet did not match sent %v got %v", v, retpkt) + } +} func TestMarshalUnmarshalTritiumMotorDriveL(t *testing.T) { v := &TritiumMotorDriveL{} bin, err := v.MarshalPacket() @@ -1737,8 +2590,25 @@ func TestJSONTritiumMotorDriveL(t *testing.T) { default: t.Fatalf("didn't match type: %T, %v", underlying, underlying) } + } + +func TestCanFrameTritiumMotorDriveL(t *testing.T) { + v := &TritiumMotorDriveL{} + frame, err := ToCanFrame(v) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + + retpkt, err := FromCanFrame(frame) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + if !reflect.DeepEqual(v, retpkt) { + t.Fatalf("decoded packet did not match sent %v got %v", v, retpkt) + } +} func TestMarshalUnmarshalTritiumMotorPowerL(t *testing.T) { v := &TritiumMotorPowerL{} bin, err := v.MarshalPacket() @@ -1771,8 +2641,25 @@ func TestJSONTritiumMotorPowerL(t *testing.T) { default: t.Fatalf("didn't match type: %T, %v", underlying, underlying) } + } + +func TestCanFrameTritiumMotorPowerL(t *testing.T) { + v := &TritiumMotorPowerL{} + frame, err := ToCanFrame(v) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + + retpkt, err := FromCanFrame(frame) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + if !reflect.DeepEqual(v, retpkt) { + t.Fatalf("decoded packet did not match sent %v got %v", v, retpkt) + } +} func TestMarshalUnmarshalTritiumResetL(t *testing.T) { v := &TritiumResetL{} bin, err := v.MarshalPacket() @@ -1805,8 +2692,25 @@ func TestJSONTritiumResetL(t *testing.T) { default: t.Fatalf("didn't match type: %T, %v", underlying, underlying) } + } + +func TestCanFrameTritiumResetL(t *testing.T) { + v := &TritiumResetL{} + frame, err := ToCanFrame(v) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + + retpkt, err := FromCanFrame(frame) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + if !reflect.DeepEqual(v, retpkt) { + t.Fatalf("decoded packet did not match sent %v got %v", v, retpkt) + } +} func TestMarshalUnmarshalTritiumMotorDriveR(t *testing.T) { v := &TritiumMotorDriveR{} bin, err := v.MarshalPacket() @@ -1839,8 +2743,25 @@ func TestJSONTritiumMotorDriveR(t *testing.T) { default: t.Fatalf("didn't match type: %T, %v", underlying, underlying) } + } + +func TestCanFrameTritiumMotorDriveR(t *testing.T) { + v := &TritiumMotorDriveR{} + frame, err := ToCanFrame(v) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + + retpkt, err := FromCanFrame(frame) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + if !reflect.DeepEqual(v, retpkt) { + t.Fatalf("decoded packet did not match sent %v got %v", v, retpkt) + } +} func TestMarshalUnmarshalTritiumMotorPowerR(t *testing.T) { v := &TritiumMotorPowerR{} bin, err := v.MarshalPacket() @@ -1873,8 +2794,25 @@ func TestJSONTritiumMotorPowerR(t *testing.T) { default: t.Fatalf("didn't match type: %T, %v", underlying, underlying) } + } + +func TestCanFrameTritiumMotorPowerR(t *testing.T) { + v := &TritiumMotorPowerR{} + frame, err := ToCanFrame(v) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + + retpkt, err := FromCanFrame(frame) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + if !reflect.DeepEqual(v, retpkt) { + t.Fatalf("decoded packet did not match sent %v got %v", v, retpkt) + } +} func TestMarshalUnmarshalTritiumResetR(t *testing.T) { v := &TritiumResetR{} bin, err := v.MarshalPacket() @@ -1907,8 +2845,25 @@ func TestJSONTritiumResetR(t *testing.T) { default: t.Fatalf("didn't match type: %T, %v", underlying, underlying) } + } + +func TestCanFrameTritiumResetR(t *testing.T) { + v := &TritiumResetR{} + frame, err := ToCanFrame(v) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + + retpkt, err := FromCanFrame(frame) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + if !reflect.DeepEqual(v, retpkt) { + t.Fatalf("decoded packet did not match sent %v got %v", v, retpkt) + } +} func TestMarshalUnmarshalBmsAhSet(t *testing.T) { v := &BmsAhSet{} bin, err := v.MarshalPacket() @@ -1941,8 +2896,25 @@ func TestJSONBmsAhSet(t *testing.T) { default: t.Fatalf("didn't match type: %T, %v", underlying, underlying) } + } + +func TestCanFrameBmsAhSet(t *testing.T) { + v := &BmsAhSet{} + frame, err := ToCanFrame(v) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + + retpkt, err := FromCanFrame(frame) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + if !reflect.DeepEqual(v, retpkt) { + t.Fatalf("decoded packet did not match sent %v got %v", v, retpkt) + } +} func TestMarshalUnmarshalBmsWhSet(t *testing.T) { v := &BmsWhSet{} bin, err := v.MarshalPacket() @@ -1975,8 +2947,25 @@ func TestJSONBmsWhSet(t *testing.T) { default: t.Fatalf("didn't match type: %T, %v", underlying, underlying) } + } + +func TestCanFrameBmsWhSet(t *testing.T) { + v := &BmsWhSet{} + frame, err := ToCanFrame(v) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + + retpkt, err := FromCanFrame(frame) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + if !reflect.DeepEqual(v, retpkt) { + t.Fatalf("decoded packet did not match sent %v got %v", v, retpkt) + } +} func TestMarshalUnmarshalBmsKill(t *testing.T) { v := &BmsKill{} bin, err := v.MarshalPacket() @@ -2009,8 +2998,25 @@ func TestJSONBmsKill(t *testing.T) { default: t.Fatalf("didn't match type: %T, %v", underlying, underlying) } + } + +func TestCanFrameBmsKill(t *testing.T) { + v := &BmsKill{} + frame, err := ToCanFrame(v) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + + retpkt, err := FromCanFrame(frame) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + if !reflect.DeepEqual(v, retpkt) { + t.Fatalf("decoded packet did not match sent %v got %v", v, retpkt) + } +} func TestMarshalUnmarshalTelemetryRtcReset(t *testing.T) { v := &TelemetryRtcReset{} bin, err := v.MarshalPacket() @@ -2043,8 +3049,25 @@ func TestJSONTelemetryRtcReset(t *testing.T) { default: t.Fatalf("didn't match type: %T, %v", underlying, underlying) } + } + +func TestCanFrameTelemetryRtcReset(t *testing.T) { + v := &TelemetryRtcReset{} + frame, err := ToCanFrame(v) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + + retpkt, err := FromCanFrame(frame) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + if !reflect.DeepEqual(v, retpkt) { + t.Fatalf("decoded packet did not match sent %v got %v", v, retpkt) + } +} func TestMarshalUnmarshalWsrIdentification(t *testing.T) { v := &WsrIdentification{} bin, err := v.MarshalPacket() @@ -2077,8 +3100,25 @@ func TestJSONWsrIdentification(t *testing.T) { default: t.Fatalf("didn't match type: %T, %v", underlying, underlying) } + } + +func TestCanFrameWsrIdentification(t *testing.T) { + v := &WsrIdentification{} + frame, err := ToCanFrame(v) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + + retpkt, err := FromCanFrame(frame) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + if !reflect.DeepEqual(v, retpkt) { + t.Fatalf("decoded packet did not match sent %v got %v", v, retpkt) + } +} func TestMarshalUnmarshalWsrStatusInformation(t *testing.T) { v := &WsrStatusInformation{} bin, err := v.MarshalPacket() @@ -2111,8 +3151,25 @@ func TestJSONWsrStatusInformation(t *testing.T) { default: t.Fatalf("didn't match type: %T, %v", underlying, underlying) } + } + +func TestCanFrameWsrStatusInformation(t *testing.T) { + v := &WsrStatusInformation{} + frame, err := ToCanFrame(v) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + + retpkt, err := FromCanFrame(frame) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + if !reflect.DeepEqual(v, retpkt) { + t.Fatalf("decoded packet did not match sent %v got %v", v, retpkt) + } +} func TestMarshalUnmarshalWsrBusMeasurement(t *testing.T) { v := &WsrBusMeasurement{} bin, err := v.MarshalPacket() @@ -2145,8 +3202,25 @@ func TestJSONWsrBusMeasurement(t *testing.T) { default: t.Fatalf("didn't match type: %T, %v", underlying, underlying) } + } + +func TestCanFrameWsrBusMeasurement(t *testing.T) { + v := &WsrBusMeasurement{} + frame, err := ToCanFrame(v) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + + retpkt, err := FromCanFrame(frame) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + if !reflect.DeepEqual(v, retpkt) { + t.Fatalf("decoded packet did not match sent %v got %v", v, retpkt) + } +} func TestMarshalUnmarshalWsrVelocity(t *testing.T) { v := &WsrVelocity{} bin, err := v.MarshalPacket() @@ -2179,8 +3253,25 @@ func TestJSONWsrVelocity(t *testing.T) { default: t.Fatalf("didn't match type: %T, %v", underlying, underlying) } + } + +func TestCanFrameWsrVelocity(t *testing.T) { + v := &WsrVelocity{} + frame, err := ToCanFrame(v) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + + retpkt, err := FromCanFrame(frame) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + if !reflect.DeepEqual(v, retpkt) { + t.Fatalf("decoded packet did not match sent %v got %v", v, retpkt) + } +} func TestMarshalUnmarshalWsrPhaseCurrent(t *testing.T) { v := &WsrPhaseCurrent{} bin, err := v.MarshalPacket() @@ -2213,8 +3304,25 @@ func TestJSONWsrPhaseCurrent(t *testing.T) { default: t.Fatalf("didn't match type: %T, %v", underlying, underlying) } + } + +func TestCanFrameWsrPhaseCurrent(t *testing.T) { + v := &WsrPhaseCurrent{} + frame, err := ToCanFrame(v) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + + retpkt, err := FromCanFrame(frame) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + if !reflect.DeepEqual(v, retpkt) { + t.Fatalf("decoded packet did not match sent %v got %v", v, retpkt) + } +} func TestMarshalUnmarshalWsrMotorVoltageVector(t *testing.T) { v := &WsrMotorVoltageVector{} bin, err := v.MarshalPacket() @@ -2247,8 +3355,25 @@ func TestJSONWsrMotorVoltageVector(t *testing.T) { default: t.Fatalf("didn't match type: %T, %v", underlying, underlying) } + } + +func TestCanFrameWsrMotorVoltageVector(t *testing.T) { + v := &WsrMotorVoltageVector{} + frame, err := ToCanFrame(v) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + + retpkt, err := FromCanFrame(frame) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + if !reflect.DeepEqual(v, retpkt) { + t.Fatalf("decoded packet did not match sent %v got %v", v, retpkt) + } +} func TestMarshalUnmarshalWsrMotorCurrentVector(t *testing.T) { v := &WsrMotorCurrentVector{} bin, err := v.MarshalPacket() @@ -2281,8 +3406,25 @@ func TestJSONWsrMotorCurrentVector(t *testing.T) { default: t.Fatalf("didn't match type: %T, %v", underlying, underlying) } + } + +func TestCanFrameWsrMotorCurrentVector(t *testing.T) { + v := &WsrMotorCurrentVector{} + frame, err := ToCanFrame(v) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + + retpkt, err := FromCanFrame(frame) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + if !reflect.DeepEqual(v, retpkt) { + t.Fatalf("decoded packet did not match sent %v got %v", v, retpkt) + } +} func TestMarshalUnmarshalWsrMotorBackemf(t *testing.T) { v := &WsrMotorBackemf{} bin, err := v.MarshalPacket() @@ -2315,8 +3457,25 @@ func TestJSONWsrMotorBackemf(t *testing.T) { default: t.Fatalf("didn't match type: %T, %v", underlying, underlying) } + } + +func TestCanFrameWsrMotorBackemf(t *testing.T) { + v := &WsrMotorBackemf{} + frame, err := ToCanFrame(v) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + + retpkt, err := FromCanFrame(frame) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + if !reflect.DeepEqual(v, retpkt) { + t.Fatalf("decoded packet did not match sent %v got %v", v, retpkt) + } +} func TestMarshalUnmarshalWsr15165VoltageRail(t *testing.T) { v := &Wsr15165VoltageRail{} bin, err := v.MarshalPacket() @@ -2349,8 +3508,25 @@ func TestJSONWsr15165VoltageRail(t *testing.T) { default: t.Fatalf("didn't match type: %T, %v", underlying, underlying) } + } + +func TestCanFrameWsr15165VoltageRail(t *testing.T) { + v := &Wsr15165VoltageRail{} + frame, err := ToCanFrame(v) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + + retpkt, err := FromCanFrame(frame) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + if !reflect.DeepEqual(v, retpkt) { + t.Fatalf("decoded packet did not match sent %v got %v", v, retpkt) + } +} func TestMarshalUnmarshalWsr2512VoltageRail(t *testing.T) { v := &Wsr2512VoltageRail{} bin, err := v.MarshalPacket() @@ -2383,8 +3559,25 @@ func TestJSONWsr2512VoltageRail(t *testing.T) { default: t.Fatalf("didn't match type: %T, %v", underlying, underlying) } + } + +func TestCanFrameWsr2512VoltageRail(t *testing.T) { + v := &Wsr2512VoltageRail{} + frame, err := ToCanFrame(v) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + + retpkt, err := FromCanFrame(frame) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + if !reflect.DeepEqual(v, retpkt) { + t.Fatalf("decoded packet did not match sent %v got %v", v, retpkt) + } +} func TestMarshalUnmarshalWsrHeatsinkMotorTemp(t *testing.T) { v := &WsrHeatsinkMotorTemp{} bin, err := v.MarshalPacket() @@ -2417,8 +3610,25 @@ func TestJSONWsrHeatsinkMotorTemp(t *testing.T) { default: t.Fatalf("didn't match type: %T, %v", underlying, underlying) } + } + +func TestCanFrameWsrHeatsinkMotorTemp(t *testing.T) { + v := &WsrHeatsinkMotorTemp{} + frame, err := ToCanFrame(v) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + + retpkt, err := FromCanFrame(frame) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + if !reflect.DeepEqual(v, retpkt) { + t.Fatalf("decoded packet did not match sent %v got %v", v, retpkt) + } +} func TestMarshalUnmarshalWsrDspBoardTemp(t *testing.T) { v := &WsrDspBoardTemp{} bin, err := v.MarshalPacket() @@ -2451,8 +3661,25 @@ func TestJSONWsrDspBoardTemp(t *testing.T) { default: t.Fatalf("didn't match type: %T, %v", underlying, underlying) } + } + +func TestCanFrameWsrDspBoardTemp(t *testing.T) { + v := &WsrDspBoardTemp{} + frame, err := ToCanFrame(v) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + + retpkt, err := FromCanFrame(frame) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + if !reflect.DeepEqual(v, retpkt) { + t.Fatalf("decoded packet did not match sent %v got %v", v, retpkt) + } +} func TestMarshalUnmarshalWsrReserved(t *testing.T) { v := &WsrReserved{} bin, err := v.MarshalPacket() @@ -2485,8 +3712,25 @@ func TestJSONWsrReserved(t *testing.T) { default: t.Fatalf("didn't match type: %T, %v", underlying, underlying) } + } + +func TestCanFrameWsrReserved(t *testing.T) { + v := &WsrReserved{} + frame, err := ToCanFrame(v) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + + retpkt, err := FromCanFrame(frame) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + if !reflect.DeepEqual(v, retpkt) { + t.Fatalf("decoded packet did not match sent %v got %v", v, retpkt) + } +} func TestMarshalUnmarshalWsrOdometerBusAmphoursMeasurement(t *testing.T) { v := &WsrOdometerBusAmphoursMeasurement{} bin, err := v.MarshalPacket() @@ -2519,8 +3763,25 @@ func TestJSONWsrOdometerBusAmphoursMeasurement(t *testing.T) { default: t.Fatalf("didn't match type: %T, %v", underlying, underlying) } + } + +func TestCanFrameWsrOdometerBusAmphoursMeasurement(t *testing.T) { + v := &WsrOdometerBusAmphoursMeasurement{} + frame, err := ToCanFrame(v) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + + retpkt, err := FromCanFrame(frame) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + if !reflect.DeepEqual(v, retpkt) { + t.Fatalf("decoded packet did not match sent %v got %v", v, retpkt) + } +} func TestMarshalUnmarshalWsrSlipSpeedMeasurement(t *testing.T) { v := &WsrSlipSpeedMeasurement{} bin, err := v.MarshalPacket() @@ -2553,8 +3814,25 @@ func TestJSONWsrSlipSpeedMeasurement(t *testing.T) { default: t.Fatalf("didn't match type: %T, %v", underlying, underlying) } + } + +func TestCanFrameWsrSlipSpeedMeasurement(t *testing.T) { + v := &WsrSlipSpeedMeasurement{} + frame, err := ToCanFrame(v) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + + retpkt, err := FromCanFrame(frame) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + if !reflect.DeepEqual(v, retpkt) { + t.Fatalf("decoded packet did not match sent %v got %v", v, retpkt) + } +} func TestMarshalUnmarshalWslIdentification(t *testing.T) { v := &WslIdentification{} bin, err := v.MarshalPacket() @@ -2587,8 +3865,25 @@ func TestJSONWslIdentification(t *testing.T) { default: t.Fatalf("didn't match type: %T, %v", underlying, underlying) } + } + +func TestCanFrameWslIdentification(t *testing.T) { + v := &WslIdentification{} + frame, err := ToCanFrame(v) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + + retpkt, err := FromCanFrame(frame) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + if !reflect.DeepEqual(v, retpkt) { + t.Fatalf("decoded packet did not match sent %v got %v", v, retpkt) + } +} func TestMarshalUnmarshalWslStatusInformation(t *testing.T) { v := &WslStatusInformation{} bin, err := v.MarshalPacket() @@ -2621,8 +3916,25 @@ func TestJSONWslStatusInformation(t *testing.T) { default: t.Fatalf("didn't match type: %T, %v", underlying, underlying) } + } + +func TestCanFrameWslStatusInformation(t *testing.T) { + v := &WslStatusInformation{} + frame, err := ToCanFrame(v) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + + retpkt, err := FromCanFrame(frame) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + if !reflect.DeepEqual(v, retpkt) { + t.Fatalf("decoded packet did not match sent %v got %v", v, retpkt) + } +} func TestMarshalUnmarshalWslBusMeasurement(t *testing.T) { v := &WslBusMeasurement{} bin, err := v.MarshalPacket() @@ -2655,8 +3967,25 @@ func TestJSONWslBusMeasurement(t *testing.T) { default: t.Fatalf("didn't match type: %T, %v", underlying, underlying) } + } + +func TestCanFrameWslBusMeasurement(t *testing.T) { + v := &WslBusMeasurement{} + frame, err := ToCanFrame(v) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + + retpkt, err := FromCanFrame(frame) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + if !reflect.DeepEqual(v, retpkt) { + t.Fatalf("decoded packet did not match sent %v got %v", v, retpkt) + } +} func TestMarshalUnmarshalWslVelocity(t *testing.T) { v := &WslVelocity{} bin, err := v.MarshalPacket() @@ -2689,8 +4018,25 @@ func TestJSONWslVelocity(t *testing.T) { default: t.Fatalf("didn't match type: %T, %v", underlying, underlying) } + } + +func TestCanFrameWslVelocity(t *testing.T) { + v := &WslVelocity{} + frame, err := ToCanFrame(v) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + + retpkt, err := FromCanFrame(frame) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + if !reflect.DeepEqual(v, retpkt) { + t.Fatalf("decoded packet did not match sent %v got %v", v, retpkt) + } +} func TestMarshalUnmarshalWslPhaseCurrent(t *testing.T) { v := &WslPhaseCurrent{} bin, err := v.MarshalPacket() @@ -2723,8 +4069,25 @@ func TestJSONWslPhaseCurrent(t *testing.T) { default: t.Fatalf("didn't match type: %T, %v", underlying, underlying) } + } + +func TestCanFrameWslPhaseCurrent(t *testing.T) { + v := &WslPhaseCurrent{} + frame, err := ToCanFrame(v) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + + retpkt, err := FromCanFrame(frame) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + if !reflect.DeepEqual(v, retpkt) { + t.Fatalf("decoded packet did not match sent %v got %v", v, retpkt) + } +} func TestMarshalUnmarshalWslMotorVoltageVector(t *testing.T) { v := &WslMotorVoltageVector{} bin, err := v.MarshalPacket() @@ -2757,8 +4120,25 @@ func TestJSONWslMotorVoltageVector(t *testing.T) { default: t.Fatalf("didn't match type: %T, %v", underlying, underlying) } + } + +func TestCanFrameWslMotorVoltageVector(t *testing.T) { + v := &WslMotorVoltageVector{} + frame, err := ToCanFrame(v) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + + retpkt, err := FromCanFrame(frame) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + if !reflect.DeepEqual(v, retpkt) { + t.Fatalf("decoded packet did not match sent %v got %v", v, retpkt) + } +} func TestMarshalUnmarshalWslMotorCurrentVector(t *testing.T) { v := &WslMotorCurrentVector{} bin, err := v.MarshalPacket() @@ -2791,8 +4171,25 @@ func TestJSONWslMotorCurrentVector(t *testing.T) { default: t.Fatalf("didn't match type: %T, %v", underlying, underlying) } + } + +func TestCanFrameWslMotorCurrentVector(t *testing.T) { + v := &WslMotorCurrentVector{} + frame, err := ToCanFrame(v) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + + retpkt, err := FromCanFrame(frame) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + if !reflect.DeepEqual(v, retpkt) { + t.Fatalf("decoded packet did not match sent %v got %v", v, retpkt) + } +} func TestMarshalUnmarshalWslMotorBackemf(t *testing.T) { v := &WslMotorBackemf{} bin, err := v.MarshalPacket() @@ -2825,8 +4222,25 @@ func TestJSONWslMotorBackemf(t *testing.T) { default: t.Fatalf("didn't match type: %T, %v", underlying, underlying) } + } + +func TestCanFrameWslMotorBackemf(t *testing.T) { + v := &WslMotorBackemf{} + frame, err := ToCanFrame(v) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + + retpkt, err := FromCanFrame(frame) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + if !reflect.DeepEqual(v, retpkt) { + t.Fatalf("decoded packet did not match sent %v got %v", v, retpkt) + } +} func TestMarshalUnmarshalWsl15165VoltageRail(t *testing.T) { v := &Wsl15165VoltageRail{} bin, err := v.MarshalPacket() @@ -2859,8 +4273,25 @@ func TestJSONWsl15165VoltageRail(t *testing.T) { default: t.Fatalf("didn't match type: %T, %v", underlying, underlying) } + } + +func TestCanFrameWsl15165VoltageRail(t *testing.T) { + v := &Wsl15165VoltageRail{} + frame, err := ToCanFrame(v) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + + retpkt, err := FromCanFrame(frame) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + if !reflect.DeepEqual(v, retpkt) { + t.Fatalf("decoded packet did not match sent %v got %v", v, retpkt) + } +} func TestMarshalUnmarshalWsl2512VoltageRail(t *testing.T) { v := &Wsl2512VoltageRail{} bin, err := v.MarshalPacket() @@ -2893,8 +4324,25 @@ func TestJSONWsl2512VoltageRail(t *testing.T) { default: t.Fatalf("didn't match type: %T, %v", underlying, underlying) } + } + +func TestCanFrameWsl2512VoltageRail(t *testing.T) { + v := &Wsl2512VoltageRail{} + frame, err := ToCanFrame(v) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + + retpkt, err := FromCanFrame(frame) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + if !reflect.DeepEqual(v, retpkt) { + t.Fatalf("decoded packet did not match sent %v got %v", v, retpkt) + } +} func TestMarshalUnmarshalWslHeatsinkMotorTemp(t *testing.T) { v := &WslHeatsinkMotorTemp{} bin, err := v.MarshalPacket() @@ -2927,8 +4375,25 @@ func TestJSONWslHeatsinkMotorTemp(t *testing.T) { default: t.Fatalf("didn't match type: %T, %v", underlying, underlying) } + } + +func TestCanFrameWslHeatsinkMotorTemp(t *testing.T) { + v := &WslHeatsinkMotorTemp{} + frame, err := ToCanFrame(v) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + + retpkt, err := FromCanFrame(frame) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + if !reflect.DeepEqual(v, retpkt) { + t.Fatalf("decoded packet did not match sent %v got %v", v, retpkt) + } +} func TestMarshalUnmarshalWslDspBoardTemp(t *testing.T) { v := &WslDspBoardTemp{} bin, err := v.MarshalPacket() @@ -2961,8 +4426,25 @@ func TestJSONWslDspBoardTemp(t *testing.T) { default: t.Fatalf("didn't match type: %T, %v", underlying, underlying) } + } + +func TestCanFrameWslDspBoardTemp(t *testing.T) { + v := &WslDspBoardTemp{} + frame, err := ToCanFrame(v) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + + retpkt, err := FromCanFrame(frame) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + if !reflect.DeepEqual(v, retpkt) { + t.Fatalf("decoded packet did not match sent %v got %v", v, retpkt) + } +} func TestMarshalUnmarshalWslOdometerBusAmphoursMeasurement(t *testing.T) { v := &WslOdometerBusAmphoursMeasurement{} bin, err := v.MarshalPacket() @@ -2995,8 +4477,25 @@ func TestJSONWslOdometerBusAmphoursMeasurement(t *testing.T) { default: t.Fatalf("didn't match type: %T, %v", underlying, underlying) } + } + +func TestCanFrameWslOdometerBusAmphoursMeasurement(t *testing.T) { + v := &WslOdometerBusAmphoursMeasurement{} + frame, err := ToCanFrame(v) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + + retpkt, err := FromCanFrame(frame) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + if !reflect.DeepEqual(v, retpkt) { + t.Fatalf("decoded packet did not match sent %v got %v", v, retpkt) + } +} func TestMarshalUnmarshalWslReserved(t *testing.T) { v := &WslReserved{} bin, err := v.MarshalPacket() @@ -3029,8 +4528,25 @@ func TestJSONWslReserved(t *testing.T) { default: t.Fatalf("didn't match type: %T, %v", underlying, underlying) } + } + +func TestCanFrameWslReserved(t *testing.T) { + v := &WslReserved{} + frame, err := ToCanFrame(v) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + + retpkt, err := FromCanFrame(frame) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + if !reflect.DeepEqual(v, retpkt) { + t.Fatalf("decoded packet did not match sent %v got %v", v, retpkt) + } +} func TestMarshalUnmarshalWslSlipSpeedMeasurement(t *testing.T) { v := &WslSlipSpeedMeasurement{} bin, err := v.MarshalPacket() @@ -3063,5 +4579,22 @@ func TestJSONWslSlipSpeedMeasurement(t *testing.T) { default: t.Fatalf("didn't match type: %T, %v", underlying, underlying) } + } + +func TestCanFrameWslSlipSpeedMeasurement(t *testing.T) { + v := &WslSlipSpeedMeasurement{} + frame, err := ToCanFrame(v) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + + retpkt, err := FromCanFrame(frame) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + if !reflect.DeepEqual(v, retpkt) { + t.Fatalf("decoded packet did not match sent %v got %v", v, retpkt) + } +} diff --git a/skylab/templates/golang_tests.go.tmpl b/skylab/templates/golang_tests.go.tmpl index 5f6432c..9686d35 100644 --- a/skylab/templates/golang_tests.go.tmpl +++ b/skylab/templates/golang_tests.go.tmpl @@ -3,6 +3,7 @@ package skylab import ( "testing" + "reflect" "encoding/json" ) @@ -44,4 +45,20 @@ func TestJSON{{$structName}}(t *testing.T) { } +func TestCanFrame{{$structName}}(t *testing.T) { + v := &{{$structName}}{} + frame, err := ToCanFrame(v) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + + retpkt, err := FromCanFrame(frame) + if err != nil { + t.Fatalf("expected no error, got %v", err) + } + if !reflect.DeepEqual(v, retpkt) { + t.Fatalf("decoded packet did not match sent %v got %v", v, retpkt) + } +} + {{- end }}