Sending gps string to radiometrix - help needed!

  1. Using the “Linking an Arduino to a Radiometrix NTX2B Transmitter - RTTY code” I have managed to transmit a RTTY sentence (“RTTY TEST BEACON RTTY TEST BEACON”)

  2. Using a modified Tiny GPS programme, I have managed to send GPS data in the form of a string to an SD Card.

  3. Then I combined the two programmes - they compile, upload and send GPS data to the serial monitor

  4. However, I have had no success in devising a way of sending the GPS string to the Radiometrix.

I have attached the full programme.

I am a novice, but progressing, so I hope there is some clear headed person out there who can help me out with a little direction.

Colin.

GPS_Radiometrix.txt (9.79 KB)

String SD_date_time = "invalid";
String SD_lat = "invalid";
String SD_lon = "invalid";
String SD_alt = "invalid";
String dataString ="";//used to concatinate string values, above

The first 4 contribute nothing over regular C strings.

The last one is completely unnecessary. NOTHING can tell whether the data sent it was written using 100 write statements vs. 1 write statement. The resulting stream of data is EXACTLY the same.

  // Every second print an update
  while (millis() - start < 1000)
  {
    if (feedgps())
      newdata = true;
  }

This, incorrectly, assumes that data arrives exactly once a second, and that all of the data will arrive within the window that you are looking at. Get rid of the while loop and the newdata boolean.

Put the logging and sending code in the body of the if statement. Logging data once a second if it arrives 5 times a second does not make sense. Logging data once a second if it arrives once every 10 seconds does not make sense.

  gpsdump(gps);

That function does FAR more than it’s name implies. I can’t follow the logic of a function that does so much stuff. Name the function correctly, or break the function into smaller pieces, each named correctly.

  delay(1000);//slows dataflow-------------------------------------------------------------------------------------------------------------------------

You misspelled “pisses away time uselessly”.

static void print_int(unsigned long val, unsigned long invalid, int len)
{
  char sz[32];
  if (val == invalid)
    strcpy(sz, "*******");
  else
    sprintf(sz, "%ld", val);
  sz[len] = 0;
  for (int i=strlen(sz); i<len; ++i)
    sz[i] = ' ';
  if (len > 0) 
    sz[len-1] = ' ';
  Serial.print(sz);
  feedgps();
}

Calling feedgps() from this function is wrong. The only reason it is even remotely necessary is because of the useless delay()s and while loop that is incorrectly reading data.

Ditto for all the other functions that call feedgps().

rtty_txstring() calls rtty_txstring() which calls rtty_txstring() which calls rtty_txstring…

It’s a good thing that you never actually call this function.

Why is that function recursive? Why do you never actually call it?

Paul,

Thank you for your very helpful analysis.

I don't comprehend the full implications of all your points: some I get; the others will help me to look at things from a different perspective.

Again, thank you for taking the time to respond.

Best wishes,

Colin.