Nil value instead zero by default
This commit is contained in:
+4
-4
@@ -379,10 +379,10 @@ func initialize() {
|
||||
cd := &ConverterDebug{UnitId: i}
|
||||
converterDebugArray[i] = cd
|
||||
fields = []*field{
|
||||
{length: 3, setter: cd.setDebugModeOn, name: FDebugModeOn},
|
||||
{length: 4, setter: cd.setDebugEnergyOn, name: FDebugEnergyOn},
|
||||
{length: 2, setter: cd.setDebugTargetVoltage, name: FDebugTargetVoltage},
|
||||
{length: 2, setter: cd.setDebugTargetCurrent, name: FDebugTargetCurrent},
|
||||
{length: 2, setter: cd.setDebugModeOn, name: FDebugModeOn},
|
||||
{length: 3, setter: cd.setDebugEnergyOn, name: FDebugEnergyOn},
|
||||
{length: 11, setter: cd.setDebugTargetVoltage, name: FDebugTargetVoltage},
|
||||
{length: 10, setter: cd.setDebugTargetCurrent, name: FDebugTargetCurrent},
|
||||
}
|
||||
protocolMap[key] = action{fields: fields, interval: 1000, name: PConverterDebug, object: cd}
|
||||
}
|
||||
|
||||
+4
-6
@@ -41,6 +41,7 @@ type Event struct {
|
||||
Field FName
|
||||
Object Action
|
||||
Updated time.Time
|
||||
Value any
|
||||
}
|
||||
|
||||
type action struct {
|
||||
@@ -52,16 +53,12 @@ type action struct {
|
||||
|
||||
type field struct {
|
||||
length uint8
|
||||
setter func(uint64 uint64)
|
||||
setter func(uint64 uint64) any
|
||||
value uint64
|
||||
last time.Time
|
||||
name FName
|
||||
}
|
||||
|
||||
func newField(length uint8, setter func(uint64 uint64), name FName) *field {
|
||||
return &field{length: length, setter: setter, name: name, value: ^uint64(0)}
|
||||
}
|
||||
|
||||
type key struct {
|
||||
canId uint32
|
||||
unitId uint
|
||||
@@ -119,13 +116,14 @@ func StartProtocolParsing(frames <-chan *can.CanFrame) <-chan *Event {
|
||||
f.last = now
|
||||
if f.value != val {
|
||||
f.value = val
|
||||
f.setter(val)
|
||||
obj := f.setter(val)
|
||||
result <- &Event{
|
||||
Field: f.name,
|
||||
ActionName: param.name,
|
||||
Object: param.object,
|
||||
UnitId: unitId,
|
||||
Updated: now,
|
||||
Value: obj,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+608
-304
File diff suppressed because it is too large
Load Diff
+1
-1
@@ -192,7 +192,7 @@ func (d DebugSwitchModeType) String() string {
|
||||
case DEBUG_SWITCH_MODE_PERMANENT_ON:
|
||||
return "PERMANENT_ON"
|
||||
default:
|
||||
panic("DebugSwitchModeType not defended")
|
||||
return fmt.Sprintf("DebugSwitchModeType_%d", d)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+152
-152
@@ -2,252 +2,252 @@ package yabl
|
||||
|
||||
type ContactorInternalState struct {
|
||||
UnitId uint
|
||||
ContactorReady BoardReadyType
|
||||
ContactorOn BooleanType
|
||||
UnexpectedState ErrorType
|
||||
Isolated ErrorType
|
||||
DebugEnabled BooleanType
|
||||
ContactorReady *BoardReadyType
|
||||
ContactorOn *BooleanType
|
||||
UnexpectedState *ErrorType
|
||||
Isolated *ErrorType
|
||||
DebugEnabled *BooleanType
|
||||
}
|
||||
|
||||
type ContactorInternalErrors struct {
|
||||
UnitId uint
|
||||
BoardReady BoardReadyType
|
||||
OtherError ContactorInternalOtherErrorType
|
||||
ContactorGroupChanged ContactorGroupChangedType
|
||||
UnexpectedFormation ContactorInternalOtherErrorType
|
||||
CpuNotReady ErrorType
|
||||
PuNotReady ErrorType
|
||||
Debug BooleanType
|
||||
PresentContactorMode ContactorModeType
|
||||
BoardReady *BoardReadyType
|
||||
OtherError *ContactorInternalOtherErrorType
|
||||
ContactorGroupChanged *ContactorGroupChangedType
|
||||
UnexpectedFormation *ContactorInternalOtherErrorType
|
||||
CpuNotReady *ErrorType
|
||||
PuNotReady *ErrorType
|
||||
Debug *BooleanType
|
||||
PresentContactorMode *ContactorModeType
|
||||
}
|
||||
|
||||
type ContactorsInternalForce struct {
|
||||
UnitId uint
|
||||
ForceModeEnabled BooleanType
|
||||
ForceModeValue ForceModeType
|
||||
ForceModeEnabled *BooleanType
|
||||
ForceModeValue *ForceModeType
|
||||
}
|
||||
|
||||
type ContactorInternalDebug struct {
|
||||
UnitId uint
|
||||
DebugModeOn BooleanType
|
||||
DebugContactorOn DebugSwitchModeType
|
||||
DebugModeOn *BooleanType
|
||||
DebugContactorOn *DebugSwitchModeType
|
||||
}
|
||||
|
||||
type PuPresentEnergy struct {
|
||||
UnitId uint
|
||||
V2GMode V2GModeType
|
||||
VoltageBefore Voltage11BitType
|
||||
VoltageAfter Voltage11BitType
|
||||
PresentCurrent Current10BitType
|
||||
V2GMode *V2GModeType
|
||||
VoltageBefore *Voltage11BitType
|
||||
VoltageAfter *Voltage11BitType
|
||||
PresentCurrent *Current10BitType
|
||||
}
|
||||
|
||||
type PuPeriphery struct {
|
||||
UnitId uint
|
||||
ConnectorInsert BooleanType
|
||||
ContactorOn BooleanType
|
||||
ConnectorLocked BooleanType
|
||||
CpLineLevel CpLineLevelType
|
||||
IsolationState IsolationStateType
|
||||
ChargingAllowed BooleanType
|
||||
PwmEnabled BooleanType
|
||||
CpLineVoltage Voltage9BitType
|
||||
ConnectorInsert *BooleanType
|
||||
ContactorOn *BooleanType
|
||||
ConnectorLocked *BooleanType
|
||||
CpLineLevel *CpLineLevelType
|
||||
IsolationState *IsolationStateType
|
||||
ChargingAllowed *BooleanType
|
||||
PwmEnabled *BooleanType
|
||||
CpLineVoltage *Voltage9BitType
|
||||
}
|
||||
|
||||
type LogicAuth struct {
|
||||
UnitId uint
|
||||
AuthMode AuthModeType
|
||||
AuthState AuthStateType
|
||||
AuthMode *AuthModeType
|
||||
AuthState *AuthStateType
|
||||
}
|
||||
|
||||
type LogicEnergyMode struct {
|
||||
UnitId uint
|
||||
V2gMode V2GModeType
|
||||
CurrentMax Current10BitType
|
||||
VoltageMax Voltage11BitType
|
||||
PowerMax Power14BitType
|
||||
V2gMode *V2GModeType
|
||||
CurrentMax *Current10BitType
|
||||
VoltageMax *Voltage11BitType
|
||||
PowerMax *Power14BitType
|
||||
}
|
||||
|
||||
type LogicErrors struct {
|
||||
UnitId uint
|
||||
BoardReady BoardReadyType
|
||||
NotReadySettings ErrorType
|
||||
BoardReady *BoardReadyType
|
||||
NotReadySettings *ErrorType
|
||||
}
|
||||
|
||||
type LogicWorkingMode struct {
|
||||
UnitId uint
|
||||
TargetContactorMode ContactorModeType
|
||||
Availability BooleanType
|
||||
TargetContactorMode *ContactorModeType
|
||||
Availability *BooleanType
|
||||
}
|
||||
|
||||
type CpuPresentEnergy struct {
|
||||
UnitId uint
|
||||
PowerDirectionMode V2GModeType
|
||||
PresentCurrent Current10BitType
|
||||
PresentVoltage Voltage11BitType
|
||||
PowerDirectionMode *V2GModeType
|
||||
PresentCurrent *Current10BitType
|
||||
PresentVoltage *Voltage11BitType
|
||||
}
|
||||
|
||||
type CpuPeriphery struct {
|
||||
UnitId uint
|
||||
ContactorInput BooleanType
|
||||
CircuitBreakerInput BooleanType
|
||||
CircuitBreakerPowerCBInput BooleanType
|
||||
ContactorInput *BooleanType
|
||||
CircuitBreakerInput *BooleanType
|
||||
CircuitBreakerPowerCBInput *BooleanType
|
||||
}
|
||||
|
||||
type CpuEnergySettings struct {
|
||||
UnitId uint
|
||||
CurrentMax Current10BitType
|
||||
VoltageMax Voltage11BitType
|
||||
PowerMax Power14BitType
|
||||
TargetBatteryVoltage Voltage11BitType
|
||||
TargetGoalVoltage Voltage11BitType
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
DebugModeOn *BooleanType
|
||||
DebugContactorOutputOn *DebugSwitchModeType
|
||||
}
|
||||
|
||||
type SeccTargetEnergy struct {
|
||||
UnitId uint
|
||||
TargetChargingAllow BooleanType
|
||||
TargetBatteryVoltage Voltage11BitType
|
||||
TargetGoalVoltage Voltage11BitType
|
||||
TargetCurrent Current10BitType
|
||||
TargetChargingAllow *BooleanType
|
||||
TargetBatteryVoltage *Voltage11BitType
|
||||
TargetGoalVoltage *Voltage11BitType
|
||||
TargetCurrent *Current10BitType
|
||||
}
|
||||
|
||||
type SeccErrors struct {
|
||||
UnitId uint
|
||||
BoardReady BoardReadyType
|
||||
NotReadyLogic ErrorType
|
||||
BoardReady *BoardReadyType
|
||||
NotReadyLogic *ErrorType
|
||||
}
|
||||
|
||||
type PeripheryState struct {
|
||||
UnitId uint
|
||||
OtherErrorSeverity BoardReadyType
|
||||
OtherError OtherError4BitType
|
||||
ErrorShakeSensor ErrorType
|
||||
ErrorCoolingGroup ErrorType
|
||||
PeripheryErrorCoolingGroup ErrorType
|
||||
ErrorFireEmergency ErrorType
|
||||
ErrorFireEmergencyRun ErrorType
|
||||
ErrorFireEmergencyControl ErrorType
|
||||
ErrorOvervoltageIn ErrorType
|
||||
PeripheryErrorPowerSupply ErrorType
|
||||
ErrorFan ErrorType
|
||||
ErrorOvervoltageOut ErrorType
|
||||
ErrorStateRemoteMode ErrorType
|
||||
DebugShsnFanEnabled BooleanType
|
||||
DebugShptFanEnabled BooleanType
|
||||
DebugIoBoardTestLampEnabled BooleanType
|
||||
ErrorFireEmergencyCircuitBreaker ErrorType
|
||||
ErrorExtLightCircuitBreaker ErrorType
|
||||
ErrorIndicationCircuitBreaker ErrorType
|
||||
ErrorLowVoltagePowerCircuitBreaker ErrorType
|
||||
ErrorContactorsInternalCircuitBreaker ErrorType
|
||||
ErrorPlcCircuitBreaker ErrorType
|
||||
OtherErrorSeverity *BoardReadyType
|
||||
OtherError *OtherError4BitType
|
||||
ErrorShakeSensor *ErrorType
|
||||
ErrorCoolingGroup *ErrorType
|
||||
PeripheryErrorCoolingGroup *ErrorType
|
||||
ErrorFireEmergency *ErrorType
|
||||
ErrorFireEmergencyRun *ErrorType
|
||||
ErrorFireEmergencyControl *ErrorType
|
||||
ErrorOvervoltageIn *ErrorType
|
||||
PeripheryErrorPowerSupply *ErrorType
|
||||
ErrorFan *ErrorType
|
||||
ErrorOvervoltageOut *ErrorType
|
||||
ErrorStateRemoteMode *ErrorType
|
||||
DebugShsnFanEnabled *BooleanType
|
||||
DebugShptFanEnabled *BooleanType
|
||||
DebugIoBoardTestLampEnabled *BooleanType
|
||||
ErrorFireEmergencyCircuitBreaker *ErrorType
|
||||
ErrorExtLightCircuitBreaker *ErrorType
|
||||
ErrorIndicationCircuitBreaker *ErrorType
|
||||
ErrorLowVoltagePowerCircuitBreaker *ErrorType
|
||||
ErrorContactorsInternalCircuitBreaker *ErrorType
|
||||
ErrorPlcCircuitBreaker *ErrorType
|
||||
}
|
||||
|
||||
type PeripheryInfo struct {
|
||||
UnitId uint
|
||||
InfoDoorOpen BooleanType
|
||||
TempAirIn SignedAirTemp8BitType
|
||||
TempAirOut SignedAirTemp8BitType
|
||||
StateShsnFan BooleanType
|
||||
StateShptFan BooleanType
|
||||
InfoDoorOpen *BooleanType
|
||||
TempAirIn *SignedAirTemp8BitType
|
||||
TempAirOut *SignedAirTemp8BitType
|
||||
StateShsnFan *BooleanType
|
||||
StateShptFan *BooleanType
|
||||
}
|
||||
|
||||
type PeripheryDebug struct {
|
||||
UnitId uint
|
||||
DebugModeOn BooleanType
|
||||
DebugShsnFan DebugSwitchModeType
|
||||
DebugShptFan DebugSwitchModeType
|
||||
DebugIoBoardTestLamp DebugSwitchModeType
|
||||
DebugModeOn *BooleanType
|
||||
DebugShsnFan *DebugSwitchModeType
|
||||
DebugShptFan *DebugSwitchModeType
|
||||
DebugIoBoardTestLamp *DebugSwitchModeType
|
||||
}
|
||||
|
||||
type ConverterPresentEnergy struct {
|
||||
UnitId uint
|
||||
V2gMode V2GModeType
|
||||
PresentVoltage Voltage11BitType
|
||||
PresentCurrent Current10BitType
|
||||
ConnectedOut ConnectedOut8bitType
|
||||
V2gMode *V2GModeType
|
||||
PresentVoltage *Voltage11BitType
|
||||
PresentCurrent *Current10BitType
|
||||
ConnectedOut *ConnectedOut8bitType
|
||||
}
|
||||
|
||||
type ConverterErrors struct {
|
||||
UnitId uint
|
||||
BoardReady BoardReadyType
|
||||
OtherError OtherError4BitType
|
||||
NotConnectedOut ErrorType
|
||||
NoCommunicationConverter ErrorType
|
||||
NoCommunicationPuConverter ErrorType
|
||||
InputGridVoltageHigh ErrorType
|
||||
InputGridVoltageLow ErrorType
|
||||
OutputGridVoltageHigh ErrorType
|
||||
OutputGridVoltageLow ErrorType
|
||||
InputGridVoltage Voltage11BitType
|
||||
OutputGridVoltage Voltage11BitType
|
||||
ShortCircuit ErrorType
|
||||
OverHeat ErrorType
|
||||
FanBroken ErrorType
|
||||
OtherHardwareError ErrorType
|
||||
DebugConvEnabled BooleanType
|
||||
DebugConvDisabled BooleanType
|
||||
BoardReady *BoardReadyType
|
||||
OtherError *OtherError4BitType
|
||||
NotConnectedOut *ErrorType
|
||||
NoCommunicationConverter *ErrorType
|
||||
NoCommunicationPuConverter *ErrorType
|
||||
InputGridVoltageHigh *ErrorType
|
||||
InputGridVoltageLow *ErrorType
|
||||
OutputGridVoltageHigh *ErrorType
|
||||
OutputGridVoltageLow *ErrorType
|
||||
InputGridVoltage *Voltage11BitType
|
||||
OutputGridVoltage *Voltage11BitType
|
||||
ShortCircuit *ErrorType
|
||||
OverHeat *ErrorType
|
||||
FanBroken *ErrorType
|
||||
OtherHardwareError *ErrorType
|
||||
DebugConvEnabled *BooleanType
|
||||
DebugConvDisabled *BooleanType
|
||||
}
|
||||
|
||||
type ConverterDebug struct {
|
||||
UnitId uint
|
||||
DebugModeOn BooleanType
|
||||
DebugEnergyOn DebugSwitchModeType
|
||||
DebugTargetVoltage Voltage11BitType
|
||||
DebugTargetCurrent Current10BitType
|
||||
DebugModeOn *BooleanType
|
||||
DebugEnergyOn *DebugSwitchModeType
|
||||
DebugTargetVoltage *Voltage11BitType
|
||||
DebugTargetCurrent *Current10BitType
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user