tobozo / ESP32-Chimera-Core

ESP32-Chimera-Core 👾 is an arduino library for M5Stack, Odroid-Go, D-Duino-32-XS and other ESP32/TFT/SD bundles
Other
167 stars 13 forks source link

M5.Axp.isCharging() doesn't work - please port fix from M5Stack #62

Closed patfelst closed 2 years ago

patfelst commented 2 years ago

Hi there, can you please implement this fix? I tested it by editing the library source and the fix works. https://github.com/m5stack/M5Core2/issues/1

Thanks

tobozo commented 2 years ago

hi @patfelst thanks for your feedback :+1:

You'll find the excuse very lame but I've removed the swelling battery from my M5Core2 so I can't test that feature :-)

However based on your suggestion I'll be pushing this fix in the next release.

I'm also ordering a replacement battery, but the release will be published long before I can test it.

I'll update this post when the new release is propagated.

Thanks again for reporting this!

patfelst commented 2 years ago

Thanks, much appreciated. I guess that's going to be an ongoing challenge for this library going forward, i.e. keeping in sync with M5Stack bug fixes. Do you have a plan for that?

I was so impressed with the ease of getting Chimera up and running in Platform IO. I literally just installed the library, and Platform IO figured out it needed LovyanGFX so it automatically installed and added it to the project. Chimera then auto-detected my Core2 (must be going off Platform IO board type). I just had to change a few font name defines and the setFont function names and everything else just works.

I'm still trying to figure out how to use LovyanGFX touch functions. I can get the basic getTouch(&x, &y) function working but there's not many examples or documentation about it. Do you have any hints? I can open a new issue to discuss if you like. For example is there any 'debounce' support like, justPressed, justReleased, pressedFor_x_ms, touch inisde a hot zone etc?

tobozo commented 2 years ago

thanks for your warmful comments :+1:

Since release 1.2.2, ESP32-Chimera-Core enables touch emulation of BtnA, BtnB and BtnC on M5Core2 only, so you get native support for pressed, justPressed, justReleased, etc, but only after the display has started.

Although LovyanGFX has an auto-detection feature, this emulation mode will not be enabled without board = m5stack-core2 in your platformio.ini.

The default debounce time for buttons emulation is set to 100ms (lower values throws more false positives). It can be changed at runtime using Button::setDebounce( uint32_t ms ).

LovyanGFX implements getTouch(&x, &y) as a TFT_eSPI legacy but has a more comprehensive method:

lgfx::touch_point_t tp; 
// 'number' is how many touch events are currently queued
uint16_t number = M5.Lcd.getTouch(&tp, 1); // second argument is for multitouch, doesn't apply to M5Core2 but needs to be set
if( number > 0 ) {
  // do something with tp.x and tp.y
}

New release is published in platformio btw, might take more time for arduino registry

patfelst commented 2 years ago

I've had good success using getTouch over the last couple of days, I've basically coded my own "hotzone" type functions, but thanks for all the good information re BtA etc.

The update is already available for update in platformio - I updated and battery charging flag is confirmed fixed!