Closed GrandeRipper closed 3 months ago
OK with unifiedButton.update() BEFORE M5.update() it doesn't really work either. Only isPressed() and pressedFor() are working wasClicked() doesn't work. probably because the corresponding variables are reset in M5.update(). I am a little confused how it can work with the CoreS3 at all... because the line 1207 - 1209 in M5Unified.cpp should also influence the behaviour.
Hi @GrandeRipper , Thanks for using my library.
As you guessed, it seems to be caused by overwriting values on the M5Unified side.
I have already discussed this issue with the M5Unified maintainer.
When the M5Unified side is updated, I would like to include M5Tough support in this library as well.
@GrandeRipper
M5Unified develop branch has been updated.
Could you try the following configuration?
lib_deps=https://github.com/m5stack/M5Unified.git#develop
Hi @GOB52 , i forgot to thank you for your work and your library. Sorry about that. With the develop version of M5Unified everything works as it should! (with customised UnifiedButton::begin) Thank you very much
Hi @GrandeRipper .
Thanks for trying. Are the following the only areas you have customized?
_enable = /*M5.getBoard() == m5::board_t::board_M5StackCoreS3 &&*/ M5.Touch.isEnabled();
Hi @GOB52 i only customized that line:
_enable = /*M5.getBoard() == m5::board_t::board_M5StackCoreS3 &&*/ M5.Touch.isEnabled();
Thanks for the reply.
The next update would be the following code.
auto bd = M5.getBoard();
_enable = (bd == m5::board_t::board_M5StackCoreS3 || bd == m5::board_t::board_M5Tough)
&& M5.Touch.isEnabled();
The reason why "M5.Touch.isEnabled()" alone is not enough is that there are devices like Core2 that are touch capable and have touch buttons outside the screen..
I will start after the official update of M5Unified.
On a side note, it would be great if the buttons could be labelled differently during the execution of the programme.
Hi @GrandeRipper
As M5Unified has been updated, gob_unifiedButton has also been updated and published 0.1.5.
If you have tried it and there are no problems, would you please close the issue?
Hello, I would like to use the lib with an M5Tough. For this I had to change line 27 in UnifiedButton::begin(LovyanGFX* gfx, const appearance_t app) function as follows:
This displayed the buttons and they changed colour when I clicked on them. However, conditions such as "M5.BtnA.wasHold()" were never true. I found out that this is probably due to line 1207 - 1209 in M5Unified.cpp (version 0.1.14) => M5.update()
The lib works at least if I comment out these lines. An alternative solution seems to be the execution of unifiedButton.update() BEFORE M5.update()
Is there a better way to solve the problem? I am also not clear why running unifiedButton.update() BEFORE M5.update() seems to be a solution.