Hi Amir,
I wanted to try the ili9341 version of demo_printer but I cannot rebuild lv_micropython any more:
from /opt/ucc/micros/esp32/esp-idf-micropython/components/bt/host/nimble/nimble/nimble/host/src/ble_hs_periodic_sync.c:23:
/opt/ucc/micros/esp32/esp-idf-micropython/components/bt/host/nimble/port/include/esp_nimble_cfg.h:13:49: error: 'MYNEWT_VAL_BLE_MAX_PERIODIC_SYNCS' undeclared here (not in a function); did you mean 'MYNEWT_VAL_BLE_MAX_CONNECTIONS'?
#define MYNEWT_VAL(x) MYNEWT_VAL_ ## x ```
^~~~~~~~~~~
@kisvegabor Are you using the latest lv_micropython? It’s needed because I added display_driver_utils as a frozen module there.
You can also try to add these 2 lines at before any import in demo_printer.py:
import sys
sys.path.append('')
This is not needed as these modules are frozen, just add the lines above.
@uraich I’m not sure I follow if there is a problem with dynamic font loading or not.
Were you able to run Dynamic_loading_font_example.py?
Please let us know the current status and where you still have trouble.
Thanks, I got one step closer. After updating lv_micropython MICROPYPATH="" worked as well. (it was a few weeks old). Now ulogging is missing.
I’ve tired to install upip but
$ pip install micropython-upip
Defaulting to user installation because normal site-packages is not writeable
Collecting micropython-upip
Using cached micropython-upip-1.2.6.tar.gz (4.3 kB)
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3.6 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-vv5hi0ap/micropython-upip/setup.py'"'"'; __file__='"'"'/tmp/pip-install-vv5hi0ap/micropython-upip/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-8s7737u2
cwd: /tmp/pip-install-vv5hi0ap/micropython-upip/
Complete output (5 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/lib/python3.6/tokenize.py", line 452, in open
buffer = _builtin_open(filename, 'rb')
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/pip-install-vv5hi0ap/micropython-upip/setup.py'
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
WARNING: You are using pip version 20.1.1; however, version 21.0.1 is available.
You should consider upgrading via the '/usr/bin/python3.6 -m pip install --upgrade pip' command.
I’ve also tried:
$ ./micropython-dev -m upip install logging
Installing to: /home/kisvegabor/.micropython/lib/
Warning: micropython.org SSL certificate is not validated
Installing logging 0.3 from https://micropython.org/pi/logging/logging-0.3.tar.gz
It says it installed successfully, but the ulogging module still can’t be found.
I use lv_mpy_examples as my playground before preparing a pull request.
Thanks for the report on the glitches.
In fact I saw the re-alignment but then somehow it miraculously disappeared. I have been messing around with lv_conf.h and with espidf, playing with the new build system of micropython. Like this I managed to put my system into a state where nothing worked any longer. Now I am back to normal and I also see the misalignment. Like this it should be much easier to track it down.
I had challenges with dynamic font loading. When running the Dynamic_loading_font_example.py I get an error:
KeyError: ‘type’ object isn’t subscriptable
I see that in fs_driver a dictionary is attached to the lv_fs_file_t structure in the open call, which contains the file descriptor. Unfortunately this dictionary is not correctly recuperated by the other calls. Instead of the dictionary itself, its type is recuperated resulting in the error.
My solution was to re-write fs_driver.py as a class and keep the file descriptor as an instance variable. This makes the code substantially shorter and also clearer (I believe).
Uploaded to lv_mpy_examples
Please let me know what you think of it.
@kisvegabor, @embeddedt Do you know if there is a reason the FS callbacks receive void * file_p instead of lv_fs_file_t * file_p? I would very much like to change that in lv_fs.h such that casts could be eliminated from Micropython.
Best thing would be to fix lv_fs.h on LVGL and get rid of all these casts on Microython.
I don’t mind converting fs_driver.py to a class but I think this change should be applied in lv_micropython/lib. I don’t see a reason to keep a separate implementation of fs driver in the demo. We can also freeze it in lv_micropython/lib such that it is always available same as display_driver_utils.py.
Ok, I will wait for the fix in lv_fs.h. When I saw the program running I remembered that I had tried it several months ago, and, you are right, then it worked fine.
Actually I only did the conversion to a class only to check that I had correctly understood your mechanism to save the file descriptor.
I will try to dynamically load the fonts in the demo_printer program with the class fs_driver waiting for the fix. There is hardly any change to switch back later anyhow.
Good that the mis-alignment problem is gone.
During the next one or two weeks however I will have little time to work on this. My house got burglarized and it have to get things in order there first.
Hmmm, the changes for dynamic font loading were so few that I could easily implement them. I have most of the montserrat fonts in the font directory even though only 2 are used by demo_printer. Now the program should “just run”.
The ili9341 version is also almost ready but not tested on the esp32 yet.
It must be XXX_argb8888.bin’ to ‘XXX_argb565.bin.
You find the conversion programs in https://github.com/uraich/lv_mpy_examples
under image_conversions.
Just run make to create the executables.
Then use:
argb8888_to_argb565 xxxx_argb8888.bin image_width image_height
You may also try
argb8888_to_png xxxx_argb8888.bin image_width image_height
to create, you guessed it, the png file.
showImg.py argb8888.bin image_width image_height will display the image.
Please tell me if this works for you.
You are missing libpng on your system.
2 possible solutions:
If you are on Ubuntu use sudo apt install libpng-dev
If you only want the converter to argb565, then you can remove
LDLIBS = -lpng
and all references to argb8888_to_png from the Makefile and re-build