Added distance to station.

pull/16/merge
Bob Larkin 2 years ago
parent 78b7fc91dc
commit be2182b23d
  1. 10
      examples/FT8Receive/FT8Receive.ino
  2. 19
      examples/FT8Receive/Process_DSP_R.ino
  3. 8
      examples/FT8Receive/decode_ft8R.ino
  4. 7
      examples/FT8Receive/locatorR.ino

@ -129,6 +129,8 @@ int Target_Flag = 0;
char Target_Call[7]; //six character call sign + /0 char Target_Call[7]; //six character call sign + /0
char Target_Locator[5]; // four character locator + /0 char Target_Locator[5]; // four character locator + /0
int Target_RSL; // four character RSL + /0 int Target_RSL; // four character RSL + /0
float32_t Station_Latitude, Station_Longitude;
float32_t Target_Latitude, Target_Longitude;
// Define FT8 symbol counts // Define FT8 symbol counts
int ND = 58; int ND = 58;
@ -158,10 +160,14 @@ uint8_t secLast = 0;
const int ledPin = 13; const int ledPin = 13;
bool showPower = false; bool showPower = false;
uint32_t tp = 0; uint32_t tp = 0;
uint32_t tu; uint32_t tu;
uint32_t ct=0; uint32_t ct=0;
void setup(void) { void setup(void) {
strcpy(Station_Call, "W7PUA");
strcpy(home_Locator, "CN84");
Station_Latitude = mh2latf(home_Locator);
Station_Longitude = mh2lonf(home_Locator);
// set the Time library to use Teensy 4.x's RTC to keep time // set the Time library to use Teensy 4.x's RTC to keep time
setSyncProvider(getTeensy3Time); setSyncProvider(getTeensy3Time);
AudioMemory_F32(50, audio_settings); AudioMemory_F32(50, audio_settings);

@ -48,21 +48,20 @@ float fftOutput[2048];
float window[2048]; // Change to 1024 by symmetry <<<<<<<<<<<<<<<<<<< float window[2048]; // Change to 1024 by symmetry <<<<<<<<<<<<<<<<<<<
arm_rfft_fast_instance_f32 Sfft; arm_rfft_fast_instance_f32 Sfft;
float32_t powerSum = 0.0f; // Use these for snr estimate
float32_t powerSum = 0.0f; // Use these for snr estimate float32_t runningSum = 0.0f;
float32_t runningSum = 0.0f; float32_t powerMax = 0.0f;
float32_t powerMax = 0.0f; float32_t runningMax = 0.0f;
float32_t runningMax = 0.0f; float32_t noiseBuffer[8]; // Circular storage
float32_t noiseBuffer[8]; // Circular storage uint16_t noiseBufferWrite = 0; // Array index
uint16_t noiseBufferWrite = 0; // Array index bool noiseMeasured = false; // <<<<<<GLOBAL
bool noiseMeasured = false; // <<<<<<GLOBAL uint8_t noisePower8 = 0; // half dB per noise estimate GLOBAL
uint8_t noisePower8 = 0; // half dB per noise estimate GLOBAL
void init_DSP(void) { void init_DSP(void) {
arm_rfft_fast_init_f32(&Sfft, 2048); arm_rfft_fast_init_f32(&Sfft, 2048);
for (int i = 0; i < FFT_SIZE; ++i) for (int i = 0; i < FFT_SIZE; ++i)
window[i] = ft_blackman_i(i, FFT_SIZE); window[i] = ft_blackman_i(i, FFT_SIZE);
offset_step = 1472; // (int) HIGH_FREQ_INDEX*4; /// 1472 offset_step = 1472; // (int) HIGH_FREQ_INDEX*4;
} }
float ft_blackman_i(int i, int N) { float ft_blackman_i(int i, int N) {

@ -251,7 +251,13 @@ void printFT8Received(void) {
Serial.print(message2); Serial.print(message2);
Serial.print(" dt="); Serial.print(new_decoded[kk].dTime); // secs Serial.print(" dt="); Serial.print(new_decoded[kk].dTime); // secs
Serial.print(" freq="); Serial.print(new_decoded[kk].freq_hz); Serial.print(" freq="); Serial.print(new_decoded[kk].freq_hz);
Serial.print(" snr="); Serial.println(new_decoded[kk].snr); Serial.print(" snr="); Serial.print(new_decoded[kk].snr);
if(new_decoded[kk].distance > 0)
{
Serial.print(" km="); Serial.println(new_decoded[kk].distance);
}
else
Serial.println("");
} }
Serial.println(""); Serial.println("");
} }

@ -9,8 +9,6 @@
const float32_t EARTH_RAD = 6371.0f; //radius in km const float32_t EARTH_RAD = 6371.0f; //radius in km
float32_t Latitude, Longitude; float32_t Latitude, Longitude;
float32_t Station_Latitude, Station_Longitude;
float32_t Target_Latitude, Target_Longitude;
void set_Station_Coordinates(char station[]){ void set_Station_Coordinates(char station[]){
process_locator(station); process_locator(station);
@ -63,7 +61,6 @@ float32_t distancef(float32_t lat1, float32_t lon1, float32_t lat2, float32_t lo
} }
// convert degrees to radians (i.e., * PI/180) // convert degrees to radians (i.e., * PI/180)
float32_t deg2radf(float32_t deg) float32_t deg2radf(float32_t deg) {
{ return deg*0.017453292f;
return deg * 0.017453292f;
} }

Loading…
Cancel
Save