Refactor, add new data

refactor
Terekhin Alexandr 2 years ago
parent 268e784cb5
commit a5f3013280
Signed by: didinst
GPG Key ID: D2EF94423C23BF12
  1. 266
      yabl/protocol.go
  2. 45
      yabl/protocol_test.go
  3. 341
      yabl/setters.go
  4. 76
      yabl/strings.go

@ -1,46 +1,62 @@
package yabl package yabl
import ( import (
can "cli-mon/can" "cli-mon/can"
"encoding/binary" "encoding/binary"
) )
const ( const (
CONTACTOR_MAX = 18 + 1 CONTACTOR_MAX = 18 + 1
CONNECTOR_MAX = 6 + 1 CONNECTOR_MAX = 6 + 1
ALL_BITS = 0xFFFFFFFFFFFFFFFF ALL_BITS = 0xFFFFFFFFFFFFFFFF
UNIT_ID_OFFSET = 12 UNIT_ID_OFFSET = 12
UNIT_ID_MASK = 0b111111111111 << UNIT_ID_OFFSET UNIT_ID_MASK = 0b111111111111 << UNIT_ID_OFFSET
ACTION_ID_MASK = 0b111111111111 ACTION_ID_MASK = 0b111111111111
BOARD_READY_OK BoardReadyType = 0 BOARD_READY_OK BoardReadyType = 0
BOARD_READY_INFO BoardReadyType = 1 BOARD_READY_INFO BoardReadyType = 1
BOARD_READY_WARNING BoardReadyType = 2 BOARD_READY_WARNING BoardReadyType = 2
BOARD_READY_DEBUG BoardReadyType = 3 BOARD_READY_DEBUG BoardReadyType = 3
BOARD_READY_DEP_ERROR BoardReadyType = 4 BOARD_READY_DEP_ERROR BoardReadyType = 4
BOARD_READY_ERROR BoardReadyType = 5 BOARD_READY_ERROR BoardReadyType = 5
BOARD_READY_CRITICAL BoardReadyType = 6 BOARD_READY_CRITICAL BoardReadyType = 6
OFF BooleanType = 0 OFF BooleanType = 0
ON BooleanType = 1 ON BooleanType = 1
NO_ERROR ErrorType = 0 NO_ERROR ErrorType = 0
ERROR ErrorType = 1 ERROR ErrorType = 1
OTHER_NO_ERROR ContactorInternalOtherErrorType = 0 OTHER_NO_ERROR ContactorInternalOtherErrorType = 0
NO_PENDING_CHANGES ContactorGroupChangedType = 0 NO_PENDING_CHANGES ContactorGroupChangedType = 0
INITIALIZED_CHANGE ContactorGroupChangedType = 1 INITIALIZED_CHANGE ContactorGroupChangedType = 1
CHANGE_IN_PROGRESS ContactorGroupChangedType = 2 CHANGE_IN_PROGRESS ContactorGroupChangedType = 2
V2G_MODE_G2V V2GModeType = 0 V2G_MODE_G2V V2GModeType = 0
V2G_MODE_V2G V2GModeType = 1 V2G_MODE_V2G V2GModeType = 1
V2G_MODE_INV V2GModeType = 2 V2G_MODE_INV V2GModeType = 2
NOT_ENABLE CpLineLevelType = 0 NOT_ENABLE CpLineLevelType = 0
TWELVE CpLineLevelType = 1 TWELVE CpLineLevelType = 1
NINE CpLineLevelType = 2 NINE CpLineLevelType = 2
SIX CpLineLevelType = 3 SIX CpLineLevelType = 3
THREE CpLineLevelType = 4 THREE CpLineLevelType = 4
MINUS_TWELVE CpLineLevelType = 5 MINUS_TWELVE CpLineLevelType = 5
UNKNOWN IsolationStateType = 0 ISOLATION_STATE_UNKNOWN IsolationStateType = 0
ONGOING IsolationStateType = 1 ONGOING IsolationStateType = 1
PASSED IsolationStateType = 2 PASSED IsolationStateType = 2
WARNING IsolationStateType = 3 WARNING IsolationStateType = 3
FAILED IsolationStateType = 4 FAILED IsolationStateType = 4
AUTH AuthModeType = 0
PNC AuthModeType = 1
AUTH_STATE_UNKNOWN AuthStateType = 0
AUTH_STATE_ALLOW AuthStateType = 1
AUTH_STATE_DENY AuthStateType = 2
CONTACTOR_NO_MODE ContactorModeType = 0
CONTACTOR_TRANSACTION_PROCESS ContactorModeType = 1
CONTACTOR_CUSTOM_MODE ContactorModeType = 2
CONTACTOR_ONLY_ONE_OUT_MODE ContactorModeType = 3
CONTACTOR_ONE_TO_ONE_OUT_MODE ContactorModeType = 4
CONTACTOR_SIMPLE_DYNAMIC_MODE ContactorModeType = 5
DEBUG_SWITCH_MODE_AUTO DebugSwitchModeType = 0
DEBUG_SWITCH_MODE_OFF DebugSwitchModeType = 1
DEBUG_SWITCH_MODE_ON DebugSwitchModeType = 2
DEBUG_SWITCH_MODE_PERMANENT_OFF DebugSwitchModeType = 4
DEBUG_SWITCH_MODE_PERMANENT_ON DebugSwitchModeType = 5
) )
type Packet interface { type Packet interface {
@ -87,6 +103,126 @@ type PuPeriphery struct {
CpLineVoltage Voltage9BitType CpLineVoltage Voltage9BitType
} }
type LogicAuth struct {
UnitId uint
AuthMode AuthModeType
AuthState AuthStateType
}
type LogicEnergyMode struct {
UnitId uint
V2gMode V2GModeType
CurrentMax Current10BitType
VoltageMax Voltage11BitType
PowerMax Power14BitType
}
type LogicWorkingMode struct {
UnitId uint
TargetContactorMode ContactorModeType
Availability BooleanType
}
type CpuPresentEnergy struct {
UnitId uint
PowerDirectionMode V2GModeType
PresentCurrent Current10BitType
PresentVoltage Voltage11BitType
}
type CpuPeriphery struct {
UnitId uint
ContactorInput BooleanType
CircuitBreakerInput BooleanType
CircuitBreakerPowerCBInput BooleanType
}
type CpuEnergySettings struct {
UnitId uint
CurrentMax Current10BitType
VoltageMax Voltage11BitType
PowerMax Power14BitType
TargetBatteryVoltage Voltage11BitType
TargetGoalVoltage Voltage11BitType
}
type CpuErrors struct {
UnitId uint
BoardReady BoardReadyType
OtherError OtherError4BitType
RedButtonHard ErrorType
RedButtonSoft ErrorType
ModulesGone ErrorType
GridVoltageHighErr ErrorType
GridVoltageHighWarn ErrorType
GridVoltageLowWarn ErrorType
GridVoltageLowErr ErrorType
GridVoltageLow Voltage11BitType
GridVoltageHigh Voltage11BitType
GridVoltageEmpty ErrorType
NotReadySecc ErrorType
NotReadyPu ErrorType
NotReadyContactors ErrorType
DebugConvertersEnabled ErrorType
ContactorInputError ErrorType
NotReadyPeriphery ErrorType
}
type CpuDebug struct {
UnitId uint
DebugModeOn BooleanType
DebugContactorInputOn DebugSwitchModeType
DebugCircuitBreakerOn DebugSwitchModeType
DebugRedButtonSoftware DebugSwitchModeType
}
type PuErrors struct {
UnitId uint
BoardReady BoardReadyType
OtherError OtherError4BitType
IncorrectVoltage ErrorType
IncorrectVoltageValue Voltage11BitType
IncorrectCurrent ErrorType
IncorrectCurrentValue Current10BitType
IsolationBroken ErrorType
CpLineBroken ErrorType
CpLineGap69 ErrorType
CableReady BoardReadyType
NotReadyCpu ErrorType
NotReadySecc ErrorType
ContactorOutputError ErrorType
DebugContactorOutputEnabled BooleanType
OutputCircuitBreakerEnabled ErrorType
OutputCircuitBreakerEnabledValue SignedVoltage12bitType
}
type PuDebug struct {
UnitId uint
DebugModeOn BooleanType
DebugContactorOutputOn DebugSwitchModeType
}
type SeccTargetEnergy struct {
UnitId uint
TargetChargingAllow BooleanType
TargetBatteryVoltage Voltage11BitType
TargetGoalVoltage Voltage11BitType
TargetCurrent Current10BitType
}
type SeccErrors struct {
UnitId uint
BoardReady BoardReadyType
NotReadyLogic ErrorType
}
type SignedVoltage12bitType int
type DebugSwitchModeType uint
type OtherError4BitType uint
type ContactorModeType uint
type Power14BitType uint
type AuthStateType uint
type AuthModeType uint
type BoardReadyType uint type BoardReadyType uint
type BooleanType uint type BooleanType uint
type ErrorType uint type ErrorType uint
@ -114,7 +250,7 @@ func StartProtocolParsing(frames <-chan *can.CanFrame) <-chan Packet {
continue continue
} }
var unitId uint = uint((frame.CanId & UNIT_ID_MASK) >> UNIT_ID_OFFSET) var unitId = uint((frame.CanId & UNIT_ID_MASK) >> UNIT_ID_OFFSET)
switch { switch {
case frame.CanId&ACTION_ID_MASK == can.CAN_ID_071: case frame.CanId&ACTION_ID_MASK == can.CAN_ID_071:
@ -263,18 +399,66 @@ func get(from uint, size uint, buffer []byte) (uint64, bool) {
} }
} }
func (t ContactorInternalState) GetUnitId() uint { func (t *ContactorInternalState) GetUnitId() uint {
return t.UnitId return t.UnitId
} }
func (t ContactorInternalErrors) GetUnitId() uint { func (t *ContactorInternalErrors) GetUnitId() uint {
return t.UnitId return t.UnitId
} }
func (t PuPresentEnergy) GetUnitId() uint { func (t *PuPresentEnergy) GetUnitId() uint {
return t.UnitId return t.UnitId
} }
func (t PuPeriphery) GetUnitId() uint { func (t *PuPeriphery) GetUnitId() uint {
return t.UnitId return t.UnitId
} }
func (a *LogicAuth) GetUnitId() uint {
return a.UnitId
}
func (l *LogicEnergyMode) GetUnitId() uint {
return l.UnitId
}
func (l *LogicWorkingMode) GetUnitId() uint {
return l.UnitId
}
func (c *CpuPresentEnergy) GetUnitId() uint {
return c.UnitId
}
func (c *CpuPeriphery) GetUnitId() uint {
return c.UnitId
}
func (c *CpuEnergySettings) GetUnitId() uint {
return c.UnitId
}
func (c *CpuErrors) GetUnitId() uint {
return c.UnitId
}
func (d *CpuDebug) GetUnitId() uint {
return d.UnitId
}
func (p *PuErrors) GetUnitId() uint {
return p.UnitId
}
func (d *PuDebug) GetUnitId() uint {
return d.UnitId
}
func (s *SeccTargetEnergy) GetUnitId() uint {
return s.UnitId
}
func (e *SeccErrors) GetUnitId() uint {
return e.UnitId
}

@ -0,0 +1,45 @@
package yabl
import (
"cli-mon/can"
"log"
"testing"
"time"
)
type parameters struct {
fields []content
interval uint
}
type content struct {
length uint8
setter func(uint64 uint64)
last time.Time
}
func TestStartProtocolParsing(t *testing.T) {
var cis = ContactorInternalState{}
var cisMsg = parameters{fields: []content{
{length: 3, setter: cis.setContactorReady},
{length: 2, setter: cis.setContactorOn},
{length: 2, setter: cis.setUnexpectedState},
{length: 2, setter: cis.setIsolated},
{length: 2, setter: cis.setDebugEnabled},
}}
var messages = map[uint]parameters{
can.CAN_ID_071: cisMsg,
}
// try to use
var values = messages[can.CAN_ID_071]
for num, item := range values.fields {
item.setter(uint64(num))
log.Println(cis)
}
}

@ -0,0 +1,341 @@
package yabl
func (t *ContactorInternalState) setContactorReady(val uint64) {
t.ContactorReady = BoardReadyType(val)
}
func (t *ContactorInternalState) setContactorOn(val uint64) {
t.ContactorOn = BooleanType(val)
}
func (t *ContactorInternalState) setUnexpectedState(val uint64) {
t.UnexpectedState = ErrorType(val)
}
func (t *ContactorInternalState) setIsolated(val uint64) {
t.Isolated = ErrorType(val)
}
func (t *ContactorInternalState) setDebugEnabled(val uint64) {
t.DebugEnabled = BooleanType(val)
}
func (t *ContactorInternalErrors) setBoardReady(val uint64) {
t.BoardReady = BoardReadyType(val)
}
func (t *ContactorInternalErrors) setOtherError(val uint64) {
t.OtherError = ContactorInternalOtherErrorType(val)
}
func (t *ContactorInternalErrors) setContactorGroupChanged(val uint64) {
t.ContactorGroupChanged = ContactorGroupChangedType(val)
}
func (t *ContactorInternalErrors) setUnexpectedFormation(val uint64) {
t.UnexpectedFormation = ContactorInternalOtherErrorType(val)
}
func (t *ContactorInternalErrors) setCpuNotReady(val uint64) {
t.CpuNotReady = ErrorType(val)
}
func (t *ContactorInternalErrors) setPuNotReady(val uint64) {
t.PuNotReady = ErrorType(val)
}
func (t *ContactorInternalErrors) setDebug(val uint64) {
t.Debug = BooleanType(val)
}
func (t *PuPresentEnergy) setV2GMode(val uint64) {
t.V2GMode = V2GModeType(val)
}
func (t *PuPresentEnergy) setVoltageBefore(val uint64) {
t.VoltageBefore = Voltage11BitType(val)
}
func (t *PuPresentEnergy) setVoltageAfter(val uint64) {
t.VoltageAfter = Voltage11BitType(val)
}
func (t *PuPresentEnergy) setPresentCurrent(val uint64) {
t.PresentCurrent = Current10BitType(val)
}
func (t *PuPeriphery) setConnectorInsert(val uint64) {
t.ConnectorInsert = BooleanType(val)
}
func (t *PuPeriphery) setContactorOn(val uint64) {
t.ContactorOn = BooleanType(val)
}
func (t *PuPeriphery) setConnectorLocked(val uint64) {
t.ConnectorLocked = BooleanType(val)
}
func (t *PuPeriphery) setCpLineLevel(val uint64) {
t.CpLineLevel = CpLineLevelType(val)
}
func (t *PuPeriphery) setIsolationState(val uint64) {
t.IsolationState = IsolationStateType(val)
}
func (t *PuPeriphery) setChargingAllowed(val uint64) {
t.ChargingAllowed = BooleanType(val)
}
func (t *PuPeriphery) setPwmEnabled(val uint64) {
t.PwmEnabled = BooleanType(val)
}
func (t *PuPeriphery) setCpLineVoltage(val uint64) {
t.CpLineVoltage = Voltage9BitType(val)
}
func (t *LogicAuth) setAuthMode(val uint64) {
t.AuthMode = AuthModeType(val)
}
func (t *LogicAuth) setAuthState(val uint64) {
t.AuthState = AuthStateType(val)
}
func (l *LogicWorkingMode) setTargetContactorMode(val uint64) {
l.TargetContactorMode = ContactorModeType(val)
}
func (l *LogicWorkingMode) setAvailability(val uint64) {
l.Availability = BooleanType(val)
}
func (c *CpuPresentEnergy) setPowerDirectionMode(val uint64) {
c.PowerDirectionMode = V2GModeType(val)
}
func (c *CpuPresentEnergy) setPresentCurrent(val uint64) {
c.PresentCurrent = Current10BitType(val)
}
func (c *CpuPresentEnergy) setPresentVoltage(val uint64) {
c.PresentVoltage = Voltage11BitType(val)
}
func (c *CpuPeriphery) setCircuitBreakerInput(val uint64) {
c.CircuitBreakerInput = BooleanType(val)
}
func (c *CpuPeriphery) setCircuitBreakerPowerCBInput(val uint64) {
c.CircuitBreakerPowerCBInput = BooleanType(val)
}
func (c *CpuPeriphery) setContactorInput(val uint64) {
c.ContactorInput = BooleanType(val)
}
func (c *CpuEnergySettings) setCurrentMax(val uint64) {
c.CurrentMax = Current10BitType(val)
}
func (c *CpuEnergySettings) setVoltageMax(val uint64) {
c.VoltageMax = Voltage11BitType(val)
}
func (c *CpuEnergySettings) setPowerMax(val uint64) {
c.PowerMax = Power14BitType(val * 100)
}
func (c *CpuEnergySettings) setTargetBatteryVoltage(val uint64) {
c.TargetBatteryVoltage = Voltage11BitType(val)
}
func (c *CpuEnergySettings) setTargetGoalVoltage(val uint64) {
c.TargetGoalVoltage = Voltage11BitType(val)
}
func (c *CpuErrors) setBoardReady(val uint64) {
c.BoardReady = BoardReadyType(val)
}
func (c *CpuErrors) setOtherError(val uint64) {
c.OtherError = OtherError4BitType(val)
}
func (c *CpuErrors) setRedButtonHard(val uint64) {
c.RedButtonHard = ErrorType(val)
}
func (c *CpuErrors) setRedButtonSoft(val uint64) {
c.RedButtonSoft = ErrorType(val)
}
func (c *CpuErrors) setModulesGone(val uint64) {
c.ModulesGone = ErrorType(val)
}
func (c *CpuErrors) setGridVoltageHighErr(val uint64) {
c.GridVoltageHighErr = ErrorType(val)
}
func (c *CpuErrors) setGridVoltageHighWarn(val uint64) {
c.GridVoltageHighWarn = ErrorType(val)
}
func (c *CpuErrors) setGridVoltageLowWarn(val uint64) {
c.GridVoltageLowWarn = ErrorType(val)
}
func (c *CpuErrors) setGridVoltageLowErr(val uint64) {
c.GridVoltageLowErr = ErrorType(val)
}
func (c *CpuErrors) setGridVoltageLow(val uint64) {
c.GridVoltageLow = Voltage11BitType(val)
}
func (c *CpuErrors) setGridVoltageHigh(val uint64) {
c.GridVoltageHigh = Voltage11BitType(val)
}
func (c *CpuErrors) setGridVoltageEmpty(val uint64) {
c.GridVoltageEmpty = ErrorType(val)
}
func (c *CpuErrors) setNotReadySecc(val uint64) {
c.NotReadySecc = ErrorType(val)
}
func (c *CpuErrors) setNotReadyPu(val uint64) {
c.NotReadyPu = ErrorType(val)
}
func (c *CpuErrors) setNotReadyContactors(val uint64) {
c.NotReadyContactors = ErrorType(val)
}
func (c *CpuErrors) setDebugConvertersEnabled(val uint64) {
c.DebugConvertersEnabled = ErrorType(val)
}
func (c *CpuErrors) setContactorInputError(val uint64) {
c.ContactorInputError = ErrorType(val)
}
func (c *CpuErrors) setNotReadyPeriphery(val uint64) {
c.NotReadyPeriphery = ErrorType(val)
}
func (d *CpuDebug) setDebugModeOn(val uint64) {
d.DebugModeOn = BooleanType(val)
}
func (d *CpuDebug) setDebugContactorInputOn(val uint64) {
d.DebugContactorInputOn = DebugSwitchModeType(val)
}
func (d *CpuDebug) setDebugCircuitBreakerOn(val uint64) {
d.DebugCircuitBreakerOn = DebugSwitchModeType(val)
}
func (d *CpuDebug) setDebugRedButtonSoftware(val uint64) {
d.DebugRedButtonSoftware = DebugSwitchModeType(val)
}
func (p *PuErrors) setBoardReady(val uint64) {
p.BoardReady = BoardReadyType(val)
}
func (p *PuErrors) setOtherError(val uint64) {
p.OtherError = OtherError4BitType(val)
}
func (p *PuErrors) setIncorrectVoltage(val uint64) {
p.IncorrectVoltage = ErrorType(val)
}
func (p *PuErrors) setIncorrectVoltageValue(val uint64) {
p.IncorrectVoltageValue = Voltage11BitType(val)
}
func (p *PuErrors) setIncorrectCurrent(val uint64) {
p.IncorrectCurrent = ErrorType(val)
}
func (p *PuErrors) setIncorrectCurrentValue(val uint64) {
p.IncorrectCurrentValue = Current10BitType(val)
}
func (p *PuErrors) setIsolationBroken(val uint64) {
p.IsolationBroken = ErrorType(val)
}
func (p *PuErrors) setCpLineBroken(val uint64) {
p.CpLineBroken = ErrorType(val)
}
func (p *PuErrors) setCpLineGap69(val uint64) {
p.CpLineGap69 = ErrorType(val)
}
func (p *PuErrors) setCableReady(val uint64) {
p.CableReady = BoardReadyType(val)
}
func (p *PuErrors) setNotReadyCpu(val uint64) {
p.NotReadyCpu = ErrorType(val)
}
func (p *PuErrors) setNotReadySecc(val uint64) {
p.NotReadySecc = ErrorType(val)
}
func (p *PuErrors) setContactorOutputError(val uint64) {
p.ContactorOutputError = ErrorType(val)
}
func (p *PuErrors) setDebugContactorOutputEnabled(val uint64) {
p.DebugContactorOutputEnabled = BooleanType(val)
}
func (p *PuErrors) setOutputCircuitBreakerEnabled(val uint64) {
p.OutputCircuitBreakerEnabled = ErrorType(val)
}
func (p *PuErrors) setOutputCircuitBreakerEnabledValue(val uint64) {
p.OutputCircuitBreakerEnabledValue = SignedVoltage12bitType(val - 1000)
}
func (d *PuDebug) setDebugModeOn(val uint64) {
d.DebugModeOn = BooleanType(val)
}
func (d *PuDebug) setDebugContactorOutputOn(val uint64) {
d.DebugContactorOutputOn = DebugSwitchModeType(val)
}
func (s *SeccTargetEnergy) setTargetChargingAllow(val uint64) {
s.TargetChargingAllow = BooleanType(val)
}
func (s *SeccTargetEnergy) setTargetBatteryVoltage(val uint64) {
s.TargetBatteryVoltage = Voltage11BitType(val)
}
func (s *SeccTargetEnergy) setTargetGoalVoltage(val uint64) {
s.TargetGoalVoltage = Voltage11BitType(val)
}
func (s *SeccTargetEnergy) setTargetCurrent(val uint64) {
s.TargetCurrent = Current10BitType(val)
}
func (e *SeccErrors) setBoardReady(val uint64) {
e.BoardReady = BoardReadyType(val)
}
func (e *SeccErrors) setNotReadyLogic(val uint64) {
e.NotReadyLogic = ErrorType(val)
}

@ -109,8 +109,8 @@ func (t CpLineLevelType) String() string {
func (t IsolationStateType) String() string { func (t IsolationStateType) String() string {
switch t { switch t {
case UNKNOWN: case ISOLATION_STATE_UNKNOWN:
return "UNKNOWN" return "ISOLATION_STATE_UNKNOWN"
case ONGOING: case ONGOING:
return "ONGOING" return "ONGOING"
case PASSED: case PASSED:
@ -127,3 +127,75 @@ func (t IsolationStateType) String() string {
func (t Voltage9BitType) String() string { func (t Voltage9BitType) String() string {
return fmt.Sprintf("%.1fV", t) return fmt.Sprintf("%.1fV", t)
} }
func (t AuthModeType) String() string {
switch t {
case AUTH:
return "AUTH"
case PNC:
return "PNC"
default:
panic("AuthModeType not defended")
}
}
func (a AuthStateType) String() string {
switch a {
case AUTH_STATE_UNKNOWN:
return "UNKNOWN"
case AUTH_STATE_ALLOW:
return "ALLOW"
case AUTH_STATE_DENY:
return "DENY"
default:
panic("AuthStateType not defended")
}
}
func (p Power14BitType) String() string {
return fmt.Sprintf("%dW", p)
}
func (c ContactorModeType) String() string {
switch c {
case CONTACTOR_NO_MODE:
return "NO_MODE"
case CONTACTOR_TRANSACTION_PROCESS:
return "TRANSACTION_PROCESS"
case CONTACTOR_CUSTOM_MODE:
return "CUSTOM_MODE"
case CONTACTOR_ONLY_ONE_OUT_MODE:
return "ONLY_ONE_OUT_MODE"
case CONTACTOR_ONE_TO_ONE_OUT_MODE:
return "ONE_TO_ONE_OUT_MODE"
case CONTACTOR_SIMPLE_DYNAMIC_MODE:
return "SIMPLE_DYNAMIC_MODE"
default:
panic("ContactorModeType not defended")
}
}
func (e OtherError4BitType) String() string {
return fmt.Sprintf("ErrCode_%d", e)
}
func (d DebugSwitchModeType) String() string {
switch d {
case DEBUG_SWITCH_MODE_AUTO:
return "AUTO"
case DEBUG_SWITCH_MODE_OFF:
return "OFF"
case DEBUG_SWITCH_MODE_ON:
return "ON"
case DEBUG_SWITCH_MODE_PERMANENT_OFF:
return "PERMANENT_OFF"
case DEBUG_SWITCH_MODE_PERMANENT_ON:
return "PERMANENT_ON"
default:
panic("DebugSwitchModeType not defended")
}
}
func (s SignedVoltage12bitType) String() string {
return fmt.Sprintf("%d", s)
}

Loading…
Cancel
Save