Comments (1)
Sorry for the huge delay.
The problem comes from the difference between the constructor of the original LiquidCrystal library and the constructor of the LiquidCrystal_I2C library.
The LiquidCrystal library calls it's public method begin()
(used again later in setup()
) from the constructor which allows method calls on the object.
The LiquidCrystal_I2C library doesn't call it, and for some reason calling the object's methods before begin()
breaks the object.
So when using LiquidCrystal_I2C, my LiquidMenu constructor calls LiquidCrystal_I2C::createChar(int, int[])
before LiquidCrystal_I2C::begin()
is called, which breaks the not fully initialized LiquidCrystal_I2C object.
I tried calling the begin()
method from the LiquidCrystal_I2C constructor, but that broke the object too. I also tried modifying the code in the LiquidCrystal_I2C::begin()
method, but I couldn't make it to work.
The way to make it work without breaking the LiquidMenu API is to move the 3 calls:
// LiquidMenu/src/LiquidMenu.cpp
...
_p_liquidCrystal->createChar(15, symbol::rightFocus);
_p_liquidCrystal->createChar(14, symbol::leftFocus);
_p_liquidCrystal->createChar(13, symbol::customFocus);
...
and the "focus" variables:
// LiquidMenu/src/symbols.h
namespace symbol {
uint8_t rightFocus[8] = {
0b00000 ,0b00100, 0b01000, 0b11111, 0b01000, 0b00100, 0b00000, 0b00000
};
uint8_t leftFocus[8] = {
0b00000, 0b00100, 0b00010, 0b11111, 0b00010, 0b00100, 0b00000,0b00000
};
uint8_t customFocus[8] = {
0b00000, 0b00000, 0b01110, 0b01110, 0b01110, 0b00000, 0b00000, 0b00000
};
} //namespace symbol
to the end of the LiquidCrystal_I2C::begin()
method:
// LiquidCrystal_I2C/LiquidCrystal_I2C.cpp
...
// set the entry mode
command(LCD_ENTRYMODESET | _displaymode);
home();
createChar(15, symbol::rightFocus);
createChar(14, symbol::leftFocus);
createChar(13, symbol::customFocus);
}
...
and the variables in the same file before the constructor. Other solution will be to use a different I2C library if there is available.
from liquidmenu.
Related Issues (20)
- call_function() calls update() for previous menu if change_menu() is in the callback function
- API reference is 404 HOT 2
- Unable to get current menu from LiquidSystem
- 'recognizeType(int&)' is ambiguous HOT 1
- LiquidMenu objects have to be defined globally HOT 3
- Screens could link to child menus HOT 5
- Switching screens should reset focus item back to first line HOT 2
- Can't compile I2C example HOT 8
- Rotary encoder example HOT 2
- `switch_focus` iterates from the last focusable line to `_lineCount` instead of the first line HOT 6
- Blink cursor over editing position HOT 1
- Avoid creating duplicate variables HOT 1
- `delete_variable()` and `detach_function()` HOT 2
- `LiquidSystem::is_callable` makes an undesired `LiquidMenu::call_function` HOT 1
- Mixing sub-menus and scrolling lines? HOT 1
- Switch focus disappears for one step after an iteration HOT 4
- Support for the SAMD architecture HOT 1
- Optional screen refresh option when calling a function HOT 1
- [Poll] Which interface do you use to interface with the display?
- LiquidCrystal not found even if it's installed HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from liquidmenu.