Added pips, and telemetry_stop mechanism for them. Alternate rtty/contestia

geofence_dev
Richard Meadows 2015-03-16 01:09:25 +00:00
rodzic b2df1f567e
commit 5fb78df303
3 zmienionych plików z 38 dodań i 9 usunięć

Wyświetl plik

@ -47,7 +47,7 @@ char telemetry_string[TELEMETRY_STRING_MAX];
int telemetry_active(void);
int telemetry_start(enum telemetry_t type, int32_t length);
int telemetry_start_rsid(rsid_code_t rsid);
void telemetry_stop(void);
float timer0_tick_init(float frequency);
void timer0_tick_frequency(float frequency);

Wyświetl plik

@ -222,13 +222,21 @@ void output_telemetry_string(enum telemetry_t type)
telemetry_start_rsid(RSID_CONTESTIA_32_1000);
}
/* Sleep Wait for RSID to be done */
/* Sleep Wait for RSID */
while (telemetry_active()) {
system_sleep();
}
/* Main telemetry */
telemetry_start(type, len);
/* Sleep Wait for main telemetry */
while (telemetry_active()) {
system_sleep();
}
/* Pips */
telemetry_start(TELEMETRY_PIPS, 0xFFFF);
}
/**
@ -308,6 +316,8 @@ void timepulse_callback(uint32_t sequence)
*/
int main(void)
{
uint32_t telemetry_alternate = 0;
init();
measure_xosc(XOSC_MEASURE_TIMEPULSE, xosc_measure_callback);
@ -316,17 +326,23 @@ int main(void)
while (1) {
/* Sleep wait for next telemetry */
while (telemetry_trigger_flag == 0 || telemetry_active()) {
while (telemetry_trigger_flag == 0) {
system_sleep();
}
telemetry_trigger_flag = 0;
/* End pips */
telemetry_stop();
while (telemetry_active()) {
system_sleep();
}
/* Watchdog */
//wdt_reset_count();
/* Send the next packet */
output_telemetry_string(TELEMETRY_CONTESTIA);
//telemetry_start(TELEMETRY_PIPS, 5);
output_telemetry_string((telemetry_alternate++ & 1) ?
TELEMETRY_CONTESTIA :
TELEMETRY_RTTY);
}
}

Wyświetl plik

@ -103,6 +103,10 @@ int32_t telemetry_string_length = 0;
* Where we are in the current output
*/
int32_t telemetry_index;
/**
* Should we stop?
*/
uint8_t telemetry_stop_flag = 0;
/**
* Is the radio currently on?
*/
@ -128,6 +132,7 @@ int telemetry_start(enum telemetry_t type, int32_t length) {
telemetry_type = type;
telemetry_index = 0;
telemetry_string_length = length;
telemetry_stop_flag = 0;
/* Setup timer tick */
switch(telemetry_type) {
@ -173,14 +178,22 @@ int telemetry_start_rsid(rsid_code_t rsid) {
return 1; /* Already active */
}
}
/**
* Stops the ongoing telemetry at the earliest possible moment (end of
* symbol / block).
*/
void telemetry_stop(void) {
if (telemetry_active()) {
telemetry_stop_flag = 1;
}
}
uint8_t is_telemetry_finished(void) {
if (telemetry_index >= telemetry_string_length) {
if (telemetry_index >= telemetry_string_length || telemetry_stop_flag) {
/* All done, deactivate */
telemetry_string_length = 0;
telemetry_stop_flag = 0;
/* Turn radio off */
if (radio_on) {