Consider me newbie , working on a project for my personal aircraft in this COVID-19 quarantine time and forgive me if my questions are too dumb.
I am trying to make a personal checklist device, as final backup in case everything else fails during the flight and also keep myself busy in this down time. had experience with C++ and AVR but that goes back to about 8 years ago and seems my memory doesn't want to help me !
I could do what I wanted without using classes but want to encapsulate things in case later need adjustments. in fact the project works fine now with everything in one main.cpp file , but can't divide it to classes.
my goal is to make tft object in main file and then pass it to screen classes.
In main.cpp :
[Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);][/Adafruit_FT6206 ts = Adafruit_FT6206();]
Now I want to make screen objects to register all GPS modules, buttons, textbooks,...
in screen.h file, something like this:
[class Screen: public GUIObject{][/ public:][/GUIObject *objectList[10] ;][/Adafruit_ILI9341 tft;][/Adafruit_STMPE610 ts;][/ void addObject( GUIObject *obj);]
but I see memory crashes over the addObject. Obviously Adafruit_ILI9341 is not happy being passed by reference and I get 170% memory usage !!!
What is missing in sending a tft object from one file to another ?
Thank you all in advance.