# HG changeset patch # User ethanzonca@CL-ENS241-08.cedarville.edu # Date 2013-01-09 22:10:43 # Node ID 0e169f68c994e704dc67d26c37b75f82fe848f7b # Parent 83e403019e80f2302371cd16871c5fd42d324bdb Added support for UART1, added numerous fixes. Introduction of GPS has caused several difficulties. Lowering baud rate to 4800 has made problems worse, probably change back to 115200 baud and disable serial1 interrupts when AFSK transmitting / logging. diff --git a/master/master/config.h b/master/master/config.h --- a/master/master/config.h +++ b/master/master/config.h @@ -28,6 +28,7 @@ // SD Card #define ERROR_SD_INIT 2 #define ERROR_SD_PARTITION 3 +#define ERROR_CRAP 6 // -------------------------------------------------------------------------- // Slave Sensors config (slavesensors.c) @@ -66,7 +67,7 @@ // -------------------------------------------------------------------------- #define USART0_BAUDRATE 115200 -#define USART1_BAUDRATE 115200 +#define USART1_BAUDRATE 4800 // -------------------------------------------------------------------------- @@ -92,7 +93,7 @@ // - Home: 0 // - IGate: 5 #define S_CALLSIGN "KD8TDF" -#define S_CALLSIGN_ID 11 +#define S_CALLSIGN_ID 9 // 11 // Destination callsign: APRS (with SSID=0) is usually okay. #define D_CALLSIGN "APRS" @@ -108,10 +109,10 @@ // APRS comment: this goes in the comment portion of the APRS message. You // might want to keep this short. The longer the packet, the more vulnerable // it is to noise. -#define APRS_COMMENT "Payload data..." +#define APRS_COMMENT "CedarvilleUniversity HAB" // Transmit the APRS sentence every X milliseconds -#define APRS_TRANSMIT_PERIOD 5000 +#define APRS_TRANSMIT_PERIOD 10000 // -------------------------------------------------------------------------- @@ -126,4 +127,7 @@ // Log to SD card every X milliseconds #define LOGGER_RATE 1000 +// LED cycle indicator speed +#define LEDCYCLE_RATE 100 + #endif /* CONFIG_H_ */ \ No newline at end of file diff --git a/master/master/lib/afsk.c b/master/master/lib/afsk.c --- a/master/master/lib/afsk.c +++ b/master/master/lib/afsk.c @@ -71,8 +71,11 @@ extern const uint16_t TABLE_SIZE = sizeo // phase offset of 1800 gives ~1900 Hz // phase offset of 3300 gives ~2200 Hz +//#define PHASE_DELTA_1200 1800 +//#define PHASE_DELTA_2200 2200 #define PHASE_DELTA_1200 1800 -#define PHASE_DELTA_2200 2200 +#define PHASE_DELTA_2200 3300 + // Module globals volatile unsigned char current_byte; @@ -225,7 +228,7 @@ void afsk_setup() // todo: init radio, maybe in main - sei(); + while(afsk_busy()); } \ No newline at end of file diff --git a/master/master/lib/aprs.c b/master/master/lib/aprs.c --- a/master/master/lib/aprs.c +++ b/master/master/lib/aprs.c @@ -15,9 +15,9 @@ #include "ax25.h" #include -const char *gps_aprs_lat = "latitude"; -const char *gps_aprs_lon = "longitude"; -const char *gps_time = "gpstime"; +const char *gps_aprs_lat = "39.74744N"; +const char *gps_aprs_lon = "-83.81249W"; +const char *gps_time = "081533/"; float gps_altitude = 123.5; int gps_course = 5; int gps_speed = 13; diff --git a/master/master/lib/led.c b/master/master/lib/led.c --- a/master/master/lib/led.c +++ b/master/master/lib/led.c @@ -33,7 +33,7 @@ void led_on(uint8_t led) // Turn the specified LED off void led_off(uint8_t led) { - *(ledList[led].direction) &= ~(1<>8); UBRR1L = (unsigned char)USART1_BAUD_PRESCALE; - /* Enable receiver and transmitter */ - UCSR1B = (1< LEDCYCLE_RATE) { + spin(); + + lastLedCycle = time_millis(); + } + // Periodic: Logging if(time_millis() - lastLog > LOGGER_RATE) { led_on(LED_STATUS); snprintf(logbuf, 16, "%lu,%d,\r\n", time_millis(), sensordata_get(HUMIDITY)); logger_log(logbuf); + //serial0_sendString("Logging: "); + //serial0_sendString(logbuf); led_off(LED_STATUS); + lastLog = time_millis(); } + // Periodic: APRS transmission if(time_millis() - lastAprsBroadcast > APRS_TRANSMIT_PERIOD) { + serial0_sendString(":: APRS Periodic\r\n"); + while(afsk_busy()); aprs_send(); // non-blocking + //serial0_sendString("Initiating APRS transmission...\r\n"); // Start getting values for next transmission @@ -108,7 +159,10 @@ int main(void) lastAprsBroadcast = time_millis(); } + parseResult = serparser_parse(); + + slavesensors_process(parseResult); wdt_reset(); diff --git a/master/master/master.cproj b/master/master/master.cproj --- a/master/master/master.cproj +++ b/master/master/master.cproj @@ -5,7 +5,7 @@ 6.0 com.Atmel.AVRGCC8 {8579ec2d-5815-40db-84e0-1d14239c7aea} - ATmega324P + ATmega644PA none Executable C @@ -48,7 +48,7 @@ 127.0.0.1 - 61309 + 49512 False @@ -132,15 +132,15 @@ compile - - compile - compile compile + + compile + compile @@ -150,40 +150,40 @@ compile - + compile - + compile - + compile - + compile - + compile - + compile - + compile - + compile - + compile - + compile - + compile - + compile @@ -210,9 +210,6 @@ compile - - compile - compile @@ -231,8 +228,8 @@ + - \ No newline at end of file