Fix telemetry config incorrect addressing.

pull/4/head
CInsights 2018-04-29 10:04:33 +10:00
rodzic 886397de4b
commit e6634414f7
4 zmienionych plików z 19 dodań i 15 usunięć

Wyświetl plik

@ -283,8 +283,6 @@ void aprs_debug_getPacket(packet_t pp, char* buf, uint32_t len)
packet_t aprs_encode_stamped_position_and_telemetry(const char *callsign,
const char *path, aprs_sym_t symbol,
dataPoint_t *dataPoint) {
ptime_t time;
unixTimestamp2Date(&time, dataPoint->gps_time);
// Latitude
uint32_t y = 380926 * (90 - dataPoint->gps_lat/10000000.0);
@ -315,6 +313,11 @@ packet_t aprs_encode_stamped_position_and_telemetry(const char *callsign,
uint8_t src = NMEA_SRC_GGA;
uint8_t origin = ORIGIN_PICO;
ptime_t time;
getTime(&time);
if(time.year == RTC_BASE_YEAR)
/* RTC is not set so use dataPoint (it may have a valid date). */
unixTimestamp2Date(&time, dataPoint->gps_time);
char xmit[256];
uint32_t len = chsnprintf(xmit, sizeof(xmit), "%s>%s,%s:@%02d%02d%02dz",
callsign,
@ -814,7 +817,7 @@ msg_t aprs_send_position_response(aprs_identity_t *id,
packet_t packet = aprs_encode_telemetry_configuration(
id->call,
id->path,
APRS_DEVICE_CALLSIGN,
id->call,
type);
if(packet == NULL) {
TRACE_WARN("BCN > No free packet objects for"
@ -830,10 +833,9 @@ msg_t aprs_send_position_response(aprs_identity_t *id,
TRACE_ERROR("BCN > Failed to transmit telemetry config");
}
}
chThdSleep(TIME_S2I(15));
chThdSleep(TIME_S2I(5));
}
/* TODO: Implement a simple (non base 91) position parameter. */
TRACE_INFO("RX > Message: Position query");
dataPoint_t* dataPoint = getLastDataPoint();
packet_t pp = aprs_encode_stamped_position_and_telemetry(id->call,
@ -1273,7 +1275,7 @@ packet_t aprs_encode_telemetry_configuration(const char *originator,
case 2: return aprs_encode_message(originator, path, destination,
"EQNS.0,0.001,0,0,0.001,0,0,0.001,-4.096,0,0.1,-100,0,12.5,500", false);
case 3: return aprs_encode_message(originator, path, destination,
"BITS.11111111,", false);
"BITS.11111111,Pecan Pico", false);
default: return NULL;
}
}

Wyświetl plik

@ -24,7 +24,7 @@ static dataPoint_t dataPoints[2];
static dataPoint_t* lastDataPoint;
static bool threadStarted = false;
static uint8_t useGPS = 0;
static uint8_t useTEL = 0;
static uint8_t useCFG = 0;
/**
* Returns most recent data point which is complete.
@ -393,9 +393,10 @@ THD_FUNCTION(collectorThread, arg) {
} else {
/*
* No threads using GPS.
* RTC valid so set tp & ltp from fixed location data.
* RTC valid so set tp & ltp from RTC and fixed location data.
*/
TRACE_INFO("COLL > Using fixed location");
getTime(&time);
unixTimestamp2Date(&time, tp->gps_time);
tp->gps_alt = conf_sram.aprs.tx.alt;
tp->gps_lat = conf_sram.aprs.tx.lat;
@ -453,7 +454,8 @@ THD_FUNCTION(collectorThread, arg) {
* Telemetry config (Thread)
*/
THD_FUNCTION(configThread, arg) {
uint8_t *useTEL = arg;
//uint8_t *useCFG = arg;
(void)arg;
while(true) chThdSleep(TIME_S2I(1));
}
@ -478,11 +480,11 @@ void init_data_collector() {
chThdSleep(TIME_MS2I(300)); // Wait a little bit until data collector has initialized first dataset
}
TRACE_INFO("CFG > Startup telemetry config thread");
TRACE_INFO("CFG > Startup telemetry config thread");
th = chThdCreateFromHeap(NULL,
THD_WORKING_AREA_SIZE(10*1024),
"CFG", LOWPRIO,
configThread, &useTEL);
configThread, &useCFG);
if(!th) {
// Print startup error, do not start watchdog for this thread
TRACE_ERROR("CFG > Could not start"

Wyświetl plik

@ -49,7 +49,7 @@ THD_FUNCTION(bcnThread, arg) {
packet_t packet = aprs_encode_telemetry_configuration(
conf->tx.call,
conf->tx.path,
APRS_DEVICE_CALLSIGN,
conf->tx.call,
type);
if(packet == NULL) {
TRACE_WARN("BCN > No free packet objects for"
@ -65,7 +65,7 @@ THD_FUNCTION(bcnThread, arg) {
TRACE_ERROR("BCN > Failed to transmit telemetry config");
}
}
chThdSleep(TIME_S2I(15));
chThdSleep(TIME_S2I(5));
}
last_conf_transmission += conf->tx.tel_enc_cycle;
}

Wyświetl plik

@ -53,7 +53,7 @@ THD_FUNCTION(posThread, arg)
packet_t packet = aprs_encode_telemetry_configuration(
conf->call,
conf->path,
APRS_DEVICE_CALLSIGN,
conf->call,
type);
if(packet == NULL) {
TRACE_WARN("POS > No free packet objects for"
@ -69,7 +69,7 @@ THD_FUNCTION(posThread, arg)
TRACE_ERROR("POS > Failed to transmit telemetry data");
}
}
chThdSleep(TIME_S2I(15));
chThdSleep(TIME_S2I(5));
}
last_conf_transmission += conf->tel_enc_cycle;