Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
patfelst opened this issue Oct 8, 2021 · 4 comments
Closed

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

patfelst opened this issue Oct 8, 2021 · 4 comments

Comments

@patfelst
Copy link

patfelst commented Oct 8, 2021

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

Thanks

@patfelst patfelst changed the title IsCharging doesn't work - please port fix from M5Stack M5.Axp.isCharging() doesn't work - please port fix from M5Stack Oct 8, 2021
@tobozo
Copy link
Owner

tobozo commented Oct 8, 2021

hi @patfelst thanks for your feedback 👍

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
Copy link
Author

patfelst commented Oct 8, 2021

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 added a commit that referenced this issue Oct 9, 2021
@tobozo
Copy link
Owner

tobozo commented Oct 9, 2021

thanks for your warmful comments 👍

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
Copy link
Author

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants