diff --git a/master/master/config.h b/master/master/config.h --- a/master/master/config.h +++ b/master/master/config.h @@ -190,7 +190,7 @@ typedef struct uint32_t buzzer_trigger_minduration; uint32_t buzzer_trigger_maxaltitude; uint32_t datarequest_rate; - char s_callsign[10]; + char s_callsign[7]; uint8_t s_callsign_id; uint32_t aprs_transmit_period; } configuration; 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 @@ -16,18 +16,21 @@ #include "gps.h" #include "sensordata.h" #include +#include +#include -float meters_to_feet(float m) +int32_t meters_to_feet(int32_t m) { // 10000 ft = 3048 m - return m / 0.3048; + return (float)m / 0.3048; } void aprs_send() { const struct s_address addresses[] = { {D_CALLSIGN, D_CALLSIGN_ID}, // Destination callsign - {sysconfig->s_callsign, sysconfig->s_callsign_id}, // Source callsign (-11 = balloon, -9 = car) + {"", sysconfig->s_callsign_id}, // Source callsign (-11 = balloon, -9 = car) + //{S_CALLSIGN, S_CALLSIGN_ID}, #ifdef DIGI_PATH1 {DIGI_PATH1, DIGI_PATH1_TTL}, // Digi1 (first digi in the chain) #endif @@ -36,6 +39,8 @@ void aprs_send() #endif }; + strncpy(addresses[1].callsign, sysconfig->s_callsign, 7); + // emz: modified this to get the size of the first address rather than the size of the struct itself, which fails ax25_send_header(addresses, sizeof(addresses)/sizeof(addresses[0])); ax25_send_byte('/'); // Report w/ timestamp, no APRS messaging. $ = NMEA raw data @@ -56,25 +61,14 @@ void aprs_send() ax25_send_byte('/'); // and - // !!!TODO: Check the speed! - //snprintf(temp, 4, "%03d", (int)(gps_speed + 0.5)); ax25_send_string(get_speedKnots()); // speed (knots) - /* + int32_t alt = meters_to_feet(strtol(get_gpsaltitude(), NULL, 10)); + + char temp[7]; ax25_send_string("/A="); // Altitude (feet). Goes anywhere in the comment area - snprintf(temp, 7, "%06ld", (long)(meters_to_feet(gps_altitude) + 0.5)); - ax25_send_string(temp); - ax25_send_string("/Ti="); - snprintf(temp, 6, "%d", 122);//sensors_int_lm60()); -- PUT SENSOR DATA HERE + snprintf(temp, 7, "%ld", alt); ax25_send_string(temp); - ax25_send_string("/Te="); - snprintf(temp, 6, "%d", 123);//sensors_ext_lm60()); - ax25_send_string(temp); - ax25_send_string("/V="); - snprintf(temp, 6, "%d", 123);//sensors_vin()); - ax25_send_string(temp); - */ - ax25_send_byte(' '); #define COMMENTBUFFER_SIZE 128 diff --git a/master/master/lib/gps.c b/master/master/lib/gps.c --- a/master/master/lib/gps.c +++ b/master/master/lib/gps.c @@ -435,6 +435,7 @@ void parse_gps_transmission(void){ { if (byte == ',' && skipBytes == 0) //discard this byte { + altitude[numBytes] = 0x00; skipBytes = 1; setParserState(GGA_ALTITUDE); } diff --git a/master/master/lib/iniparse.c b/master/master/lib/iniparse.c --- a/master/master/lib/iniparse.c +++ b/master/master/lib/iniparse.c @@ -52,7 +52,7 @@ static int handler(void* user, const cha pconfig->buzzer_trigger_maxaltitude = strtol(value, NULL, 10); } else if (MATCH("aprs", "call")) { - strncpy(pconfig->s_callsign, value, 10); + snprintf(pconfig->s_callsign, 7, "%s", &value[1], 6); //pconfig->s_callsign = strdup(value); @@ -85,7 +85,7 @@ configuration config = { .buzzer_trigger_minduration = BUZZER_TRIGGER_MINDURATION, .buzzer_trigger_maxaltitude = BUZZER_TRIGGER_MAXALTITUDE, .datarequest_rate = DATAREQUEST_RATE, - .s_callsign = S_CALLSIGN, + .s_callsign_id = S_CALLSIGN_ID, .aprs_transmit_period = APRS_TRANSMIT_PERIOD }; @@ -93,7 +93,10 @@ configuration config = { void iniparse_getconfig() { // Init configuration with default values from config.h - + snprintf(config.s_callsign, 10, "KD8TDF"); + config.s_callsign[6] = NULL; + + if (ini_parse(handler, &config) < 0) { // ERROR: Make new error code here! error_log(ERROR_CONFIGPARSE, false); diff --git a/master/master/lib/iniparse.h b/master/master/lib/iniparse.h --- a/master/master/lib/iniparse.h +++ b/master/master/lib/iniparse.h @@ -14,7 +14,7 @@ #ifndef INIPARSE_H_ #define INIPARSE_H_ - +void iniparse_getconfig(); #endif /* INIPARSE_H_ */ \ No newline at end of file