Changeset - 62fbc7ad93b6
[Not reviewed]
default
0 2 0
ethanzonca@CL-ENS241-08.cedarville.edu - 12 years ago 2013-03-25 15:28:26
ethanzonca@CL-ENS241-08.cedarville.edu
Fixed buzzer busy wait
2 files changed with 13 insertions and 5 deletions:
0 comments (0 inline, 0 general)
master/master/config.h
Show inline comments
 
@@ -35,14 +35,14 @@
 
#define BLACKOUT_TIMEOUT 300000 // Blackout after 5 minutes (hopefully after fix)
 
 
// Board heater setpoint
 
#define HEATER_THRESHOLD 80
 
 
// Touchdown buzzer
 
#define BUZZER_RATE 3000
 
#define BUZZER_DURATION 3000
 
#define BUZZER_RATE 5000
 
#define BUZZER_DURATION 1000
 
#define BUZZER_FAILSAFE_DURATION 600000
 
#define BUZZER_TRIGGER_MINDURATION 1
 
#define BUZZER_TRIGGER_MAXALTITUDE 1
 
 
// --------------------------------------------------------------------------
 
// Error Codes config (logger.c)
 
@@ -115,13 +115,13 @@
 
 
// --------------------------------------------------------------------------
 
// AX.25 config (ax25.c)
 
// --------------------------------------------------------------------------
 

	
 
// TX delay in milliseconds
 
#define TX_DELAY      500
 
#define TX_DELAY      200
 

	
 
// Maximum packet delay
 
#define MAX_PACKET_LEN 512  // bytes
 
 

	
 
// --------------------------------------------------------------------------
master/master/master.c
Show inline comments
 
@@ -64,12 +64,15 @@ int main(void)
 
	// Software timers	
 
	uint32_t lastAprsBroadcast = 0;
 
	uint32_t lastLog = 0;
 
	uint32_t lastLedCycle = 0;
 
	uint32_t lastDataReq = 0;
 
	uint32_t lastBuzz = 0;
 
	uint32_t lastBuzzOn = 0;
 
	
 
	bool buzz = false;
 
	
 
	// Result of last parser run
 
	int parseResult = PARSERESULT_NODATA;
 
	
 
	while(1)
 
    {
 
@@ -119,18 +122,23 @@ int main(void)
 
		
 
		// Periodic: Buzzer
 
		if(time_millis() - lastBuzz > BUZZER_RATE) {
 
			if(sensordata_isTouchdown())
 
			{
 
				led_on(LED_BUZZ);
 
				_delay_ms(BUZZER_DURATION);
 
				led_off(LED_BUZZ);
 
				lastBuzzOn = time_millis();
 
				buzz = true;
 
			}			
 
			lastBuzz = time_millis();
 
		}
 
		
 
		if(buzz && time_millis() - lastBuzzOn > BUZZER_DURATION) {
 
			led_off(LED_BUZZ);
 
			buzz = false;
 
		}
 
		
 
		// Periodic: Data Request
 
		if(time_millis() - lastDataReq > DATAREQUEST_RATE)  
 
		{
 
			// Start getting values for next transmission
 
			if(slavesensors_isrequesting())
 
			{
0 comments (0 inline, 0 general)