Chat freely about anything...

User avatar
By aminge
#77902 Hello guys,

This is about a college project which is giving us a lot of headaches, so we have a "central computer unit" to handle the modules added to the project via wifi, that part is not the real problem, the user interface is, we are using Adafruit's HX8357D 3.5 TFT with touch, thou touch is still not working because we are awaiting the STMPE controller for the SPI on the touch

For building the GUI, we used GUISlice, with Adafruit's GFX and HX8357 driver, it took a bit of time, but trough the examples we made it work. Most of the software is divided by classes in our program, however for some strange I cannot identify, the block handles the GUISlice stuff cannot be made into a class, the variables have to be global, on my testing, when the variables are global, they appear okay in the screen, but when they are class attributes, even static ones, they appear mirroed and with negative colors, I guess the memory region where they are saved is written in reverse byte order maybe??? I don't know, but it worked with the global variables, and I was able to create a line, and two text strings, then I tried to add a button, but the screen stop updating, and then I removed the button, but the problem persisted, from that point on, my code stopped working on the TFT, and I don't know why, the example codes from GUISlice work well, but mine doesn't...

It keeps throwing the exception (29)

Code: Select allets Jan  8 2013,rst cause:2, boot mode:(3,6)

load 0x4010f000, len 1384, room 16
tail 8
chksum 0x2d
csum 0x2d
vbb28d4a3
~ld

Exception (29):
epc1=0x40201efb epc2=0x00000000 epc3=0x00000000 excvaddr=0x0000001e depc=0x00000000

ctx: cont
sp: 3ffffd60 end: 3fffffd0 offset: 01a0

>>>stack>>>
3fffff00:  00000080 00000008 3fff19f0 40207b60 
3fffff10:  00000080 00000001 00000005 401065b5 
3fffff20:  3fff18ec 000000a0 3fff19f0 40207ac3 
3fffff30:  3fff18ec 000000a0 3fff19f0 40208218 
3fffff40:  3f000000 3fff19f0 3fff18f8 40204c1f 
3fffff50:  00000000 014001e0 3fff18f8 40201ef4 
3fffff60:  00012480 00000001 3fff18f8 3fff1fbc 
3fffff70:  3fffdad0 3fff18f8 00000000 40204512 
3fffff80:  3f000000 00000001 3fff1efc 40208b48 
3fffff90:  00012480 00000000 3fff1fb4 40203f91 
3fffffa0:  feefeffe 00000000 3fff1fb4 40204960 
3fffffb0:  feefeffe feefeffe feefeffe 40209388 
3fffffc0:  feefeffe feefeffe 3ffe85e0 40100739


Memory definitions:
size: 4M with 1M SPIFFS
mode: QIO
freq: 40 MHz

So we have a class resposible for handling all blocks together and the block responsible for the interface separated like this:

Cnt.cpp
Code: Select all#include "Cnt.h"
#include "CntIC.h"

namespace Controller
{
   gslc_tsGui _gui;
   gslc_tsDriver _drv;
   gslc_tsFont _fonts[CON_CONF_FONTS];
   gslc_tsPage _pages[CON_CONF_PAGES];
   gslc_tsElem _mainPageElems[CON_CONF_MAIN_PAGE_ELEMS];
   gslc_tsElemRef _mainPageElemRefs[CON_CONF_MAIN_PAGE_ELEMS];

        bool Cnt::bootupHandler()
        {
            ic_bootup();

            return true;
        }
}


CntIC.cpp
Code: Select all#include "CntIC.h"

namespace Controller
{
   gslc_tsElemRef* _elemRef;
   bool _lockEnable;
   enum pageGui _currentPage;

        void ic_bootup()
   {
      _elemRef = NULL;
      _lockEnable = false;
      title[0] = '\0';
      
      // Init
      gslc_Init(&_gui, &_drv, _pages, CON_CONF_PAGES, _fonts, CON_CONF_FONTS);
      gslc_FontAdd(&_gui, CON_MAIN_FONT, GSLC_FONTREF_PTR, NULL, 2);
      gslc_SetBkgndColor(&_gui, GSLC_COL_BLACK);

      //ic_mainPageSetup();
      ic_changePage(CON_MAIN_PAGE);
   }

   void ic_update()
   {   
      gslc_Update(&_gui);
   }
}


CntIC.h
Code: Select all#ifndef _CNTIC_H_
   #define _CNTIC_H_
   #include "GUIslice.h"
   #include "GUIslice_ex.h"
   #include "GUIslice_drv.h"

   #define CON_CONF_FONTS 1
   #define CON_CONF_PAGES 6
   #define CON_CONF_MAIN_PAGE_ELEMS 16
   #define CON_CONF_TEXT_COLS 25
   #define CON_CONF_TEXT_ROWS 1
   
   namespace Controller
   {
      extern gslc_tsGui _gui;
      extern gslc_tsDriver _drv;
      extern gslc_tsFont _fonts[CON_CONF_FONTS];
      extern gslc_tsPage _pages[CON_CONF_PAGES];
      extern gslc_tsElem _mainPageElems[CON_CONF_MAIN_PAGE_ELEMS];
      extern gslc_tsElemRef _mainPageElemRefs[CON_CONF_MAIN_PAGE_ELEMS];
      extern gslc_tsXTextbox _titleTextBox;
   
      enum fontGui {CON_MAIN_FONT};
      enum pageGui {CON_MAIN_PAGE, CON_SETTINGS_PAGE, CON_MODULES_PAGE, CON_MODULE_CONF_PAGE, CON_MODULE_STAT_PAGE, CON_STATS_PAGE, CON_KEYBOARD_PAGE};
      enum elemGeneralGui {PAGE_TITLE, PAGE_SEPARATOR, PAGE_ID, PAGE_WIFI};
      enum elemMainPageGui {MAIN_POWER_LABEL = 4, MAIN_POWEL_VALUE, MAIN_POWER_REF, MAIN_POWER_BAR, MAIN_SETTINGS, MAIN_NETWORK, MAIN_MODULES, MAIN_STATISTICS};

      void ic_bootup();
      void ic_update();
      void ic_changePage(enum pageGui page);
   }
#endif


I do believe the problem is arround these parts, there is more code, but right now, most is commented out for testing purposes, or caused no visible changes before and after the problem, thank you in advance for any help and tell me if more data is required
User avatar
By aminge
#78033
philbowles wrote:OK, never heard of GUIslice, but know a fair amount re exceptions...

You don't say what board you are using. You dont say how you are compiling your code and getting it into said board...

If you are using the arduino IDE you need to install the exception decoder tool and post up the stack backtrace so at least we have an idea what code is failing....https://github.com/me-no-dev/EspExceptionDecoder

Then if you REALLY want someone to do your debugging for you, you will have to post all of your code. All of it.


Thank you for your reply, I was able to fix the problem eventually, I tried using the decoder but couldn't get neither version to work correctly on the latest Arduino IDE version, I'll be sure to be more careful with the information the next time.

For reference on any future situations to who uses GUISlice, the background color can only be set AFTER at least one page has been added to the gui, I had to search for the reasos for the exception and it turns out it was related to the function trying to add the background color to inexistant pages, maybe trying to access a NULL pointer, but I'm not sure about this.
The information that I found on the guide of the library does not have any specifics about notes or warnings on setting the color of the background, and even the parameters seemed to point that no page was needed.
User avatar
By impulse
#78059 Hi aminge!

Thank you for reporting this issue. You are indeed correct that GUIslice had assumed that at least one page had been created (eg. via PageAdd) before calling these other operations. I have now uploaded a fix to the GitHub repository https://www.github.com/impulseadventure/GUIslice that should address the issue.

Please feel free to contact me via messaging here or else at the email address in the GitHub readme and I would be happy to help you get your project up and running!