Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TextBox font problem #62

Closed
rotus8 opened this issue Jan 22, 2020 · 21 comments
Closed

TextBox font problem #62

rotus8 opened this issue Jan 22, 2020 · 21 comments

Comments

@rotus8
Copy link

rotus8 commented Jan 22, 2020

Describe the bug
The font of the text in a textBox gets the wrong font selected. Apparently it is affected by the font selection of other elements. Specifically can be demonstrated in the ex_10_textbox example by changing the font of the quit button to a non-builtin font.

To Reproduce
Steps to reproduce the behavior:

  1. Open the ex10_bld_textbox example in builder.
  2. Generate the .ino, edit as in the example .ino file
  3. Upload to target. Text in textbox is good.
  4. In builder change the font of the quit button to one of the non-bultin fonts.
  5. Generate the .ino file
  6. Upload to target. Text in textbox starts out fine, but when the counter starts the wrong
    font is used.

Expected behavior
Font of the text in textBox should not be affected by the font in other elements.

Crash log / Project files
Starting point, works.
textBoxTest.zip
Modified font of Quit button, shows failure.
textBoxTestFontError.zip

Screenshots
If applicable, add screenshots to help explain your problem.

Version

  • Builder version: 0.13.b013
    Arduino 1.8.10
    GUIslice 0.13.0

  • OS: [e.g. Windows, LINUX, Mac OS] Windows 10

Additional context
Add any other context about the problem here.

@Pconti31
Copy link
Collaborator

Sorry, but i'm retired and living on social security so I can't afford all of the boards and displays Calvin supports. I ran your tests on my arduino mega and adafruit 2.8 tft. It ran fine in both cases.
As far as I can see the code generation is correct so I suspect it's a problem with GUIslice api.
I'll pass this along to Cal and see what he says. If it is a problem with the Builder I'll fix it.
Paul--

@rotus8
Copy link
Author

rotus8 commented Jan 22, 2020 via email

@ImpulseAdventure
Copy link
Owner

ImpulseAdventure commented Jan 24, 2020

Hi Ted --

I have tried recreating the scenario you reported on my ESP32 Adafruit Feather but have not observed the same issue.

Is there any chance you might be able to capture a short video clip of what you see on the display and attach it to this ticket? It seems a bit surprising to me that the sample code would cause the font to change during runtime unless perhaps there was a memory corruption event.

When you load the "textBoxTestFontError" generated code into a fresh Arduino IDE instance, do you still observe the same problem (ie. is it easily reproducible on your end?)

What MCU device (ATmega, ESP32, etc.) and which GUIslice config file are you using in your environment?

Like Paul said, my guess is that this wouldn't be a Builder issue, so I'll transfer the ticket accordingly once I can get closer to reproducing it on my side.

many thanks!

@Pconti31
Copy link
Collaborator

Pconti31 commented Feb 9, 2020

Due to lack of activity I'm going to close this issue for now.
If you come up with more information feel free to re-open.
Paul--

@Pconti31 Pconti31 closed this as completed Feb 9, 2020
@rotus8
Copy link
Author

rotus8 commented Feb 10, 2020 via email

@Pconti31
Copy link
Collaborator

Ted:
First I'm very happy you have a work-around and that you have found our project useful.
As to what else you could provide simply answer Calvin's questions.

What is the exact hardware MCU and Display you are using?
Which GUIslice config file are you using?
When you load the "textBoxTestFontError" generated code into a fresh Arduino IDE instance, do you still observe the same problem?
Can you make a video of textBoxTestFontError.ino running and post it?
Can you post your work-around modifications to textBoxTestFontError.ino?

Its clearly a memory corruption problem but the sample you gave runs fine for us so these
answers are needed to go further.
Paul--

@Pconti31 Pconti31 reopened this Feb 10, 2020
@rotus8
Copy link
Author

rotus8 commented Feb 12, 2020

I am using an Adafruit HUZZAH32 ESP32 Feather Board (https://www.adafruit.com/product/3405) with an Adafruit TFT FeatherWing - 3.5" 480x320 Touchscreen (https://www.adafruit.com/product/3651).

I am using the esp-tftespi-default-stmpe610.h config file, only modified with touch screen calibration.

The test sketch shows the error from a fresh build, I will attempt to upload the short video I made showing the problem.
https://www.dropbox.com/s/3yqcmrz5ws76z4p/VID_20200212_144654.mp4?dl=0

I would post my application, but it is quite large, it has eight screen pages plus several popups, more than 3000 lines of code. The difficulty I had is on a logging page which required a maximum size textBox with a tiny font, I used BuiltIn(1x)->5x8pt7b. My "workaround" (I would really call it a hack) is to use only BuiltIn fonts for all the elements on the page, it has an EXIT button plus I added two dummy text elements before and after the textBox which use the same 1x font. I also had to change the project default background color to what I used for the textBox fill color because sometimes the default color would be used.

I have ordered an extra display and MCU board that I would be happy to send to you if it would be useful.

Ted

@Pconti31
Copy link
Collaborator

Hmmm, I thought this config was the one Calvin tested with.

In looking over your answers for software versions you show
GUIslice 0.13.0 but I assume that's not the real version.
What is the version number inside GUIslice/src/GUIslice_version.h?
The lastest being GUISLICE_VER "0.13.0.16"
No version is given for TFT_espi the lastest being 1.4.20 is that what you are using?

One remaining thing would be your TFT_espi User_Setup.h and the your actual
esp-tftespi-default-stmpe610.h file if you made any edits to it.
If you could zip those up hopefully Calvin can make some progress.

Thank you for your patience.
Paul--

@Pconti31
Copy link
Collaborator

Ted:
While we wait for Calvin to get some free time and since memory corruption seems an issue I took a closer look at your sample and noticed:
// Free-running counter for display
unsigned m_nCount = 0;
this is a 32-bit number for the esp32 not 16 bit.
Your snprintf uses %u not %lu as it should for a 32 bit number.
You could of course change m_nCount to
uint16_t m_nCount = 0;
Not sure its your problem but it still should be corrected.
In the meantime I'll take a closer look at XTextbox.<h,c> to see if I notice anything
Further.
Paul--

@rotus8
Copy link
Author

rotus8 commented Feb 13, 2020

My installation shows #define GUISLICE_VER "0.13.0" in version.h. I could not get the Arduino library manager to install anything else, so I sideloaded 0.13.0.16. I had some hopes that this would fix it, but the problem persists. I am using TFT_esp 1.4.20.

Here are my setup/config files.
configStuff.zip

Let me know if there is anything else I can do to help. My offer stands to send you an MCU and display if that will help; it is on order, I should have it in a week or so.

@Pconti31
Copy link
Collaborator

Thanks for the hardware offer and yes, I would need it to hunt down the problem.
You can go to my profile for my public email address. Send me a message if you still want to send me your hardware and I'll give you my contact information.

I have attached a modified XTextbox.<h,c> that doesn't fix the problem as much as tries to workaround it. Give it a try. If it fails just go back to the original versions.
Paul--

XTextbox.zip

@rotus8
Copy link
Author

rotus8 commented Feb 14, 2020 via email

@ImpulseAdventure
Copy link
Owner

Hi @rotus8 --

I took another look at this issue tonight and think I see a potential source of the problem.
Given that you are using the Adafruit 3.5" Featherwing + Adafruit ESP32 Feather, we should have the option of two supported library combinations:

  • (1) Adafruit_HX8357 + Adafruit-GFX
  • (2) TFT_eSPI

For (2): TFT_eSPI mode:

  • I haven't seen your modified sketch, but does it show an include like the following?
//<Fonts !Start!>
  #include <Adafruit_GFX.h>
  #include <Fonts/FreeMono9pt7b.h>
//<Fonts !End!>
  • If so, please check to see that the Builder config setting Edit -> Options -> Target Platform is set for "arduino TFT_eSPI" and not "arduino".
  • The TFT_eSPI library has a known incompatibility when run alongside Adafruit-GFX. This was confirmed by Bodmer in esp8266 reboot with Adafruit GFX fonts GUIslice#146
  • The above Builder setting should cause "TFT_eSPI.h" to be included instead of the Adafruit_GFX and the associated font files, ie: replacing the above with:
//<Fonts !Start!>
#include "TFT_eSPI.h"
//<Fonts !End!>
  • If you attempt to run with Adafruit_GFX + TFT_eSPI, you will likely experience memory corruption or other runtime anomalies.

For (1): Adafruit HX8357 mode:

@Pconti31
Copy link
Collaborator

Cal : Thanks for taking a second look.
I think trying option (1) would be a good idea to try if only to limit the issue to TFT_espi driver
or maybe he can get away without using TFT_espi if the Adafruit drivers work without a problem.

As for (2) no his Builder is correctly configured his app shows:
//<Fonts !Start!>
#if !defined(DRV_DISP_TFT_ESPI)
#error Builder config "Edit->Options->General->Target Platform" should be "arduino"
#endif
#include <TFT_eSPI.h>
//<Fonts !End!>

Assuming option (1) is a no go and the second set of hardware he has on order reproduces the same issue and that he sends a set I should be able to determine whats is going on.
Paul--

@Pconti31
Copy link
Collaborator

Pconti31 commented Feb 27, 2020

Ted:
Thanks to you I was able to find and fix the bug.
It turned out to be inside GUIslice API and not a Builder problem.

If you get a chance please confirm the fixes and I'll close
this issue.
Paul--

XTextbox-v0.13.0.18-BugFix.zip

@rotus8
Copy link
Author

rotus8 commented Feb 28, 2020 via email

@rotus8
Copy link
Author

rotus8 commented Feb 28, 2020 via email

@ImpulseAdventure
Copy link
Owner

Thanks Ted for the confirmation. I intend to integrate the fix into the library this evening.

@rotus8
Copy link
Author

rotus8 commented Mar 1, 2020 via email

@Pconti31
Copy link
Collaborator

Pconti31 commented Mar 1, 2020 via email

@rotus8
Copy link
Author

rotus8 commented Mar 2, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants