From 1c2b9392568032de3c04e187c7eb494a5ebe3ed1 Mon Sep 17 00:00:00 2001 From: Richard Meadows Date: Sat, 19 Dec 2015 21:01:35 +0000 Subject: [PATCH] UBSEDS12: Contestia 16/1000 once per minute --- firmware/inc/contestia.h | 25 +++++++++++++++++++----- firmware/inc/hw_config.h | 2 +- firmware/src/contestia.c | 6 +++--- firmware/src/main.c | 16 +++++++--------- firmware/src/mfsk.c | 41 ++++++++-------------------------------- 5 files changed, 39 insertions(+), 51 deletions(-) diff --git a/firmware/inc/contestia.h b/firmware/inc/contestia.h index bfb3ec8..b9c4dbf 100644 --- a/firmware/inc/contestia.h +++ b/firmware/inc/contestia.h @@ -25,13 +25,28 @@ #ifndef CONTESTIA_H #define CONTESTIA_H + +/* /\** */ +/* * Contestia 8/1000 */ +/* *\/ */ +/* #define CONTESTIA_NUMBER_OF_TONES 8 */ +/* #define CONTESTIA_CHARACTERS_PER_BLOCK 3 */ +/* #define CONTESTIA_CHANNEL_SPACING 16 // Corresponds to 124.88 Hz */ +/* #define CONTESTIA_SYMBOL_RATE 125 */ /** - * Contestia 32/1000 + * Contestia 16/1000 */ -#define CONTESTIA_NUMBER_OF_TONES 32 -#define CONTESTIA_CHARACTERS_PER_BLOCK 5 -#define CONTESTIA_CHANNEL_SPACING 4 // Corresponds to 31.22 Hz -#define CONTESTIA_SYMBOL_RATE 31.25 +#define CONTESTIA_NUMBER_OF_TONES 16 +#define CONTESTIA_CHARACTERS_PER_BLOCK 4 +#define CONTESTIA_CHANNEL_SPACING 8 // Corresponds to 62.44 Hz +#define CONTESTIA_SYMBOL_RATE 62.5 +/* /\** */ +/* * Contestia 32/1000 */ +/* *\/ */ +/* #define CONTESTIA_NUMBER_OF_TONES 32 */ +/* #define CONTESTIA_CHARACTERS_PER_BLOCK 5 */ +/* #define CONTESTIA_CHANNEL_SPACING 4 // Corresponds to 31.22 Hz */ +/* #define CONTESTIA_SYMBOL_RATE 31.25 */ void contestia_start(char* data); diff --git a/firmware/inc/hw_config.h b/firmware/inc/hw_config.h index 108de96..e29c243 100644 --- a/firmware/inc/hw_config.h +++ b/firmware/inc/hw_config.h @@ -129,7 +129,7 @@ * Telemetry */ #define TELEMETRY_FREQUENCY 434600000 -#define TELEMETRY_INTERVAL 30 +#define TELEMETRY_INTERVAL 60 #define APRS_INTERVAL 180 /** diff --git a/firmware/src/contestia.c b/firmware/src/contestia.c index 388749f..882926d 100644 --- a/firmware/src/contestia.c +++ b/firmware/src/contestia.c @@ -35,7 +35,7 @@ /** * Current output tones */ -int8_t contestia_tones[CONTESTIA_NUMBER_OF_TONES]; +int8_t contestia_tones[32]; /** * Where we are in the current output tones */ @@ -80,7 +80,7 @@ uint8_t contestia_tick(void) { return 1; } - if (contestia_tone_index < CONTESTIA_NUMBER_OF_TONES) { + if (contestia_tone_index < 32) { uint8_t binary_code; uint8_t grey_code; @@ -97,7 +97,7 @@ uint8_t contestia_tick(void) { contestia_tone_index++; - if (contestia_tone_index < CONTESTIA_NUMBER_OF_TONES) { + if (contestia_tone_index < 32) { return 1; } diff --git a/firmware/src/main.c b/firmware/src/main.c index 7a0f482..a5e535b 100644 --- a/firmware/src/main.c +++ b/firmware/src/main.c @@ -52,7 +52,7 @@ #include "spi_bitbang.h" #include "system/interrupt.h" -#define CALLSIGN "UBSEDS6" +#define CALLSIGN "UBSEDS12" void xosc_measure_callback(uint32_t result); void timepulse_callback(uint32_t sequence); @@ -223,7 +223,7 @@ void output_telemetry_string(enum telemetry_t type) /* RSID */ /* start - SI NOW BELONGS TO TELEMETRY, WE CANNOT ACCESS */ if (type == TELEMETRY_CONTESTIA) { - telemetry_start_rsid(RSID_CONTESTIA_32_1000); + telemetry_start_rsid(RSID_CONTESTIA_16_1000); } /* Sleep Wait for RSID */ @@ -391,16 +391,14 @@ int main(void) //wdt_reset_count(); /* Send the next packet */ - output_telemetry_string((telemetry_alternate++ & 1) ? - TELEMETRY_CONTESTIA : - TELEMETRY_RTTY); + output_telemetry_string(TELEMETRY_CONTESTIA); /* Maybe aprs? */ - if (aprs_trigger_flag) { - aprs_telemetry(); - } - aprs_trigger_flag = 0; + /* if (aprs_trigger_flag) { */ + /* aprs_telemetry(); */ + /* } */ + /* aprs_trigger_flag = 0; */ /* Pips */ diff --git a/firmware/src/mfsk.c b/firmware/src/mfsk.c index b77fe7c..c4985c0 100644 --- a/firmware/src/mfsk.c +++ b/firmware/src/mfsk.c @@ -27,16 +27,12 @@ #include "samd20.h" #include "mfsk.h" #include "math/fwht.h" - -//#define OLIVIA_MFSK_ENCODE_TEST -#ifdef OLIVIA_MFSK_ENCODE_TEST -#include -#endif - +#include "contestia.h" static const uint64_t scrambler_olivia = 0xE257E6D0291574ECLL; static const uint64_t scrambler_contestia = 0xEDB88320LL; - +static const uint16_t shift_olivia = 13; +static const uint16_t shift_contestia = 5; /** * USEFUL RESOURES ============================================================= * @@ -116,7 +112,8 @@ void olivia_mfsk_encode_block(char* block, int8_t* tones) { size_t bits_per_symbol = 5; /* That is, there are 2^5=32 tones */ - mfsk_encode_block(block, tones, 64, bits_per_symbol, scrambler_olivia, 13); + mfsk_encode_block(block, tones, 64, bits_per_symbol, + scrambler_olivia, shift_olivia); } /** * This function encodes a single block of Contestia MFSK @@ -126,7 +123,7 @@ void olivia_mfsk_encode_block(char* block, int8_t* tones) */ void contestia_mfsk_encode_block(char* block, int8_t* tones) { - size_t bits_per_symbol = 5; /* That is, there are 2^5=32 tones */ + size_t bits_per_symbol = CONTESTIA_CHARACTERS_PER_BLOCK; /* That is, there are 2^x tones */ for (uint8_t c_index = 0; c_index < bits_per_symbol; c_index++) { char character = block[c_index]; @@ -157,28 +154,6 @@ void contestia_mfsk_encode_block(char* block, int8_t* tones) } - mfsk_encode_block(block, tones, 32, bits_per_symbol, scrambler_contestia, 5); + mfsk_encode_block(block, tones, 32, bits_per_symbol, + scrambler_contestia, shift_contestia); } - - -#ifdef OLIVIA_MFSK_ENCODE_TEST -void main(void) -{ - /* Define a test string */ - char test_string[6]; - test_string = "HELLO"; - - /* Define a buffer for the tones produced */ - int8_t tones[64]; - - - olivia_mfsk_encode_block(test_string, tones); - - - /* Debug printout */ - for (int i = 0; i < sizeof(tones)/sizeof(int8_t); i++) { - printf("%d ", tones[i]); - } - printf("\n"); -} -#endif