aulitech / Cato

3 stars 0 forks source link

Implement battery charge detection #9

Open sperok opened 2 years ago

FinnWBiggs commented 1 year ago

Should implement slow red blink to indicate low battery

sperok commented 1 year ago

we need to measure voltage fully charged (Vf) with a meter and simultaneously at the pin(Af). Then run until fully discharged, logging the value from pin (Ae) and measuring the voltage (Ve). Then scale Bat% Ae=0 ... Af=100. battery_voltage = battery_pin.value / 65536 * Vf IFF Af == 65536

then need to implement adafruit battery info service and device info service. see https://github.com/adafruit/Adafruit_CircuitPython_BLE/blob/4fd499e39720f8ce970cceeb97c2a85c485f7335/examples/ble_hid_periph.py

in bluetoothControl.py the appearance value should come from our https://specificationrefs.bluetooth.com/assigned-values/Appearance%20Values.pdf and is probably 0x3c0 generic HID