kopia lustrzana https://github.com/bristol-seds/pico-tracker
Added pips, and telemetry_stop mechanism for them. Alternate rtty/contestia
rodzic
b2df1f567e
commit
5fb78df303
|
@ -47,7 +47,7 @@ char telemetry_string[TELEMETRY_STRING_MAX];
|
||||||
int telemetry_active(void);
|
int telemetry_active(void);
|
||||||
int telemetry_start(enum telemetry_t type, int32_t length);
|
int telemetry_start(enum telemetry_t type, int32_t length);
|
||||||
int telemetry_start_rsid(rsid_code_t rsid);
|
int telemetry_start_rsid(rsid_code_t rsid);
|
||||||
|
void telemetry_stop(void);
|
||||||
|
|
||||||
float timer0_tick_init(float frequency);
|
float timer0_tick_init(float frequency);
|
||||||
void timer0_tick_frequency(float frequency);
|
void timer0_tick_frequency(float frequency);
|
||||||
|
|
|
@ -222,13 +222,21 @@ void output_telemetry_string(enum telemetry_t type)
|
||||||
telemetry_start_rsid(RSID_CONTESTIA_32_1000);
|
telemetry_start_rsid(RSID_CONTESTIA_32_1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Sleep Wait for RSID to be done */
|
/* Sleep Wait for RSID */
|
||||||
while (telemetry_active()) {
|
while (telemetry_active()) {
|
||||||
system_sleep();
|
system_sleep();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Main telemetry */
|
/* Main telemetry */
|
||||||
telemetry_start(type, len);
|
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)
|
int main(void)
|
||||||
{
|
{
|
||||||
|
uint32_t telemetry_alternate = 0;
|
||||||
|
|
||||||
init();
|
init();
|
||||||
|
|
||||||
measure_xosc(XOSC_MEASURE_TIMEPULSE, xosc_measure_callback);
|
measure_xosc(XOSC_MEASURE_TIMEPULSE, xosc_measure_callback);
|
||||||
|
@ -316,17 +326,23 @@ int main(void)
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
/* Sleep wait for next telemetry */
|
/* Sleep wait for next telemetry */
|
||||||
while (telemetry_trigger_flag == 0 || telemetry_active()) {
|
while (telemetry_trigger_flag == 0) {
|
||||||
system_sleep();
|
system_sleep();
|
||||||
}
|
}
|
||||||
telemetry_trigger_flag = 0;
|
telemetry_trigger_flag = 0;
|
||||||
|
|
||||||
|
/* End pips */
|
||||||
|
telemetry_stop();
|
||||||
|
while (telemetry_active()) {
|
||||||
|
system_sleep();
|
||||||
|
}
|
||||||
|
|
||||||
/* Watchdog */
|
/* Watchdog */
|
||||||
//wdt_reset_count();
|
//wdt_reset_count();
|
||||||
|
|
||||||
/* Send the next packet */
|
/* Send the next packet */
|
||||||
output_telemetry_string(TELEMETRY_CONTESTIA);
|
output_telemetry_string((telemetry_alternate++ & 1) ?
|
||||||
|
TELEMETRY_CONTESTIA :
|
||||||
//telemetry_start(TELEMETRY_PIPS, 5);
|
TELEMETRY_RTTY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -103,6 +103,10 @@ int32_t telemetry_string_length = 0;
|
||||||
* Where we are in the current output
|
* Where we are in the current output
|
||||||
*/
|
*/
|
||||||
int32_t telemetry_index;
|
int32_t telemetry_index;
|
||||||
|
/**
|
||||||
|
* Should we stop?
|
||||||
|
*/
|
||||||
|
uint8_t telemetry_stop_flag = 0;
|
||||||
/**
|
/**
|
||||||
* Is the radio currently on?
|
* Is the radio currently on?
|
||||||
*/
|
*/
|
||||||
|
@ -128,6 +132,7 @@ int telemetry_start(enum telemetry_t type, int32_t length) {
|
||||||
telemetry_type = type;
|
telemetry_type = type;
|
||||||
telemetry_index = 0;
|
telemetry_index = 0;
|
||||||
telemetry_string_length = length;
|
telemetry_string_length = length;
|
||||||
|
telemetry_stop_flag = 0;
|
||||||
|
|
||||||
/* Setup timer tick */
|
/* Setup timer tick */
|
||||||
switch(telemetry_type) {
|
switch(telemetry_type) {
|
||||||
|
@ -173,14 +178,22 @@ int telemetry_start_rsid(rsid_code_t rsid) {
|
||||||
return 1; /* Already active */
|
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) {
|
uint8_t is_telemetry_finished(void) {
|
||||||
if (telemetry_index >= telemetry_string_length) {
|
if (telemetry_index >= telemetry_string_length || telemetry_stop_flag) {
|
||||||
/* All done, deactivate */
|
/* All done, deactivate */
|
||||||
telemetry_string_length = 0;
|
telemetry_string_length = 0;
|
||||||
|
telemetry_stop_flag = 0;
|
||||||
|
|
||||||
/* Turn radio off */
|
/* Turn radio off */
|
||||||
if (radio_on) {
|
if (radio_on) {
|
||||||
|
|
Ładowanie…
Reference in New Issue