diff --git a/firmware/inc/telemetry.h b/firmware/inc/telemetry.h index e29814b..11ae41b 100644 --- a/firmware/inc/telemetry.h +++ b/firmware/inc/telemetry.h @@ -28,6 +28,7 @@ uint16_t crc_checksum(char *string); #include "util/dbuffer.h" +#include "rsid.h" enum telemetry_t { TELEMETRY_RTTY, @@ -49,6 +50,7 @@ ARRAY_DBUFFER_T(char, TELEMETRY_STRING_MAX+TELEMETRY_LARGEST_BLOCK) telemetry_db int telemetry_active(void); int telemetry_start(enum telemetry_t type); +int telemetry_start_rsid(rsid_code_t rsid); int32_t telemetry_get_index(void); void telemetry_set_length(int32_t length); diff --git a/firmware/src/main.c b/firmware/src/main.c index 0688bf5..bd0f625 100644 --- a/firmware/src/main.c +++ b/firmware/src/main.c @@ -148,7 +148,7 @@ void powermananger_init(void) * Telemetry String * ============================================================================= */ -void output_telemetry_string(void) +void output_telemetry_string(enum telemetry_t type) { double lat_fmt = 0.0; double lon_fmt = 0.0; @@ -190,22 +190,25 @@ void output_telemetry_string(void) +/** + * Starting up the radio blocks on high-prio interrupt for ~100ms: todo fixme + * + * Therefore don't touch gps until it's done + */ + /* RSID */ -/* start - SI NOW BELONGS TO TELEMETRY, WE CANNOT ACCESS */ -#ifdef CONTESTIA - telemetry_start_rsid(RSID_CONTESTIA_32_1000); -#endif + /* start - SI NOW BELONGS TO TELEMETRY, WE CANNOT ACCESS */ + if (type == TELEMETRY_CONTESTIA) { + telemetry_start_rsid(RSID_CONTESTIA_32_1000); + } /* Sleep Wait for RSID to be done */ while (telemetry_active()) { system_sleep(); } -#ifdef RTTY - telemetry_start(TELEMETRY_RTTY); -#endif -#ifdef CONTESTIA - telemetry_start(TELEMETRY_CONTESTIA); -#endif + + /* Main telemetry */ + telemetry_start(type); /** * Position, Status, Checksum @@ -334,7 +337,7 @@ int main(void) //wdt_reset_count(); /* Send the next packet */ - output_telemetry_string(); + output_telemetry_string(TELEMETRY_RTTY); telemetry_start(TELEMETRY_PIPS); telemetry_set_length(5); diff --git a/firmware/src/rtty.c b/firmware/src/rtty.c index 419778d..a95f63c 100644 --- a/firmware/src/rtty.c +++ b/firmware/src/rtty.c @@ -34,12 +34,9 @@ * Interface to the physical world. */ #define RTTY_CHANNEL_DEVIATION (RTTY_CHANNEL_SPACING / 2) -#define RTTY_CHANNEL(b) (b ? RTTY_CHANNEL_DEVIATION : -RTTY_CHANNEL_DEVIATION) +#define RTTY_CHANNEL(b) (b ? -RTTY_CHANNEL_DEVIATION : RTTY_CHANNEL_DEVIATION) #define RTTY_SET(b) si_trx_switch_channel(RTTY_CHANNEL(b)) -//port_pin_set_output_level(SI406X_GPIO1_PIN, !b); - - /** * Formatting 8N2 @@ -95,13 +92,5 @@ uint8_t rtty_tick(void) { return 1; } - /* if (rtty_phase >= BITS_PER_CHAR) { // Next character */ - /* rtty_phase = 0; rtty_index++; RTTY_NEXT(); */ - - /* if (rtty_index >= rtty_string_length) { // All done, deactivate */ - /* rtty_string_length = 0; // Deactivate */ - /* } */ - /* } */ - return 0; } diff --git a/firmware/src/si_trx.c b/firmware/src/si_trx.c index 087f8cb..f54d3ff 100644 --- a/firmware/src/si_trx.c +++ b/firmware/src/si_trx.c @@ -364,9 +364,9 @@ void si_trx_reset(uint8_t modulation_type) { _si_trx_sdn_enable(); /* active high shutdown = reset */ - for (int i = 0; i < 15*10000; i++); /* Approx. 15ms */ + for (int i = 0; i < 15*1000; i++); /* Approx. 15ms */ _si_trx_sdn_disable(); /* booting */ - for (int i = 0; i < 15*10000; i++); /* Approx. 15ms */ + for (int i = 0; i < 15*1000; i++); /* Approx. 15ms */ uint16_t part_number = si_trx_get_part_info();