I'm fairly new to this, so I apologize in advance if this ends up being a stupid/easy fix.
I'm taking an existing hydroponics controller using a MEGA 2560 and I plan on customizing it to my own liking and desires but the first order of business was simply to get the existing code to work. I thought this would be much easier but the code is from over a year ago and I keep finding syntax changes that are resulting in compiling errors. Anyway, all the code is listed below for the Window Controller Menu (.cpp file type (also attached), which controls the LCD (sainsmart 3.2").
This is being used with UTFT and UTouch libraries and I have already gotten another project to work with the same libraries so I don't think the error has to do with those files.
#include "WinControllerMenu.h"
WinControllerMenu::WinControllerMenu(UTFT *lcd, UTouch *touch, Sensors *sensors, Settings *settings)
: Window(lcd,touch,sensors,settings) { }
WinControllerMenu::WinControllerMenu(const WinControllerMenu &other) : Window(other) {
for (uint8_t i = 0; i < _nControllerButtons; i++) {
_controllerButtons[i] = other._controllerButtons[i];
}
}
WinControllerMenu& WinControllerMenu::operator=(const WinControllerMenu& other) {
_lcd = other._lcd;
_touch = other._touch;
_sensors = other._sensors;
_settings = other._settings;
_buttons = other._buttons;
for (uint8_t i = 0; i < _nControllerButtons; i++) {
_controllerButtons[i] = other._controllerButtons[i];
}
return *this;
}
WinControllerMenu::~WinControllerMenu() {}
Window::Screen WinControllerMenu::getType() const {
return Window::ControllerSettings;
}
void WinControllerMenu::print() {
_soundActive = _settings->getSound();
_serialActive = _settings->getSerialDebug();
_lcd->setColor(lightGreen[0],lightGreen[1],lightGreen[2]);
_lcd->setBackColor(VGA_WHITE);
_lcd->setFont(various_symbols);
//Print bulletpoints & texts
for (uint8_t i = 0; i < _nControllerButtons - _nFlowButtons; i++) {
_lcd->print(pmChar(bulletStr),_xMenu,_yFiveLines+_bigFontSize*_yFactor5lines*i);
_controllerButtons[i + _nFlowButtons] = _buttons.addButton(_xMenu+_bigFontSize*2,_yFiveLines+_bigFontSize*_yFactor5lines*i,(char*)pgm_read_word(&controllerButtonText[i]));
}
_lcd->setFont(uint8_t* hallfetica_normal);
//Sound ON/OFF
if (_soundActive)
_lcd->print(pmChar(onStr),_xMenu+_bigFontSize*2+_bigFontSize*strlen_P(controllerButtonText[_nFlowButtons]),_yFiveLines+_bigFontSize*_yFactor5lines*3);
else
_lcd->print(pmChar(offStr),_xMenu+_bigFontSize*2+_bigFontSize*strlen_P(controllerButtonText[_nFlowButtons]),_yFiveLines+_bigFontSize*_yFactor5lines*3);
//Serial Debug ON/OFF
if (_serialActive)
_lcd->print(pmChar(onStr),_xMenu+_bigFontSize*2+_bigFontSize*strlen_P(controllerButtonText[_nFlowButtons+1]),_yFiveLines+_bigFontSize*_yFactor5lines*4);
else
_lcd->print(pmChar(offStr),_xMenu+_bigFontSize*2+_bigFontSize*strlen_P(controllerButtonText[_nFlowButtons+1]),_yFiveLines+_bigFontSize*_yFactor5lines*4);
}
//Draws entire screen Controller Settings
void WinControllerMenu::draw() {
_lcd->fillScr(VGA_WHITE);
_buttons.deleteAllButtons();
printMenuHeader(nameWinControllerMenu);
addFlowButtons(true,false,true,_controllerButtons);
print();
_buttons.drawButtons();
}
//Redraws only controller settings text from inner temp vars
//Used when +- signs are pressed
void WinControllerMenu::update() {
_lcd->setColor(lightGreen[0],lightGreen[1],lightGreen[2]);
_lcd->setFont(uint8_t* hallfetica_normal);
//Sound ON/OFF
if (_soundActive)
_lcd->print(pmChar(onStr),_xMenu+_bigFontSize*2+_bigFontSize*strlen_P(controllerButtonText[3]),_yFiveLines+_bigFontSize*2*3);
else
_lcd->print(pmChar(offStr),_xMenu+_bigFontSize*2+_bigFontSize*strlen_P(controllerButtonText[3]),_yFiveLines+_bigFontSize*2*3);
//Serial Debug ON/OFF
if (_serialActive)
_lcd->print(pmChar(onStr),_xMenu+_bigFontSize*2+_bigFontSize*strlen_P(controllerButtonText[4]),_yFiveLines+_bigFontSize*2*4);
else
_lcd->print(pmChar(offStr),_xMenu+_bigFontSize*2+_bigFontSize*strlen_P(controllerButtonText[4]),_yFiveLines+_bigFontSize*2*4);
}
Window::Screen WinControllerMenu::processTouch(const int x, const int y) {
int buttonIndex = _buttons.checkButtons(x,y);
//Back
if (buttonIndex == _controllerButtons[0])
return MainMenu;
//Exit
else if (buttonIndex == _controllerButtons[2])
return MainScreen;
//Time & Date
else if (buttonIndex == _controllerButtons[3])
return TimeDate;
//Sensor polling
else if (buttonIndex == _controllerButtons[4])
return SensorPolling;
//SD Card
else if (buttonIndex == _controllerButtons[5])
return SDCard;
//Sound toggle
else if (buttonIndex == _controllerButtons[6]) {
_soundActive = !_soundActive;
_settings->setSound(_soundActive);
update();
//Serial debug toggle
} else if (buttonIndex == _controllerButtons[7]) {
_serialActive = !_serialActive;
_settings->setSerialDebug(_serialActive);
update();
}
return None;
}
These are the error messages I'm receiving:
WinControllerMenu.cpp: In member function 'virtual void WinControllerMenu::print()':
WinControllerMenu.cpp:44: error: expected primary-expression before '' token
_lcd->setFont(uint8_t hallfetica_normal);
^
WinControllerMenu.cpp: In member function 'virtual void WinControllerMenu::update()':
WinControllerMenu.cpp:71: error: expected primary-expression before '' token
_lcd->setFont(uint8_t hallfetica_normal);
^
expected primary-expression before '*'
WinControllerMenu.cpp (4.08 KB)
WinControllerMenu.h (2.39 KB)
UTouch.cpp (4.49 KB)
UTouch.h (1.59 KB)
UTFT.cpp (25.7 KB)
UTFT.h (7.71 KB)