Exemplo n.º 1
0
Window::Screen WinSensorPolling::processTouch(const int x, const int y) {
	int buttonIndex = _buttons.checkButtons(x,y);
	//Back
	if (buttonIndex == _sensorPollingButtons[0])
		return ControllerSettingsTwo;
	//Save
	else if (buttonIndex == _sensorPollingButtons[1]) {
		_settings->setSensorSecond(_pollSec);
		printSavedButton();
	//Exit
	} else if (buttonIndex == _sensorPollingButtons[2]) 
		return MainScreen;
		
	//Sec up
	else if (buttonIndex == _sensorPollingButtons[3]) {
		(_pollSec >= 59) ? _pollSec=1 : _pollSec++;
		update();
	//Sec down
	} else if (buttonIndex == _sensorPollingButtons[4]) {
		(_pollSec <= 1) ? _pollSec=59 : _pollSec--;
		update();
	}
	return None;
}
Exemplo n.º 2
0
Window::Screen WinLvlCalib::processTouch(const int x, const int y) {
	int buttonIndex = _buttons.checkButtons(x,y);
	//Back
	if (buttonIndex == _waterLevelButtons[0]) 
		return SensorCalib;
	//Save
	else if (buttonIndex == _waterLevelButtons[1]) {
		_settings->setMaxWaterLvl(_waterLvlMax);
		_settings->setMinWaterLvl(_waterLvlMin);
		printSavedButton();
	//Exit
	} else if (buttonIndex == _waterLevelButtons[2]) 
		return MainScreen;
	
	//Top, bottom calib buttons
	else if (buttonIndex == _waterLevelButtons[3]) {
		_waterLvlMax = _rawWaterLvl;
		update();
	} else if (buttonIndex == _waterLevelButtons[4]) {
		_waterLvlMin = _rawWaterLvl;
		update();
	}
	return None;
}
Exemplo n.º 3
0
Window::Screen WinTime::processTouch(const int x, const int y) {
	int buttonIndex = _buttons.checkButtons(x,y);
	//Back
	if (buttonIndex == _timeButtons[0]) 
		return ControllerSettings;
	//Save
	else if (buttonIndex == _timeButtons[1]) {
		_sensors->setRTCtime(_sysHour, _sysMin, _sysSec, _sysDay, _sysMonth, _sysYear);
		printSavedButton();
	//Exit
	} else if (buttonIndex == _timeButtons[2]) 
		return MainScreen;
		
	//Hour up
	else if (buttonIndex == _timeButtons[3]) {
		(_sysHour >= 23) ? _sysHour=0 : _sysHour++;
		update();
	//Min up
	} else if (buttonIndex == _timeButtons[4]) {
		(_sysMin >= 59) ? _sysMin=0 : _sysMin++;
		update();
	//Sec up
	} else if (buttonIndex == _timeButtons[5]) {
		(_sysSec >= 59) ? _sysSec=0 : _sysSec++;;
		update();
	//Hour down
	} else if (buttonIndex == _timeButtons[6]) {
		(_sysHour <= 0) ? _sysHour=23 : _sysHour--;
		update();
	//Min down
	} else if (buttonIndex == _timeButtons[7]) {
		(_sysMin <= 0) ? _sysMin=59 : _sysMin--;
		update();
	//Sec down
	} else if (buttonIndex == _timeButtons[8]) {
		(_sysSec <= 0) ? _sysSec=59 : _sysSec--;
		update();
	//Day up
	} else if (buttonIndex == _timeButtons[9]) {
		(_sysDay >= 31) ? _sysDay=1 : _sysDay++;
		update();
	//Month up
	} else if (buttonIndex == _timeButtons[10]) {
		(_sysMonth >= 12) ? _sysMonth=1 : _sysMonth++;
		update();
	//Year up
	} else if (buttonIndex == _timeButtons[11]) {
		//TimeAlarms can only handle 1971-2037
		(_sysYear >= 2037) ? _sysYear=1971 : _sysYear++;
		update();
	//Day down
	} else if (buttonIndex == _timeButtons[12]) {
		(_sysDay <= 1) ? _sysDay=31 : _sysDay--;
		update();
	//Month down
	} else if (buttonIndex == _timeButtons[13]) {
		(_sysMonth <= 1) ? _sysMonth=12 : _sysMonth--;
		update();
	//Year down
	} else if (buttonIndex == _timeButtons[14]) {
		(_sysYear <= 1971) ? _sysYear=2037 : _sysYear--;
		update();
	}
	return None;
}