Hi guys, overview of the situation:
-I am working with GUISlice.
-I have multiple pages
-Each page has some kind of different function.
-I would like the neccesary code for each page to only run when that particular page is being viewed.
Something like this:
If (you're viewing this page) {
do stuff ;
do some more stuff;
Maybe a delay;
}
Im pretty new to all of this, there are certain aspects of coding that I dont completley understand, and sometimes I ask some dumb questions.
Anyway here is what I tried
if (gslc_SetPageCur(&m_gui, E_PG3)){
TS_NTC_103 sensor(0.11,10);
float Temp = sensor.getTemp(analogRead(36));
gslc_ElemXRingGaugeSetVal(&m_gui, m_pElemXRingGauge1 ,Temp );
char acTxt[MAX_STR];
snprintf(acTxt,MAX_STR,"%f",Temp);
gslc_ElemSetTxtStr(&m_gui,m_pElemXRingGauge1,acTxt);
delay (500);
}
The only place in the code that I can see that gives some indication of what page has been selected or is being viewed is this:
bool CbBtnCommon(void* pvGui,void *pvElemRef,gslc_teTouch eTouch,int16_t nX,int16_t nY)
{
// Typecast the parameters to match the GUI and element types
gslc_tsGui* pGui = (gslc_tsGui*)(pvGui);
gslc_tsElemRef* pElemRef = (gslc_tsElemRef*)(pvElemRef);
gslc_tsElem* pElem = gslc_GetElemFromRef(pGui,pElemRef);
if ( eTouch == GSLC_TOUCH_UP_IN ) {
// From the element's ID we can determine which button was pressed.
switch (pElem->nId) {
//<Button Enums !Start!>
case E_ELEM_IMAGEBTN3:
gslc_SetPageCur(&m_gui, E_PG2);
break;
case E_ELEM_IMAGEBTN4:
gslc_SetPageCur(&m_gui, E_PG4);
break;
case E_ELEM_IMAGEBTN1:
gslc_SetPageCur(&m_gui, E_PG3);
break;
case E_ELEM_IMAGEBTN2:
gslc_SetPageCur(&m_gui, E_PG5);
break;
case E_ELEM_IMAGEBTN6:
gslc_SetPageCur(&m_gui, E_PG_MAIN);
break;
case E_ELEM_IMAGEBTN7:
gslc_SetPageCur(&m_gui, E_PG_MAIN);
break;
case E_ELEM_IMAGEBTN8:
gslc_SetPageCur(&m_gui, E_PG_MAIN);
break;
case E_ELEM_BTN1:
break;
case E_ELEM_BTN2:
break;
case E_ELEM_BTN3:
break;
case E_ELEM_BTN5:
break;
case E_ELEM_IMAGEBTN9:
gslc_SetPageCur(&m_gui, E_PG_MAIN);
break;
//<Button Enums !End!>
default:
break;
}
}
return true;
}
The error message i get is :
\Arduino\tiretool\tiretool.ino: In function 'void loop()':
tiretool:131:22: error: could not convert 'gslc_SetPageCur((& m_gui), 2)' from 'void' to 'bool'
if (gslc_SetPageCur(&m_gui, E_PG3)){
^
.....
exit status 1
could not convert 'gslc_SetPageCur((& m_gui), 2)' from 'void' to 'bool'
Can someone please tell me if I am on the right track? Maybe a brief explanation on why its not working and how to implement something like this properly?
Thanks