You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
406 lines
18 KiB
406 lines
18 KiB
package yabl
|
|
|
|
import "cli-mon/can"
|
|
|
|
func (c *converter) initialize() {
|
|
c.protocolMap = make(map[key]action)
|
|
|
|
for i := uint(1); i <= CONNECTOR_COUNT; i++ {
|
|
key := key{can.CAN_ID_011, i}
|
|
cpe := &CpuPresentEnergy{unit: 1}
|
|
c.cpuPresentEnergyArray[i] = cpe
|
|
fields := []*field{
|
|
{length: 2, setter: cpe.setPowerDirectionMode, name: FPowerDirectionMode},
|
|
{length: 10, setter: cpe.setPresentCurrent, name: FPresentCurrent},
|
|
{length: 11, setter: cpe.setPresentVoltage, name: FPresentVoltage},
|
|
}
|
|
c.protocolMap[key] = action{fields: fields, interval: 50, name: PCpuPresentEnergy, object: cpe}
|
|
}
|
|
|
|
c.cpuPeripheryInstance = &CpuPeriphery{unit: 0}
|
|
fields := []*field{
|
|
{length: 2, setter: c.cpuPeripheryInstance.setContactorInput, name: FContactorInput},
|
|
{length: 2, setter: c.cpuPeripheryInstance.setCircuitBreakerInput, name: FCircuitBreakerInput},
|
|
{length: 2, setter: c.cpuPeripheryInstance.setCircuitBreakerPowerCBInput, name: FCircuitBreakerPowerCBInput},
|
|
}
|
|
c.protocolMap[key{can.CAN_ID_014, 0}] = action{
|
|
fields: fields,
|
|
interval: 1000,
|
|
name: PCpuPeriphery,
|
|
object: c.cpuPeripheryInstance,
|
|
}
|
|
|
|
for i := uint(0); i <= CONNECTOR_COUNT; i++ {
|
|
key := key{can.CAN_ID_015, i}
|
|
ces := &CpuEnergySettings{unit: unit(i)}
|
|
c.cpuEnergySettingsArray[i] = ces
|
|
fields := []*field{
|
|
{length: 10, setter: ces.setCurrentMax, name: FCurrentMax},
|
|
{length: 11, setter: ces.setVoltageMax, name: FVoltageMax},
|
|
{length: 14, setter: ces.setPowerMax, name: FPowerMax},
|
|
{length: 11, setter: ces.setTargetBatteryVoltage, name: FTargetBatteryVoltage},
|
|
{length: 11, setter: ces.setTargetGoalVoltage, name: FTargetGoalVoltage},
|
|
}
|
|
c.protocolMap[key] = action{fields: fields, interval: 1000, name: PCpuEnergySettings, object: ces}
|
|
}
|
|
|
|
c.cpuErrorsInstance = &CpuErrors{unit: 0}
|
|
fields = []*field{
|
|
{length: 3, setter: c.cpuErrorsInstance.setBoardReady, name: FBoardReady},
|
|
{length: 4, setter: c.cpuErrorsInstance.setOtherError, name: FOtherError},
|
|
{length: 2, setter: c.cpuErrorsInstance.setRedButtonHard, name: FRedButtonHard},
|
|
{length: 2, setter: c.cpuErrorsInstance.setRedButtonSoft, name: FRedButtonSoft},
|
|
{length: 2, setter: c.cpuErrorsInstance.setModulesGone, name: FModulesGone},
|
|
{length: 2, setter: c.cpuErrorsInstance.setGridVoltageHighErr, name: FGridVoltageHighErr},
|
|
{length: 2, setter: c.cpuErrorsInstance.setGridVoltageHighWarn, name: FGridVoltageHighWarn},
|
|
{length: 2, setter: c.cpuErrorsInstance.setGridVoltageLowWarn, name: FGridVoltageLowWarn},
|
|
{length: 2, setter: c.cpuErrorsInstance.setGridVoltageLowErr, name: FGridVoltageLowErr},
|
|
{length: 11, setter: c.cpuErrorsInstance.setGridVoltageLow, name: FGridVoltageLow},
|
|
{length: 11, setter: c.cpuErrorsInstance.setGridVoltageHigh, name: FGridVoltageHigh},
|
|
{length: 2, setter: c.cpuErrorsInstance.setGridVoltageEmpty, name: FGridVoltageEmpty},
|
|
{length: 2, setter: c.cpuErrorsInstance.setNotReadySecc, name: FNotReadySecc},
|
|
{length: 2, setter: c.cpuErrorsInstance.setNotReadyPu, name: FNotReadyPu},
|
|
{length: 2, setter: c.cpuErrorsInstance.setNotReadyContactors, name: FNotReadyContactors},
|
|
{length: 2, setter: c.cpuErrorsInstance.setDebugConvertersEnabled, name: FDebugConvertersEnabled},
|
|
{length: 2, setter: c.cpuErrorsInstance.setContactorInputError, name: FContactorInputError},
|
|
{length: 2, setter: c.cpuErrorsInstance.setNotReadyPeriphery, name: FNotReadyPeriphery},
|
|
}
|
|
c.protocolMap[key{can.CAN_ID_016, 0}] = action{
|
|
fields: fields,
|
|
interval: 1000,
|
|
name: PCpuErrors,
|
|
object: c.cpuErrorsInstance,
|
|
}
|
|
|
|
c.cpuDebugInstance = &CpuDebug{unit: 0}
|
|
fields = []*field{
|
|
{length: 2, setter: c.cpuDebugInstance.setDebugModeOn, name: FDebugModeOn},
|
|
{length: 3, setter: c.cpuDebugInstance.setDebugContactorInputOn, name: FDebugContactorInputOn},
|
|
{length: 3, setter: c.cpuDebugInstance.setDebugCircuitBreakerOn, name: FDebugCircuitBreakerOn},
|
|
{length: 3, setter: c.cpuDebugInstance.setDebugRedButtonSoftware, name: FDebugRedButtonSoftware},
|
|
}
|
|
c.protocolMap[key{can.CAN_ID_01A, 0}] = action{
|
|
fields: fields,
|
|
interval: 1000,
|
|
name: PCpuDebug,
|
|
object: c.cpuDebugInstance,
|
|
}
|
|
|
|
for i := uint(1); i <= CONNECTOR_COUNT; i++ {
|
|
key := key{can.CAN_ID_021, i}
|
|
ppe := &PuPresentEnergy{unit: unit(i)}
|
|
c.puPresentEnergyArray[i] = ppe
|
|
fields := []*field{
|
|
{length: 2, setter: ppe.setV2GMode, name: FV2GMode},
|
|
{length: 11, setter: ppe.setVoltageBefore, name: FVoltageBefore},
|
|
{length: 11, setter: ppe.setVoltageAfter, name: FVoltageAfter},
|
|
{length: 10, setter: ppe.setPresentCurrent, name: FPresentCurrent},
|
|
}
|
|
c.protocolMap[key] = action{fields: fields, interval: 50, name: PPuPresentEnergy, object: ppe}
|
|
}
|
|
|
|
for i := uint(1); i <= CONNECTOR_COUNT; i++ {
|
|
key := key{can.CAN_ID_022, i}
|
|
pp := &PuPeriphery{unit: unit(i)}
|
|
c.puPeripheryArray[i] = pp
|
|
fields := []*field{
|
|
{length: 2, setter: pp.setConnectorInsert, name: FConnectorInsert},
|
|
{length: 2, setter: pp.setContactorOn, name: FContactorOn},
|
|
{length: 2, setter: pp.setConnectorLocked, name: FConnectorLocked},
|
|
{length: 3, setter: pp.setCpLineLevel, name: FCpLineLevel},
|
|
{length: 3, setter: pp.setIsolationState, name: FIsolationState},
|
|
{length: 2, setter: pp.setChargingAllowed, name: FChargingAllowed},
|
|
{length: 2, setter: pp.setPwmEnabled, name: FPwmEnabled},
|
|
{length: 9, setter: pp.setCpLineVoltage, name: FCpLineVoltage},
|
|
}
|
|
c.protocolMap[key] = action{fields: fields, interval: 1000, name: PPuPeriphery, object: pp}
|
|
}
|
|
|
|
for i := uint(1); i <= CONNECTOR_COUNT; i++ {
|
|
key := key{can.CAN_ID_023, i}
|
|
pe := &PuErrors{unit: 1}
|
|
c.puErrorsArray[i] = pe
|
|
fields := []*field{
|
|
{length: 3, setter: pe.setBoardReady, name: FBoardReady},
|
|
{length: 4, setter: pe.setOtherError, name: FOtherError},
|
|
{length: 2, setter: pe.setIncorrectVoltage, name: FIncorrectVoltage},
|
|
{length: 11, setter: pe.setIncorrectVoltageValue, name: FIncorrectVoltageValue},
|
|
{length: 2, setter: pe.setIncorrectCurrent, name: FIncorrectCurrent},
|
|
{length: 10, setter: pe.setIncorrectCurrentValue, name: FIncorrectCurrentValue},
|
|
{length: 2, setter: pe.setIsolationBroken, name: FIsolationBroken},
|
|
{length: 2, setter: pe.setCpLineBroken, name: FCpLineBroken},
|
|
{length: 2, setter: pe.setCpLineGap69, name: FCpLineGap69},
|
|
{length: 3, setter: pe.setCableReady, name: FCableReady},
|
|
{length: 2, setter: pe.setNotReadyCpu, name: FNotReadyCpu},
|
|
{length: 2, setter: pe.setNotReadySecc, name: FNotReadySecc},
|
|
{length: 2, setter: pe.setContactorOutputError, name: FContactorOutputError},
|
|
{length: 2, setter: pe.setDebugContactorOutputEnabled, name: FDebugContactorOutputEnabled},
|
|
{length: 2, setter: pe.setOutputCircuitBreakerEnabled, name: FOutputCircuitBreakerEnabled},
|
|
{length: 12, setter: pe.setOutputCircuitBreakerEnabledValue, name: FOutputCircuitBreakerEnabledValue},
|
|
}
|
|
c.protocolMap[key] = action{fields: fields, interval: 1000, name: PPuErrors, object: pe}
|
|
}
|
|
|
|
for i := uint(0); i <= CONNECTOR_COUNT; i++ {
|
|
key := key{can.CAN_ID_02A, i}
|
|
pd := &PuDebug{unit: unit(i)}
|
|
c.puDebugArray[i] = pd
|
|
fields = []*field{
|
|
{length: 2, setter: pd.setDebugModeOn, name: FDebugModeOn},
|
|
{length: 3, setter: pd.setDebugContactorOutputOn, name: FDebugContactorOutputOn},
|
|
}
|
|
c.protocolMap[key] = action{fields: fields, interval: 1000, name: PPuDebug, object: pd}
|
|
}
|
|
|
|
for i := uint(1); i <= CONNECTOR_COUNT; i++ {
|
|
key := key{can.CAN_ID_041, i}
|
|
ste := &SeccTargetEnergy{unit: unit(i)}
|
|
c.seccTargetEnergyArray[i] = ste
|
|
fields = []*field{
|
|
{length: 2, setter: ste.setTargetChargingAllow, name: FTargetChargingAllow},
|
|
{length: 11, setter: ste.setTargetBatteryVoltage, name: FTargetBatteryVoltage},
|
|
{length: 11, setter: ste.setTargetGoalVoltage, name: FTargetGoalVoltage},
|
|
{length: 10, setter: ste.setTargetCurrent, name: FTargetCurrent},
|
|
}
|
|
c.protocolMap[key] = action{fields: fields, interval: 1000, name: PSeccTargetEnergy, object: ste}
|
|
}
|
|
|
|
for i := uint(1); i <= CONNECTOR_COUNT; i++ {
|
|
key := key{can.CAN_ID_042, i}
|
|
se := &SeccErrors{unit: unit(i)}
|
|
c.seccErrorsArray[i] = se
|
|
fields = []*field{
|
|
{length: 3, setter: se.setBoardReady, name: FBoardReady},
|
|
{length: 2, setter: se.setNotReadyLogic, name: FNotReadyLogic},
|
|
}
|
|
c.protocolMap[key] = action{fields: fields, interval: 1000, name: PSeccErrors, object: se}
|
|
}
|
|
|
|
for i := uint(0); i <= CONNECTOR_COUNT; i++ {
|
|
key := key{can.CAN_ID_046, i}
|
|
la := &LogicAuth{unit: unit(i)}
|
|
c.logicAuthArray[i] = la
|
|
fields = []*field{
|
|
{length: 2, setter: la.setAuthMode, name: FAuthMode},
|
|
{length: 3, setter: la.setAuthState, name: FAuthState},
|
|
}
|
|
c.protocolMap[key] = action{fields: fields, interval: 1000, name: PLogicAuth, object: la}
|
|
}
|
|
|
|
for i := uint(0); i <= CONNECTOR_COUNT; i++ {
|
|
key := key{can.CAN_ID_047, i}
|
|
lem := &LogicEnergyMode{unit: unit(i)}
|
|
c.logicEnergyMode[i] = lem
|
|
fields = []*field{
|
|
{length: 2, setter: lem.setV2gMode, name: FV2gMode},
|
|
{length: 10, setter: lem.setCurrentMax, name: FCurrentMax},
|
|
{length: 11, setter: lem.setVoltageMax, name: FVoltageMax},
|
|
{length: 14, setter: lem.setPowerMax, name: FPowerMax},
|
|
}
|
|
c.protocolMap[key] = action{fields: fields, interval: 1000, name: PLogicEnergyMode, object: lem}
|
|
}
|
|
|
|
c.logicErrorsInstance = &LogicErrors{unit: 0}
|
|
fields = []*field{
|
|
{length: 3, setter: c.logicErrorsInstance.setBoardReady, name: FBoardReady},
|
|
{length: 2, setter: c.logicErrorsInstance.setNotReadySettings, name: FNotReadySettings},
|
|
}
|
|
c.protocolMap[key{can.CAN_ID_048, 0}] = action{
|
|
fields: fields,
|
|
interval: 1000,
|
|
name: PLogicErrors,
|
|
object: c.logicErrorsInstance,
|
|
}
|
|
|
|
for i := uint(0); i <= CONNECTOR_COUNT; i++ {
|
|
key := key{can.CAN_ID_049, i}
|
|
lwm := &LogicWorkingMode{unit: unit(i)}
|
|
c.logicWorkingMode[i] = lwm
|
|
fields = []*field{
|
|
{length: 5, setter: lwm.setTargetContactorMode, name: FTargetContactorMode},
|
|
{length: 2, setter: lwm.setAvailability, name: FAvailability},
|
|
}
|
|
c.protocolMap[key] = action{
|
|
fields: fields,
|
|
interval: 1000,
|
|
name: PLogicWorkingMode,
|
|
object: lwm,
|
|
}
|
|
}
|
|
|
|
for i := uint(0); i < CONTACTOR_MAX; i++ {
|
|
key := key{can.CAN_ID_071, i}
|
|
cis := &ContactorInternalState{unit: unit(i)}
|
|
c.contactorInternalStateArray[i] = cis
|
|
fields = []*field{
|
|
{length: 3, setter: cis.setContactorReady, name: FContactorReady},
|
|
{length: 2, setter: cis.setContactorOn, name: FContactorOn},
|
|
{length: 2, setter: cis.setUnexpectedState, name: FUnexpectedState},
|
|
{length: 2, setter: cis.setIsolated, name: FIsolated},
|
|
{length: 2, setter: cis.setDebugEnabled, name: FDebugEnabled},
|
|
}
|
|
c.protocolMap[key] = action{fields: fields, interval: 1000, name: PContactorInternalState, object: cis}
|
|
}
|
|
|
|
c.contactorInternalErrorsInstance = &ContactorInternalErrors{unit: 0}
|
|
fields = []*field{
|
|
{length: 3, setter: c.contactorInternalErrorsInstance.setBoardReady, name: FBoardReady},
|
|
{length: 4, setter: c.contactorInternalErrorsInstance.setOtherError, name: FOtherError},
|
|
{length: 3, setter: c.contactorInternalErrorsInstance.setContactorGroupChanged, name: FContactorGroupChanged},
|
|
{length: 4, setter: c.contactorInternalErrorsInstance.setUnexpectedFormation, name: FUnexpectedFormation},
|
|
{length: 2, setter: c.contactorInternalErrorsInstance.setCpuNotReady, name: FCpuNotReady},
|
|
{length: 2, setter: c.contactorInternalErrorsInstance.setPuNotReady, name: FPuNotReady},
|
|
{length: 2, setter: c.contactorInternalErrorsInstance.setDebug, name: FDebug},
|
|
{length: 5, setter: c.contactorInternalErrorsInstance.setPresentContactorMode, name: FPresentContactorMode},
|
|
}
|
|
c.protocolMap[key{can.CAN_ID_073, 0}] = action{
|
|
fields: fields,
|
|
interval: 1000,
|
|
name: PContactorInternalErrors,
|
|
object: c.contactorInternalErrorsInstance,
|
|
}
|
|
|
|
c.contactorsInternalForce = &ContactorsInternalForce{unit: 0}
|
|
fields = []*field{
|
|
{length: 2, setter: c.contactorsInternalForce.setForceModeEnabled, name: FForceModeEnabled},
|
|
{length: 4, setter: c.contactorsInternalForce.setForceModeValue, name: FForceModeValue},
|
|
}
|
|
c.protocolMap[key{can.CAN_ID_074, 0}] = action{
|
|
fields: fields,
|
|
interval: 1000,
|
|
name: PContactorsInternalForce,
|
|
object: c.contactorsInternalForce,
|
|
}
|
|
|
|
for i := uint(0); i < CONTACTOR_MAX; i++ {
|
|
key := key{can.CAN_ID_075, i}
|
|
cid := &ContactorInternalDebug{unit: unit(i)}
|
|
c.contactorInternalDebugArray[i] = cid
|
|
fields = []*field{
|
|
{length: 2, setter: cid.setDebugModeOn, name: FDebugModeOn},
|
|
{length: 3, setter: cid.setDebugContactorOn, name: FDebugContactorOn},
|
|
}
|
|
c.protocolMap[key] = action{fields: fields, interval: 1000, name: PContactorInternalDebug, object: cid}
|
|
}
|
|
|
|
for i := uint(0); i <= CONNECTOR_COUNT; i++ {
|
|
key := key{can.CAN_ID_067, i}
|
|
ps := &PeripheryState{unit: unit(i)}
|
|
c.peripheryStateArray[i] = ps
|
|
fields = []*field{
|
|
{length: 3, setter: ps.setOtherErrorSeverity, name: FOtherErrorSeverity},
|
|
{length: 4, setter: ps.setOtherError, name: FOtherError},
|
|
{length: 2, setter: ps.setErrorShakeSensor, name: FErrorShakeSensor},
|
|
{length: 2, setter: ps.setErrorCoolingGroup, name: FErrorCoolingGroup},
|
|
{length: 2, setter: ps.setPeripheryErrorCoolingGroup, name: FPeripheryErrorCoolingGroup},
|
|
{length: 2, setter: ps.setErrorFireEmergency, name: FErrorFireEmergency},
|
|
{length: 2, setter: ps.setErrorFireEmergencyRun, name: FErrorFireEmergencyRun},
|
|
{length: 2, setter: ps.setErrorFireEmergencyControl, name: FErrorFireEmergencyControl},
|
|
{length: 2, setter: ps.setErrorOvervoltageIn, name: FErrorOvervoltageIn},
|
|
{length: 2, setter: ps.setPeripheryErrorPowerSupply, name: FPeripheryErrorPowerSupply},
|
|
{length: 2, setter: ps.setErrorFan, name: FErrorFan},
|
|
{length: 2, setter: ps.setErrorOvervoltageOut, name: FErrorOvervoltageOut},
|
|
{length: 2, setter: ps.setErrorStateRemoteMode, name: FErrorStateRemoteMode},
|
|
{length: 2, setter: ps.setDebugShsnFanEnabled, name: FDebugShsnFanEnabled},
|
|
{length: 2, setter: ps.setDebugShptFanEnabled, name: FDebugShptFanEnabled},
|
|
{length: 2, setter: ps.setDebugIoBoardTestLampEnabled, name: FDebugIoBoardTestLampEnabled},
|
|
{length: 2, setter: ps.setErrorFireEmergencyCircuitBreaker, name: FErrorFireEmergencyCircuitBreaker},
|
|
{length: 2, setter: ps.setErrorExtLightCircuitBreaker, name: FErrorExtLightCircuitBreaker},
|
|
{length: 2, setter: ps.setErrorIndicationCircuitBreaker, name: FErrorIndicationCircuitBreaker},
|
|
{length: 2, setter: ps.setErrorLowVoltagePowerCircuitBreaker, name: FErrorLowVoltagePowerCircuitBreaker},
|
|
{length: 2, setter: ps.setErrorContactorsInternalCircuitBreaker, name: FErrorContactorsInternalCircuitBreaker},
|
|
{length: 2, setter: ps.setErrorPlcCircuitBreaker, name: FErrorPlcCircuitBreaker},
|
|
}
|
|
c.protocolMap[key] = action{fields: fields, interval: 1000, name: PPeripheryState, object: ps}
|
|
}
|
|
|
|
for i := uint(0); i <= CONNECTOR_COUNT; i++ {
|
|
key := key{can.CAN_ID_068, i}
|
|
pi := &PeripheryInfo{unit: unit(i)}
|
|
c.peripheryInfoArray[i] = pi
|
|
fields = []*field{
|
|
{length: 2, setter: pi.setInfoDoorOpen, name: FInfoDoorOpen},
|
|
{length: 8, setter: pi.setTempAirIn, name: FTempAirIn},
|
|
{length: 8, setter: pi.setTempAirOut, name: FTempAirOut},
|
|
{length: 2, setter: pi.setStateShsnFan, name: FStateShsnFan},
|
|
{length: 2, setter: pi.setStateShptFan, name: FStateShptFan},
|
|
}
|
|
c.protocolMap[key] = action{fields: fields, interval: 5000, name: PPeripheryInfo, object: pi}
|
|
}
|
|
|
|
for i := uint(0); i <= CONNECTOR_COUNT; i++ {
|
|
key := key{can.CAN_ID_06C, i}
|
|
pd := &PeripheryDebug{unit: unit(i)}
|
|
c.peripheryDebugArray[i] = pd
|
|
fields = []*field{
|
|
{length: 2, setter: pd.setDebugModeOn, name: FDebugModeOn},
|
|
{length: 3, setter: pd.setDebugShsnFan, name: FDebugShsnFan},
|
|
{length: 3, setter: pd.setDebugShptFan, name: FDebugShptFan},
|
|
{length: 3, setter: pd.setDebugIoBoardTestLamp, name: FDebugIoBoardTestLamp},
|
|
}
|
|
c.protocolMap[key] = action{fields: fields, interval: 1000, name: PPeripheryDebug, object: pd}
|
|
}
|
|
|
|
for i := uint(1); i < CONVERTERS_MAX; i++ {
|
|
key := key{can.CAN_ID_061, i}
|
|
cpe := &ConverterPresentEnergy{unit: unit(i)}
|
|
c.converterPresentEnergyArray[i] = cpe
|
|
fields = []*field{
|
|
{length: 2, setter: cpe.setV2gMode, name: FV2gMode},
|
|
{length: 11, setter: cpe.setPresentVoltage, name: FPresentVoltage},
|
|
{length: 10, setter: cpe.setPresentCurrent, name: FPresentCurrent},
|
|
{length: 8, setter: cpe.setConnectedOut, name: FConnectedOut},
|
|
}
|
|
c.protocolMap[key] = action{fields: fields, interval: 500, name: PConverterPresentEnergy, object: cpe}
|
|
}
|
|
|
|
for i := uint(1); i < CONVERTERS_MAX; i++ {
|
|
key := key{can.CAN_ID_062, i}
|
|
ce := &ConverterErrors{unit: unit(i)}
|
|
c.converterErrorsArray[i] = ce
|
|
fields = []*field{
|
|
{length: 3, setter: ce.setBoardReady, name: FBoardReady},
|
|
{length: 4, setter: ce.setOtherError, name: FOtherError},
|
|
{length: 2, setter: ce.setNotConnectedOut, name: FNotConnectedOut},
|
|
{length: 2, setter: ce.setNoCommunicationConverter, name: FNoCommunicationConverter},
|
|
{length: 2, setter: ce.setNoCommunicationPuConverter, name: FNoCommunicationPuConverter},
|
|
{length: 2, setter: ce.setInputGridVoltageHigh, name: FInputGridVoltageHigh},
|
|
{length: 2, setter: ce.setInputGridVoltageLow, name: FInputGridVoltageLow},
|
|
{length: 2, setter: ce.setOutputGridVoltageHigh, name: FOutputGridVoltageHigh},
|
|
{length: 2, setter: ce.setOutputGridVoltageLow, name: FOutputGridVoltageLow},
|
|
{length: 11, setter: ce.setInputGridVoltage, name: FInputGridVoltage},
|
|
{length: 11, setter: ce.setOutputGridVoltage, name: FOutputGridVoltage},
|
|
{length: 2, setter: ce.setShortCircuit, name: FShortCircuit},
|
|
{length: 2, setter: ce.setOverHeat, name: FOverHeat},
|
|
{length: 2, setter: ce.setFanBroken, name: FFanBroken},
|
|
{length: 2, setter: ce.setOtherHardwareError, name: FOtherHardwareError},
|
|
{length: 2, setter: ce.setDebugConvEnabled, name: FDebugConvEnabled},
|
|
{length: 2, setter: ce.setDebugConvDisabled, name: FDebugConvDisabled},
|
|
}
|
|
c.protocolMap[key] = action{fields: fields, interval: 1000, name: PConverterErrors, object: ce}
|
|
}
|
|
|
|
for i := uint(0); i < CONVERTERS_MAX; i++ {
|
|
key := key{can.CAN_ID_065, i}
|
|
cd := &ConverterDebug{unit: unit(i)}
|
|
c.converterDebugArray[i] = cd
|
|
fields = []*field{
|
|
{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},
|
|
}
|
|
c.protocolMap[key] = action{fields: fields, interval: 1000, name: PConverterDebug, object: cd}
|
|
}
|
|
|
|
// set "null" values
|
|
for _, element := range c.protocolMap {
|
|
var from uint8 = 0
|
|
for _, f := range element.fields {
|
|
var mask uint64 = ^(ALL_BITS << f.length)
|
|
mask = mask << from
|
|
f.value = mask
|
|
from += f.length
|
|
}
|
|
}
|
|
}
|
|
|