Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func New ¶
func New(device *controller.BusDevice, updateChan chan<- (*DeviceBattery)) controller.FunctionalDevice
New creates a device representing a standard BattGO compatible battery. When the internal data is updated, it will write a reference to itself on updateChan.
Types ¶
type BatteryData ¶
type BatteryData struct {
sync.RWMutex
Connected bool
LastData time.Time
BusAddress uint8
Serial string
ManufacturerName string
BatteryType BatteryType
CellDischargeCutOffV float32
CellDischargeNormalV float32
CellChargeMaxV float32
CellStorageDefaultV float32
CellCapacityAh float32
BatteryChargeMaxCurrentA float32
BatteryDischargeMaxCurrentA float32
TempUseLowC int
TempUseHighC int
TempStorageLowC int
TempStorageHighC int
BatteryHasAutoDischarge bool
BatteryNumberOfCells int
BatteryPreferredChargeCurrentA float32
CellPreferredStorageVoltageV float32
CellPreferredMaxVoltageV float32
BatterySelfDischargeEnabled bool
BatterySelfDischargeHours int
BatteryChargeCycles int
BatteryErrorOverCharged int
BatteryErrorOverDischarged int
BatteryErrorOverTemperature int
TempCurrentC int
CellVoltageV []float32
}
type BatteryType ¶
type BatteryType int
const ( BatteryTypeLiHv BatteryType = 0 BatteryTypeLiPo BatteryType = 1 BatteryTypeLiIon BatteryType = 2 BatteryTypeLiFe BatteryType = 3 BatteryTypePb BatteryType = 5 BatteryTypeNiMH BatteryType = 6 )
type DeviceBattery ¶
type DeviceBattery struct {
Data BatteryData
// contains filtered or unexported fields
}
func (*DeviceBattery) Access ¶
func (d *DeviceBattery) Access() (bool, error)
Access is an internal function that should only be called by the controller.
func (*DeviceBattery) Disconnected ¶
func (d *DeviceBattery) Disconnected() error
Disconnected is an internal function that should only be called by the controller.
func (*DeviceBattery) SetConfiguration ¶
func (d *DeviceBattery) SetConfiguration(chargeCurrentA float32, storageVoltageV float32, maxVoltageV float32, dischargeHours float32) (bool, error)
SetConfiguration will write a new configuration to the battery. Self discharge is disabled when dischargeHours is negative.
Click to show internal directories.
Click to hide internal directories.