Setup LCD class to use global config instead of local reference
This commit is contained in:
parent
7f60a42f9b
commit
b8dd067ecb
|
@ -22,7 +22,7 @@ UI::UI() {
|
|||
cancelButton = new UIButton(cancelButtonPin, cancelButtonLed);
|
||||
pspJoystick = new UIJoystickPSP(pspXPin, pspYPin);
|
||||
|
||||
lcd = new UILCD(config);
|
||||
lcd = new UILCD();
|
||||
|
||||
uiTimeout = new Metro(config->getTimeoutMilis());
|
||||
|
||||
|
|
|
@ -19,14 +19,12 @@
|
|||
#include "UILCD.h"
|
||||
#include "UIJoystickPSP.h"
|
||||
|
||||
UILCD::UILCD(Config* config) {
|
||||
UILCD::UILCD() {
|
||||
if (DEBUG) {
|
||||
Serial.println("UILCD::UILCD()");
|
||||
}
|
||||
pinMode(LCD_LITE, OUTPUT);
|
||||
|
||||
this->config = config;
|
||||
|
||||
tft = new Adafruit_ST7735(LCD_CS, LCD_DC, LCD_RST);
|
||||
tft->initR(INITR_BLACKTAB);
|
||||
tft->setRotation(3);
|
||||
|
|
|
@ -25,6 +25,9 @@
|
|||
// Forward declaration of Config
|
||||
class Config;
|
||||
|
||||
// Use global config and ui objects defined / initialized in main ino file
|
||||
extern Config* config;
|
||||
|
||||
#define BUFFPIXEL 20
|
||||
|
||||
enum screen {
|
||||
|
@ -39,7 +42,6 @@ enum screen {
|
|||
class UILCD {
|
||||
private:
|
||||
Adafruit_ST7735* tft;
|
||||
Config* config;
|
||||
|
||||
int currentLine;
|
||||
screen currentScreen;
|
||||
|
@ -61,7 +63,7 @@ private:
|
|||
void mainScreenCancelButton();
|
||||
|
||||
public:
|
||||
UILCD(Config* config);
|
||||
UILCD();
|
||||
void bmpDraw(char *filename, uint8_t x, uint8_t y);
|
||||
void handleJoystickEvent(joyDirection aDirection);
|
||||
void handleOkButtonEvent();
|
||||
|
|
Reference in a new issue