ok so i am having a little issue with trying to make the case smaller due to its repeating it self for timer 1-4...
i know that in normal functions you can use the "for loop" to reprint things that are repeating but what about the touch portion on a utft?
here is my sketch that i want to make smaller... (Attached ino)
i have tryed doing it like this and it doesnt seem to work....
byte timerOnH[]={0, mistingT1OnH, mistingT2OnH, mistingT3OnH, mistingT4OnH},
timerOnM[]={0, mistingT1OnM, mistingT2OnM, mistingT3OnM, mistingT4OnM},
timerOnS[]={0, mistingT1OnS, mistingT2OnS, mistingT3OnS, mistingT4OnS},
timerOffH[]={0, mistingT1OffH, mistingT2OffH, mistingT3OffH, mistingT4OffH},
timerOffM[]={0, mistingT1OffM, mistingT2OffM, mistingT3OffM, mistingT4OffM},
timerOffS[]={0, mistingT1OffS, mistingT2OffS, mistingT3OffS, mistingT4OffS};
byte timerAmPmOnx[]={0, timerAmPm1On, timerAmPm2On, timerAmPm3On, timerAmPm4On},
timerAmPmOffx[]={0, timerAmPm1Off, timerAmPm2Off, timerAmPm3Off, timerAmPm4Off};
byte timerSetSux[]={0, timerSetSu1, timerSetSu2, timerSetSu3, timerSetSu4},
timerSetMox[]={0, timerSetMo1, timerSetMo2, timerSetMo3, timerSetMo4},
timerSetTux[]={0, timerSetTu1, timerSetTu2, timerSetTu3, timerSetTu4},
timerSetWex[]={0, timerSetWe1, timerSetWe2, timerSetWe3, timerSetWe4},
timerSetThx[]={0, timerSetTh1, timerSetTh2, timerSetTh3, timerSetTh4},
timerSetFrx[]={0, timerSetFr1, timerSetFr2, timerSetFr3, timerSetFr4},
timerSetSax[]={0, timerSetSa1, timerSetSa2, timerSetSa3, timerSetSa4};
boolean SwitchOnOff[]={0, mistingSwitch1OnOff, mistingSwitch2OnOff, mistingSwitch3OnOff, mistingSwitch4OnOff};
if (offMisting2RH>0)
{
// do nothing
} else {
for (byte xx= 1; xx< 5; xx++)
{
if ((x>=1) && (y>=4 + xx * 28) && (x<=318) && (y<=27 + xx * 28) // Set Misting Timer 1
&& (timerOnH[xx]==0) && (timerOnM[xx]==0) && (timerOnS[xx]==0)
&& (timerOffH[xx]==0) && (timerOffM[xx]==0) && (timerOffS[xx]==0)
|| (x>=1) && (y>=4 + xx * 28) && (x<=220) && (y<=27 + xx * 28))
{
timerPage=xx;
timerHoursOn=timeHour; timerMinsOn=t.min; timerSecsOn=t.sec;
timerHoursOff=timeHour; timerMinsOff=t.min; timerSecsOff=t.sec;
timerAmPmOn=AM_PM; timerAmPmOff=AM_PM;
timerSetSu=0; timerSetMo=0; timerSetTu=0; timerSetWe=0;
timerSetTh=0; timerSetFr=0; timerSetSa=0;
dispScreen=9;
clearScreen();
setTimerScreen();
}
if ((timerOnH[xx]>0) || (timerOnM[xx]>0) || (timerOnS[xx]>0) || (timerOffH[xx]>0) || (timerOffM[xx]>0) || (timerOffS[xx]>0))
{
if ((x>=onOffTimerButton1[0]) && (y>=5 + xx * 28) && (x<=onOffTimerButton1[2]) && (y<=25 + xx * 28)) //Pushing On/Off Button
{
if (SwitchOnOff[xx]==false)
{
SwitchOnOff[xx]=true;
} else {
SwitchOnOff[xx]=false;}
waitForIt(onOffTimerButton1[0], (5 + xx * 28), onOffTimerButton1[2], (25 + xx * 28));
if (xx=1){
SaveMistingSwitch1OnOffToEEPROM();}
if (xx=2){
SaveMistingSwitch2OnOffToEEPROM();}
if (xx=3){
SaveMistingSwitch3OnOffToEEPROM();}
if (xx=4){
SaveMistingSwitch4OnOffToEEPROM();}
dispScreen=10;
clearScreen();
displayTimerScreen();
}
if ((x>=resetTimerButton1[0]) && (y>=5 + xx * 28) && (x<=resetTimerButton1[2]) && (y<=25 + xx * 28)) //Pushing Reset Button
{
waitForIt(resetTimerButton1[0], (y>=5 + xx * 28), resetTimerButton1[2], (25 + xx * 28));
timerOnH[xx]=0; timerOnM[xx]=0; timerOnS[xx]=0;
timerOffH[xx]=0; timerOffM[xx]=0; timerOffS[xx]=0;
timerAmPmOnx[xx]=1; timerAmPmOffx[xx]=1;
timerSetSux[xx]=0; timerSetMox[xx]=0; timerSetTux[xx]=0; timerSetWex[xx]=0;
timerSetThx[xx]=0; timerSetFrx[xx]=0; timerSetSax[xx]=0;
SwitchOnOff[xx]=false;
if (xx=1){
SaveMistingSwitch1OnOffToEEPROM();
SaveMisting1ToEEPROM();}
if (xx=2){
SaveMistingSwitch2OnOffToEEPROM();
SaveMisting2ToEEPROM();}
if (xx=3){
SaveMistingSwitch3OnOffToEEPROM();
SaveMisting3ToEEPROM();}
if (xx=4){
SaveMistingSwitch4OnOffToEEPROM();
SaveMisting4ToEEPROM();}
dispScreen=10;
clearScreen();
displayTimerScreen();
}
}
}
case_sketch.ino (9.35 KB)