Ejemplo n.º 1
0
// handler routine for timer1 to read the touch screen
void myTouchInt()
{
	static bool inTouch = false;
	if ((!inTouch)&&(myTouch.dataAvailable()))
	{
		inTouch = true;
		myTouch.read();
		xt = myTouch.getX();
		yt = myTouch.getY();
		ixt = xt; iyt = yt;
		myScreen.ETouch.TrigOn(xt,yt);
	}
	if ((inTouch)&&(myTouch.dataAvailable()))
	{
		myTouch.read();
		ixt = myTouch.getX();
		iyt = myTouch.getY();
		if ((ixt != xt)||(iyt != yt))
		myScreen.ESlide.TrigOn(ixt,iyt);
	}
	if ((inTouch)&&(!myTouch.dataAvailable()))
	{
		inTouch = false;
		myScreen.EunTouch.TrigOn(xt,yt);
	}
	myScreen.E100msecond.TrigOn();
}
void ECCalibrateScreen::SwaitForTouch()
{
  while (myTouch.dataAvailable() == true)
  {
	  myTouch.read();
  }
  while (myTouch.dataAvailable() == false) {}
  while (myTouch.dataAvailable() == true)
  {
	  myTouch.read();
  }
}
void HydroponicsUI::CheckForScreenTouch()
{
  if (myTouch.dataAvailable())
    {
      switch(whichScreen)
      {
        case MAIN_SCREEN:
        {
          handleButtons( iMainScreen->handleScreen() );
          break;
        }
         case ABOUT_SCREEN:
        {
          handleButtons( iAboutScreen->handleScreen() );
          break;
        }
          case SETUP_SCREEN:
        {
          handleButtons( iSetupScreen->handleScreen() );
          break;
        }
         case PH_SCREEN:
        {

          handleButtons( ipHScreen->handleScreen() );
          limitInfo.maxPHLevel = ipHScreen->getMax();
          limitInfo.minPHLevel = ipHScreen->getMin();
          break;
        }
          case EC_SCREEN:
        {

          handleButtons( iECScreen->handleScreen() );
          limitInfo.maxECLevel = iECScreen->getMax();
          limitInfo.minECLevel = iECScreen->getMin();
          break;
        }
          case AIR_SCREEN:
        {
        	handleButtons( iAirScreen->handleScreen() );
        	limitInfo.maxAirTemp = iAirScreen->getMax();
        	limitInfo.minAirTemp = iAirScreen->getMin();
        	limitInfo.airUnits = iAirScreen->getUnits();
          break;
        }
          case WATER_SCREEN:
        {
        	handleButtons( iWaterScreen->handleScreen() );
        	limitInfo.maxWaterTemp = iWaterScreen->getMax();
        	limitInfo.minWaterTemp = iWaterScreen->getMin();
          break;
        }
          case PLUGS_SCREEN:
        {
        	handleButtons( iPlugScreen->handleScreen() );
          break;
        }
          case CLOCK_SCREEN:
        {
        	handleButtons( iTimeScreen->handleScreen() );
          break;
        }
         case CALLIBRATE_EC_SCREEN:
        {
           Serial.println("handle EC Cal Screen();  \n");
           handleButtons( iECCalibrateScreen->handleScreen() );
           break;
        }
         case CALLIBRATE_PH_SCREEN:
        {
           Serial.println("handle PH Cal Screen();  \n");
           handleButtons( iPhCalibrateScreen->handleScreen() );
           break;
        }
         case PLUGS_SETTINGS_SCREEN:
        {
           Serial.println("handle Plug Settings Screen();  \n");
           handleButtons( iPlugSettingsScreen->handleScreen() );
           break;
        }
         case PUMP_SCREEN:
          {
          handleButtons( iPumpScreen->handleScreen() );
          break;
          }
         case PUMP_DURATION_SCREEN:
          {
          handleButtons( iPumpDurationScreen->handleScreen() );
          break;
          }
        default: //If Error, Just go back to main.
        {
        	Serial.println("ERROR :::: handleMainScreen();  \n");
        	handleButtons( iMainScreen->handleScreen() );
          break;
        }
        
      }
    }  
}