Closed 3835 closed 8 years ago
Charger returns values with 3 decimal places, you want to round it to 2? Eg.
print(
str(round(data[4], 2)) + ", " +
str(round(data[5] * 256 + data[6], 2)) + ", " +
str(round(data[7] * 256 + data[8], 2)) + ", " +
str(round((data[9] * 256 + data[10]) / 1000, 2)) + ", " +
str(round((data[11] * 256 + data[12]) / 1000, 2)) + ", " +
str(round(data[13], 2)) + ", " +
str(round(data[14], 2)) + ", " +
str(round((data[17] * 256 + data[18]) / 1000, 2)) + ", " +
str(round((data[19] * 256 + data[20]) / 1000, 2)) + ", " +
str(round((data[21] * 256 + data[22]) / 1000, 2)) + ", " +
str(round((data[23] * 256 + data[24]) / 1000, 2)) + ", " +
str(round((data[25] * 256 + data[26]) / 1000, 2)) + ", " +
str(round((data[27] * 256 + data[28]) / 1000, 2)))
Orginal script effect:
work state, charge mAh, charge timer, out voltage, current, ext temp, int temp, cell 1, cell 2, cell 3, cell 4, cell 5, cell 6
1, 142, 1175, 11, 0, 0, 53, 3, 3, 3, 0, 0, 0
1, 142, 1177, 11, 0, 0, 53, 3, 3, 3, 0, 0, 0
Modification effect:
work state, charge mAh, charge timer, out voltage, current, ext temp, int temp, cell 1, cell 2, cell 3, cell 4, cell 5, cell 6
1.0, 163.0, 1354.0, 11.0, 0.0, 0.0, 53.0, 3.0, 3.0, 3.0, 0.0, 0.0, 0.0
1.0, 163.0, 1356.0, 11.0, 0.0, 0.0, 53.0, 3.0, 3.0, 3.0, 0.0, 0.0, 0.0
I need more accurate results than 11 V. Real voltage is, for exemple, 11.30V
Oops, python2 treats division differently than python3, which I use. Should be fixed in 89eef27.
Hi Milek7! Great job! This is what I needed. But i have stupid question (sorry I'm not code guy). It is possible to read from charger and send to stdout numbers with two decimal place?