[Logo] TCC discussion forum
  [Search] Search   [Recent Topics] Recent Topics   [Hottest Topics] Hottest Topics   [Top Downloads] Top Downloads   [Groups] Back to home page 
[Register] Register /  [Login] Login 


This forum is read only and new users cannot register, please ask all new questions either using GitHub discussions, or in Arduino forum tagging @davetcc.

Encoder - 40 detents, 20 pulses. RSS feed
Forum Index » tcMenu Arduinio library
Author Message
ScubaSteve


Joined: May 14, 2021
Messages: 30
Offline
I suspect you know where this is headed, Dave..

Found a package of 40 detent/20 pulse encoders in a bin of randomness ... obviously every other detent is unrecognized. Is there an option in tcMenu that I missed?

Thanks!

Steve
davetcc


Joined: Jan 19, 2019
Messages: 686
Offline
Yes there is a recently closed pull request in IoAbstraction on this, I’ll make sure it’s documented properly but take a look at the quarter cycle pull request or the IoAbstraction front page.

Answering on my phone at the moment but will reply again later.
davetcc


Joined: Jan 19, 2019
Messages: 686
Offline
For now just hack the extra parameter on the end of the encoder setup in your project _menu.cpp

I’ll change and release the input plugin before the 2.1 library goes out tomorrow.
davetcc


Joined: Jan 19, 2019
Messages: 686
Offline
Take a look at https://www.thecoderscorner.com/products/arduino-libraries/io-abstraction/switches-rotary-encoder-documentation/ where it has a section on rotary encoders. In summary there is a new optional parameter at the end of the set up method below:

void setupRotaryEncoderWithInterrupt(pinA, pinB, myCallback, QUARTER_CYCLE);


For now, go into your _menu.cpp file, and add that extra parameter. We've already raised an issue to add this as a checkbox in the rotary encoder plugin in the next release.

You'll have to be on a very recent IoAbstraction for this to work, as it's only just been kindly submitted and tested by ddd999
ScubaSteve


Joined: May 14, 2021
Messages: 30
Offline
Thank you, Dave! I'm out-of-pocket most of today -- will report back tomorrow morning!
ScubaSteve


Joined: May 14, 2021
Messages: 30
Offline
Yikes. I updated to 2.1 Beta via the Arduino IDE. My code compiled, but is too big for the Arduino. I think it might be time to look at ESP32.. This will take a while.
davetcc


Joined: Jan 19, 2019
Messages: 686
Offline
My code compiled, but is too big for the Arduino.


Are you using an AVR with 32K FLASH?

If so, you can select "Uno" mode in the LCD driver settings and save about 8K of flash. The old size for the dfRobot sketch was 22K and the new size with Uno ticked is around 24K.

If you're using an OLED, the SSD1306Ascii driver also fits well, almost unchanged to before. We have an example with two custom fonts and it uses about 25K FLASH.
[Thumb - lcd-uno-mode.jpg]
 Filename lcd-uno-mode.jpg [Disk] Download
 Description No description given
 Filesize 36 Kbytes
 Downloaded:  54069 time(s)

ScubaSteve


Joined: May 14, 2021
Messages: 30
Offline
I already had that option. I'm using an Uno. This project is just quickly outgrowing the platform.
ScubaSteve


Joined: May 14, 2021
Messages: 30
Offline
Trying to get an ESP32 working with a simple menu (only) and having compilation errors. I've upgraded to the latest Designer, tcMenu 2.1.0. Familiar with using this under Arduino, first time with ESP32.

I get the following errors at compilation:

sketch/tcMenuLiquidCrystal.cpp: In member function 'virtual void LiquidCrystalRenderer::drawMenuItem(tcgfx::GridPositionRowCacheEntry*, tcgfx::Coord, tcgfx::Coord, bool)':
tcMenuLiquidCrystal.cpp:119:46: error: no matching function for call to 'min(int, uint8_t& smilie'
buffer[min(areaSize.x + 1, bufferSize)] = 0;
^
In file included from /Users/steve/Library/Arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/1.22.0-97-gc752ad5-5.2.0/xtensa-esp32-elf/include/c++/5.2.0/algorithm:62:0,
from /Users/steve/Library/Arduino15/packages/esp32/hardware/esp32/1.0.6/cores/esp32/Arduino.h:142,
from /Users/steve/Documents/Arduino/libraries/IoAbstraction/src/PlatformDetermination.h:33,
from /Users/steve/Documents/Arduino/libraries/IoAbstraction/src/IoAbstraction.h:17,
from /Users/steve/Documents/Arduino/libraries/tcMenu/src/tcMenu.h:9,
from sketch/tcMenuLiquidCrystal.h:20,
from sketch/tcMenuLiquidCrystal.cpp:15:
/Users/steve/Library/Arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/1.22.0-97-gc752ad5-5.2.0/xtensa-esp32-elf/include/c++/5.2.0/bits/stl_algo.h:3451:5: note: candidate: template<class _Tp, class _Compare> _Tp std::min(std::initializer_list<_Tp>, _Compare)
min(initializer_list<_Tp> __l, _Compare __comp)
^
/Users/steve/Library/Arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/1.22.0-97-gc752ad5-5.2.0/xtensa-esp32-elf/include/c++/5.2.0/bits/stl_algo.h:3451:5: note: template argument deduction/substitution failed:
sketch/tcMenuLiquidCrystal.cpp:119:46: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
buffer[min(areaSize.x + 1, bufferSize)] = 0;
^
In file included from /Users/steve/Library/Arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/1.22.0-97-gc752ad5-5.2.0/xtensa-esp32-elf/include/c++/5.2.0/algorithm:62:0,
from /Users/steve/Library/Arduino15/packages/esp32/hardware/esp32/1.0.6/cores/esp32/Arduino.h:142,
from /Users/steve/Documents/Arduino/libraries/IoAbstraction/src/PlatformDetermination.h:33,
from /Users/steve/Documents/Arduino/libraries/IoAbstraction/src/IoAbstraction.h:17,
from /Users/steve/Documents/Arduino/libraries/tcMenu/src/tcMenu.h:9,
from sketch/tcMenuLiquidCrystal.h:20,
from sketch/tcMenuLiquidCrystal.cpp:15:
/Users/steve/Library/Arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/1.22.0-97-gc752ad5-5.2.0/xtensa-esp32-elf/include/c++/5.2.0/bits/stl_algo.h:3445:5: note: candidate: template<class _Tp> _Tp std::min(std::initializer_list<_Tp> smilie
min(initializer_list<_Tp> __l)
^
/Users/steve/Library/Arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/1.22.0-97-gc752ad5-5.2.0/xtensa-esp32-elf/include/c++/5.2.0/bits/stl_algo.h:3445:5: note: template argument deduction/substitution failed:
sketch/tcMenuLiquidCrystal.cpp:119:46: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
buffer[min(areaSize.x + 1, bufferSize)] = 0;
^
In file included from /Users/steve/Library/Arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/1.22.0-97-gc752ad5-5.2.0/xtensa-esp32-elf/include/c++/5.2.0/algorithm:61:0,
from /Users/steve/Library/Arduino15/packages/esp32/hardware/esp32/1.0.6/cores/esp32/Arduino.h:142,
from /Users/steve/Documents/Arduino/libraries/IoAbstraction/src/PlatformDetermination.h:33,
from /Users/steve/Documents/Arduino/libraries/IoAbstraction/src/IoAbstraction.h:17,
from /Users/steve/Documents/Arduino/libraries/tcMenu/src/tcMenu.h:9,
from sketch/tcMenuLiquidCrystal.h:20,
from sketch/tcMenuLiquidCrystal.cpp:15:
/Users/steve/Library/Arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/1.22.0-97-gc752ad5-5.2.0/xtensa-esp32-elf/include/c++/5.2.0/bits/stl_algobase.h:243:5: note: candidate: template<class _Tp, class _Compare> const _Tp& std::min(const _Tp&, const _Tp&, _Compare)
min(const _Tp& __a, const _Tp& __b, _Compare __comp)
^
/Users/steve/Library/Arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/1.22.0-97-gc752ad5-5.2.0/xtensa-esp32-elf/include/c++/5.2.0/bits/stl_algobase.h:243:5: note: template argument deduction/substitution failed:
sketch/tcMenuLiquidCrystal.cpp:119:46: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'uint8_t {aka unsigned char}')
buffer[min(areaSize.x + 1, bufferSize)] = 0;
^
In file included from /Users/steve/Library/Arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/1.22.0-97-gc752ad5-5.2.0/xtensa-esp32-elf/include/c++/5.2.0/algorithm:61:0,
from /Users/steve/Library/Arduino15/packages/esp32/hardware/esp32/1.0.6/cores/esp32/Arduino.h:142,
from /Users/steve/Documents/Arduino/libraries/IoAbstraction/src/PlatformDetermination.h:33,
from /Users/steve/Documents/Arduino/libraries/IoAbstraction/src/IoAbstraction.h:17,
from /Users/steve/Documents/Arduino/libraries/tcMenu/src/tcMenu.h:9,
from sketch/tcMenuLiquidCrystal.h:20,
from sketch/tcMenuLiquidCrystal.cpp:15:
/Users/steve/Library/Arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/1.22.0-97-gc752ad5-5.2.0/xtensa-esp32-elf/include/c++/5.2.0/bits/stl_algobase.h:195:5: note: candidate: template<class _Tp> const _Tp& std::min(const _Tp&, const _Tp& smilie
min(const _Tp& __a, const _Tp& __b)
^
/Users/steve/Library/Arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/1.22.0-97-gc752ad5-5.2.0/xtensa-esp32-elf/include/c++/5.2.0/bits/stl_algobase.h:195:5: note: template argument deduction/substitution failed:
sketch/tcMenuLiquidCrystal.cpp:119:46: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'uint8_t {aka unsigned char}')
buffer[min(areaSize.x + 1, bufferSize)] = 0;
^
exit status 1
no matching function for call to 'min(int, uint8_t& smilie'
davetcc


Joined: Jan 19, 2019
Messages: 686
Offline
Ah, looks like there's an oversight for ESP boards in the liquid crystal renderer, not many use LCDs on ESP boards.

If you open LiquidCrystalRenderer.cpp and change line 119 to look as follows:

buffer[min(uint8_t(areaSize.x + 1), bufferSize)] = 0;


I think that should fix it. I'll include this patch in the 2.1.3 release, which will be tomorrow at this point. It will also include quarter-turn encoders. In fact I'll create a simple menu with LCD on my ESP32 board with my I2C LCD display. Normally we test ESP boards with OLEDs and TFTs.
davetcc


Joined: Jan 19, 2019
Messages: 686
Offline
Thanks for letting us know about it too, so we can fix it.
ScubaSteve


Joined: May 14, 2021
Messages: 30
Offline
Glad to help!

It's compiling now, although I'm not seeing life signs from the display (removed from the Arduino, so I know it works and I know the I2C address). I've gone through various iterations for pin layout. I'm assuming you're expecting SCL on GPIO22, SDA on 21?
ScubaSteve


Joined: May 14, 2021
Messages: 30
Offline
I've got it functioning using the "Uno" (memory conserving) LCD feature. Selecting the "Full" library results in line 0 showing full blocks in each character position, with line 1 entirely blank.

I'll stick with the Uno option for now, and will try and migrate to a 1306 over time.
davetcc


Joined: Jan 19, 2019
Messages: 686
Offline
I'm assuming you're expecting SCL on GPIO22, SDA on 21?


You have to call begin yourself providing the right pins before calling setupMenu(). Take a look at the ESP32 code below, begin takes two parameters that can be defaulted if you use the hardware mapped pins.

We do test ESP32 with an LCD for our LiquidCrystalIO library, but we've never really built a menu with one as it doesn't seem that common. However, I'll build one today and ensure everything is good.

https://github.com/espressif/arduino-esp32/blob/a1d8b959b05e3fb1391883ce6f9f2ed87af7da0f/libraries/Wire/src/Wire.h#L74

- slight edit to include url
davetcc


Joined: Jan 19, 2019
Messages: 686
Offline
I've got it functioning using the "Uno" (memory conserving) LCD feature. Selecting the "Full" library results in line 0 showing full blocks in each character position, with line 1 entirely blank.


I imagine the board is running out of memory, to be honest, and the sketch crashing. You can't even enable serial to debug the menu on an Uno, as you risk overflowing the available memory.

We really don't recommend full mode on Uno because it needs a bit more RAM and FLASH. It's designed for MEGA2560 and upwards basically.
 
Forum Index » tcMenu Arduinio library
Go to:   
Mobile view
Powered by JForum 2.7.0 © 2020 JForum Team • Maintained by Andowson Chang and Ulf Dittmer

This site uses cookies to analyse traffic, serve ads by Google AdSense (non-personalized in EEA/UK), and to record consent. We also embed Twitter, Youtube and Disqus content on some pages, these companies have their own privacy policies.

Our privacy policy applies to all pages on our site

Should you need further guidance on how to proceed: External link for information about cookie management.