-

CommentStreams:1bc8235b86460d85f5d767079aae53bf

From Geekworm Wiki
Jump to navigation Jump to search

Hi, in the python battery code :

   def readVoltage(self):
       address = 0x36
       read = self._bus.read_word_data(address, 2)
       swapped = struct.unpack("<H", struct.pack(">H", read))[0]
       self.voltage = swapped * 1.25 / 1000 / 16
       return self.voltage
   def readCapacity(self):
       address = 0x36
       read = self._bus.read_word_data(address, 4)
       swapped = struct.unpack("<H", struct.pack(">H", read))[0]
       self.capacity = swapped / 256
       if self.capacity > 100:
           self.capacity = 100
       return self.capacity

what value i need to chnage to fit my battery spec ? Thank you !