micropython-m5stack icon indicating copy to clipboard operation
micropython-m5stack copied to clipboard

How check charging process

Open k4m454k opened this issue 6 years ago • 5 comments

I need a function that will return whether the charge is connected or not. How?

k4m454k avatar May 14 '19 19:05 k4m454k

Add in class code:

_REG_READ0 = const(0x70)
_CHARGE_EN = const(0b00000100)
...
...
@property
def charger_pluged(self):
    charging_1 = self._register_char(_REG_READ0)
    if charging_1 & _CHARGE_EN:
        return True
    else:
        return False

Right?

k4m454k avatar May 14 '19 20:05 k4m454k

Looking at the half Chinese language spec sheet I have, yes that looks correct. Did you test it out yet?

tuupola avatar May 15 '19 06:05 tuupola

im testing that code today. Works not corrently( Works if i plug cable into Core, but not work if i plug cable into dock station (m5stack Fire)

k4m454k avatar May 15 '19 11:05 k4m454k

I have a fire too for testing. Will play around with the code during the weekend.

tuupola avatar May 16 '19 06:05 tuupola

@k4m454k take a look at what I just posted here: https://github.com/tuupola/micropython-m5stack/issues/6

But I only tested with the core, not the dock station.

bstein2379 avatar May 17 '19 16:05 bstein2379