Ejemplo n.º 1
0
void advancedConfig() {
	
	while(1) {
	
		menuMax = 1;
		selectedMenu = NOT_SELECTED;
		currentMenu = 0;

		while(selectedMenu == NOT_SELECTED) {
			if (currentMenu == 0) { // DWELL
				greenOn();
				delay_ms(50);
				greenOff();
				redOn();
				delay_ms(50);
				redOff();
				
				delay_ms(800);
			} else if (currentMenu == 1) { // DEBOUNCE 2
				for (uint8_t i = 0; i < 2; i++) {
					greenOn();
					delay_ms(50);
					greenOff();
					redOn();
					delay_ms(50);
					redOff();
					delay_ms(100);
				}

				delay_ms(700);
			}
		}
	
		if (selectedMenu == 0) { // DWELL
			// Max is set high to prevent wrapping around to 0 without the user knowing
			getNumberFromUser(USER_DWELL, 255);
	
			// Dwell was entered into selectedMenu.  Verify it and save it.
			if (selectedMenu >= 2 && selectedMenu <= 20) {
				eeprom_write_byte(&EEPROM_USER_DWELL, selectedMenu);
				USER_DWELL = selectedMenu;
				successBlink();
			} else {
				failureBlink();
			}
		} else { // DEBOUNCE
			// Max is set high to prevent wrapping around to 0 without the user knowing
			getNumberFromUser(USER_DEBOUNCE, 255);
		
			// Debounce was entered into selectedMenu.  Verify it and save it.
			if (selectedMenu >= 5 && selectedMenu <= 50) {
				eeprom_write_byte(&EEPROM_USER_DEBOUNCE, selectedMenu);
				USER_DWELL = selectedMenu;
				successBlink();
			} else {
				failureBlink();
			}
		}	
	}			
}
Ejemplo n.º 2
0
void greenSet(bool state) {
	if (state) {
		greenOn();
	} else {
		greenOff();
	}
}
Ejemplo n.º 3
0
void orangeLed() {
	for (uint8_t x = 0; x < 33; x++) {
		greenOn();
		delay_ms(2);
		redOn();
		
		greenOff();
		delay_ms(1);
		redOff();
	}	
}
Ejemplo n.º 4
0
void successBlink() {
	for (uint8_t i = 0; i < 3; i++) {
		for (uint8_t x = 0; x < 200; x++) {
			greenOn();
			delay_ms(2);
			redOn();
			greenOff();
			delay_ms(1);
			redOff();
		}
	}
}
Ejemplo n.º 5
0
void mainMenu() {
	menuMax = 4;
	selectedMenu = NOT_SELECTED;
	currentMenu = 0;
	bool state = false;
	while(selectedMenu == NOT_SELECTED) {
		if (currentMenu == 0) { // Firing Mode (toggle green then red)
			state = !state;
			
			redSet(!state);
			greenSet(state);
						
			delay_ms(100);
		} else if (currentMenu == 1) { // Firing Rate (fast green blink)
			state = !state;
			
			redOff();
			greenSet(state);
			
			delay_ms(50);
		} else if (currentMenu == 2) {  // Burst size (three red blinks)
			lightsOff();
			
			// Display as three blinks of red then pause and repeat
			for (uint8_t i = 0; i < 3; i++) {
				redOn();
				delay_ms(100);
				redOff();
				
				if (i == 2) {
					for (uint8_t i = 0; i < 100; i++) {
						delay_ms(10);
						
						if (selectedMenu != NOT_SELECTED) {
							break;
						}
					}					
				} else {
					delay_ms(100);
				}
			}
		} else if (currentMenu == 3) {  // Ammo Limit (Solid Red)
			redOn();
			greenOff();
		} else if (currentMenu == 4) {  // Safety Shot (Solid Green)
			redOff();
			greenOn();
		}			
	}
}
Ejemplo n.º 6
0
void configTriggerPulled(uint32_t buttonHeldTime) {
	
	// Select the menu
	if (buttonHeldTime >= 1000) {
		selectedMenu = currentMenu;
	} else {
		// Cycle through the menus
		if (currentMenu == menuMax) {
			currentMenu = 0;
		} else {
			currentMenu++;
		}
		
		greenOn();
		delay_ms(50);
		greenOff();
	}		
}
void Traffic_Light::allOn() {
  redOn();
  yellowOn();
  greenOn(); 
}
Ejemplo n.º 8
0
void firingModeMenu() {
	menuMax = 3;
	selectedMenu = NOT_SELECTED;
	currentMenu = FIRING_MODE;
	bool state = LOW;
	while(selectedMenu == NOT_SELECTED) {
		if (currentMenu == 0) {
			state = !state;
			
			redSet(state);
			greenOff();
			
			delay_ms(50);
		} else if (currentMenu == 1) { // Three Round Burst
			lightsOff();
			
			// Display as three blinks of green then pause and repeat
			for (uint8_t i = 0; i < 3; i++) {
				greenOn();
				delay_ms(100);
				greenOff();
				
				if (selectedMenu != NOT_SELECTED) {
					break;
				}
				
				if (i == 2) {
					delay_ms(1000);
				} else {
					delay_ms(100);
				}
			}				
		} else if (currentMenu == 2) { // Auto Response
			lightsOff();
	
			// Display as blink green, blink red, then pause
			greenOn();
			delay_ms(100);
			greenOff();
			delay_ms(100);
			redOn();
			delay_ms(100);
			redOff();

			if (selectedMenu != NOT_SELECTED) {
				break;
			}
		
			delay_ms(1000);
		} else if (currentMenu == 3) { // Auto Response
			redOff();
			greenOn();
		}
	}
	
	if (selectedMenu >= 0 && selectedMenu <= 3) {
		eeprom_write_byte(&EEPROM_FIRING_MODE[currentSelector][CURRENT_PRESET[currentSelector]], selectedMenu);
		successBlink();
	} else {
		failureBlink();
	}
}