Exemple #1
0
/***********************************************************
* 
* updateLCD
* 
***********************************************************/
void TTUI::updateLCD()
{
	
	//only update LCD every 300ms
	int now = millis()/100; //100 ms 
	int elapsed = now - activeRefreshTime;

	if(elapsed > 3)  //300ms
	{
		activeRefreshTime = now;
	
	
		if(trapActive_ == true)
		{
			if(batteryPower() == false) //USB connected
			{
				clear();
				printMode(0);

				char printBuffer[9];
				triggers[currentTrigger]->getActiveMessage(printBuffer);
				setCursor(0,1);
				print(printBuffer);
					
			}
		}
		else if(trapActive_ == false) //waiting for UI input
		{
			if(activeMenu == UP_MENU || activeMenu == DOWN_MENU)
			{
				clear();
				printSelect(0);
				printInc(1,0);
			}
			else if(activeMenu == MODE_MENU || activeMenu == OPTION_MENU)
			{
				clear();
			 	printMode(0);
			 	printSelect(1);
			}
			else if(activeMenu == START_MESSAGE)
			{
				clear();
				print("TrigTrap");
				setCursor(0,1);
				print("v");
				print(FIRMWARE_VERSION);
			}
		}
	}
	
}
void printEl(Tree *tmp)
{
	printf("\n	In ascending or descending order (a/d)? ");
	char c = 0;
	scanf("%c", &c);
	if (c == '\n')
			scanf("%c", &c);
	printf("\n	");
	if (c == 'a')
		printInc(tmp);
	else if (c == 'd')
		printDec(tmp);
	printf("\n");
}
Exemple #3
0
/***********************************************************
* 
* initStart
* 
***********************************************************/
void TTUI::initStart(unsigned long startTime)
{
    if(currentTrigger < NUM_OF_SENSORS) //only start if you are on a sensor menu, not system menu!
    {
		trapActive_ = !trapActive_; //flip boolean status

		if(trapActive_ == true)
		{
			#ifdef SERIAL_DEBUG
			Serial.println("Active");
			#endif
		
			activeRefreshTime = startTime/100; //100ms
			triggers[currentTrigger]->saveState(); //save the values of active trigger to eeprom
			triggers[0]->saveSystem(); //save system menu settings, to trigger 0. 
			triggers[currentTrigger]->start(startTime); //set start time for the active trigger 
			uiPowerOff();
		
		}
		else if(trapActive_ == false) 
		{
			#ifdef SERIAL_DEBUG
			Serial.println("Inactive");
			#endif
			
			triggers[currentTrigger]->resetFocus(true);
			triggers[currentTrigger]->resetShutter(true); //don't want to leave the shutter high forever
			triggers[currentTrigger]->stop(); //set abortTrigger to true
			uiPowerOn();
			//restore screen to so current select menu and value, better to show mode+select?
			//set the value title in line 1
			clear();
			printSelect(0);
			printInc(1,0); //inc 0 so just display, don't actually increment
			

		}
	}
	

			
}
Exemple #4
0
/***********************************************************
* 
* bttnUp
* 
***********************************************************/
void TTUI::bttnUp(boolean hold)
{
	int incVal = 0; 

	if(activeMenu == UP_MENU || activeMenu == DOWN_MENU) //only increment when its the second+ time pressed for this bttn
	{
		incVal = 1; 
		if(hold == true)
		{
			//speed up increment if held down for a long time
			unsigned long holdTime = millis() - touch.getStartTime();
			if(holdTime > 5000) { incVal = 5; } //increase after 5sec
			if(holdTime > 15000) { incVal = 10; } //increase after 15sec
		}
	}
	
	activeMenu = UP_MENU;	

	clear();
	printSelect(0);
	printInc(1,incVal); //don't print, just inc
	
}