I am just taking in hands a new Hexiwear and I am playing around the example given.
I observed that the screen refresh with «hexi.draw_text(…)» method is really slow and takes always arround 1 second to display the text on the hexiwear screen.
Is it a normal behaviour?
Is there any possibility to have a quicker refresh of the screen?
I find this very unconfortable if we want to create menus and navigate quickly with buttons, or if we want to have a quick reading / responsiveness of the sensors.
Any thought / idea about this observation?
Thanks in advance
Hi all again,
Is there no active user of the hexiwear in this community ?
I am a little bit stucked with this question of slow reactivity of the hexiwear oled display with Zerynth.
I would only like to know if this comes from the Zerynth multiple layers, or if this intrinsic of the hexiwear.
Thank in advance for any answer, comment or advice.
Since the hexiwear module uses the SSD1351 OLED module, The draw_text method only uses the SSD1351 OLED draw_text method.
def draw_text(...) self.lock.acquire() self.oled.draw_text(text, x, y, w, h, color, align, background, encode) self.lock.release()
You can check that in the hexiwear driver in : installation_directory/.zerynth2/dist/r2.3.3/libs/official/nxp/hexiwear/hexiwear.py
Also keep in mind that, Pixels are written to the display as they are drawn so it is relatively slow.
could you try the OLED example without any other software tasks that might delay the display?
Let me know the result and If it is still too slow maybe we can look at some optimizations in the OLED driver it self.
Hi @karimhamdy1 ,
Thanks a lot for your answer
I tested with a as simple as possible code (see below).
I put small vibrations in order to have an idea of what append…
With this code:
- when I push a button, instantaneously I can feel the first vibration,
- then after around 1 second the display is refreshed with the new message and instantaneously the second vibration occurs.
So I observe that there is around 1 second between the call to the draw_text() and the display of the text.
The reactivity of the buttons and of the vibration is really good.
There is only this question of screen refresh.
With the factory software, the screen reactivity is really good, so I believe that there is a layer somewhere that causes this lag
from nxp.hexiwear import hexiwear import zLogo def pressed_up(): hexi.vibration(50) hexi.draw_text("UP!", 0, 60, 96, 20, align=3, color=0xFFFF, background=0x0000, encode=False) hexi.vibration(50) def pressed_down(): hexi.vibration(50) hexi.draw_text("DOWN!", 0, 60, 96, 20, align=3, color=0xFFFF, background=0x0000, encode=False) hexi.vibration(50) try: hexi = hexiwear.HEXIWEAR() hexi.fill_screen(0xFFFF,False) hexi.attach_button_up(pressed_up) hexi.attach_button_down(pressed_down) except Exception as e: print(e) hexi.draw_image(zLogo.zz, 38, 10, 20, 20) hexi.draw_text("Start!", 0, 60, 96, 20, align=3, color=0xFFFF, background=0x0000, encode=False) while True: sleep(200)
I think this is due to the hexiwear library layer as you mentioned because it contains many structures, semaphores … that might slow everything down.
Could you upload the solomon-ssd1306 example as is without importing the hexiwear library? And see if the refresh rate is as expected.
Just to be sure that the delay is from the hexiwear layer not the OLED library itself.
I tried the solomon-ssd1306 example as is, like you proposed, but I have an exception error, apparently at the line
Error1 Exception at line 191 of solomon.ssd1306.ssd1306.init
raised at line 117 of solomon.ssd1306.ssd1306._command
raised at line 241 of spi.select
raised at line 186 of spi._start
in the ssd1306.py
So nothing happens on the hexiwear display
Maybe the configuration of the ssd instance is not good for the hexiwear in the example?
I am quite sure that we could have a faster display, as it is possible with the initial firmware (maybe not so fast, but…).
Would you have a suggestion?