Line 80... |
Line 80... |
80 |
|
80 |
|
81 |
|
81 |
|
82 |
cfg.initialize() |
82 |
cfg.initialize() |
83 |
guage = cfg.get_device("guage") |
83 |
guage = cfg.get_device("guage") |
84 |
|
84 |
|
85 |
#flash = guage.ReadFlashBlock(48, 2) |
- |
|
86 |
#print " ".join([hex(i) for i in flash]) |
- |
|
87 |
|
- |
|
88 |
#print hex(guage.PackConfiguration()) |
85 |
print "Pack Configuration", hex(guage.PackConfiguration()) |
89 |
|
- |
|
90 |
#guage.WriteFlashByte(48, 0, 21, 0x0D) # Design Capacity 3350 mAh |
- |
|
91 |
#guage.WriteFlashByte(48, 0, 22, 0x16) # |
- |
|
92 |
#guage.WriteFlashByte(48, 0, 23, 0x5E) # Design Energy 24120 mWh |
- |
|
93 |
#guage.WriteFlashByte(48, 0, 24, 0x38) # |
- |
|
94 |
#guage.WriteFlashByte(64, 0, 0, 0x9) # External Voltage Measurement |
- |
|
95 |
#guage.WriteFlashByte(64, 0, 7, 0x2) # Two Cells |
- |
|
96 |
#guage.WriteFlashByte(64, 0, 4, 0x74) # 8 LED (1+7), Shift Register |
- |
|
97 |
#guage.WriteFlashByte(104, 0, 14, 0x28) # Voltage Measurement Range 10240 mV |
- |
|
98 |
#guage.WriteFlashByte(104, 0, 15, 0x00) # |
- |
|
99 |
#guage.reset() # Reset Guage |
- |
|
100 |
|
86 |
|
101 |
#flash = guage.ReadFlashBlock(112, 0) |
87 |
#flash = guage.ReadFlashBlock(112, 0) |
102 |
#print "112 - ", |
88 |
#print "112 - ", |
103 |
#print " ".join([hex(i) for i in flash]) |
89 |
#print " ".join([hex(i) for i in flash]) |
104 |
|
90 |
|
105 |
|
- |
|
106 |
#ReadFlash(2, 0, 'OT Chg', 'I2', '0.1 degC') |
91 |
#ReadFlash(2, 0, 'OT Chg', 'I2', '0.1 degC') |
107 |
#ReadFlash(112, 8, 'Authen Key3', 'H4', '-') |
92 |
#ReadFlash(112, 8, 'Authen Key3', 'H4', '-') |
108 |
|
93 |
|
109 |
for i in range(len(df)): |
94 |
for i in range(len(df)): |
110 |
ReadFlash(df['SubclassID'][i], df['Offset'][i], df['Name'][i], df['DataType'][i], df['Units'][i], df['DefaultValue'][i]) |
95 |
ReadFlash(df['SubclassID'][i], df['Offset'][i], df['Name'][i], df['DataType'][i], df['Units'][i], df['DefaultValue'][i]) |
111 |
|
96 |
|
112 |
|
97 |
|
113 |
for i in range(4): |
98 |
while True: |
114 |
# Battery status readout |
99 |
# Battery status readout |
115 |
print "NominalAvailableCapacity =", guage.NominalAvailableCapacity(), "mAh, FullAvailabeCapacity =", guage.FullAvailabeCapacity(), "mAh, AvailableEnergy =", guage.AvailableEnergy(), "* 10 mWh" |
100 |
print "NominalAvailableCapacity =", guage.NominalAvailableCapacity(), "mAh, FullAvailabeCapacity =", guage.FullAvailabeCapacity(), "mAh, AvailableEnergy =", guage.AvailableEnergy(), "* 10 mWh" |
116 |
print "Temp =", guage.getTemp(), "degC, RemainCapacity =", guage.getRemainingCapacity(), "mAh, cap =", guage.FullChargeCapacity(), "mAh, U =", guage.Voltage(), "mV, I =", guage.AverageCurrent(), "mA, charge =", guage.StateOfCharge(), "%" |
101 |
print "Temp =", guage.getTemp(), "degC, RemainCapacity =", guage.getRemainingCapacity(), "mAh, cap =", guage.FullChargeCapacity(), "mAh, U =", guage.Voltage(), "mV, I =", guage.AverageCurrent(), "mA, charge =", guage.StateOfCharge(), "%" |
117 |
time.sleep(3) |
102 |
time.sleep(3) |
118 |
|
103 |
|