Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

position frame rate limiting #93

Closed
dl9sau opened this issue Oct 17, 2021 · 3 comments
Closed

position frame rate limiting #93

dl9sau opened this issue Oct 17, 2021 · 3 comments

Comments

@dl9sau
Copy link

dl9sau commented Oct 17, 2021

I saw a relative high rate of frames sent in between 5s. This is too high for LoRa.
20s is imho a minimum. May be lesser on higher data rates (smaller SF than 12).

In TTGO_T-Beam_LoRa_APRS.ino I added:

After

  average_speed_final = (average_speed[0]+average_speed[1]+average_speed[2]+average_speed[3]+average_speed[4])/5;
   average_course[point_avg_course] = gps.course.deg();   // calculate smart beaconing course
   ++point_avg_course;

..this check:

 // not transmitted due to rate limit in previous round? Try again without recomputing nextTX
if (nextTX && nextTX <= 20000L)
  goto behind_recomputation_of_nextTX;

And:

Instead of

  if ((millis()<sb_max_interval)&&(lastTX == 0)) {
     nextTX = 0;
   }
  if ( (lastTX+nextTX) <= millis()  ) {

this code:

if ((millis()<sb_max_interval)&&(lastTX == 0)) {
    nextTX = 0;
  }

behind_recomputation_of_nextTX:

 // rate limit to 20s¶
 if ((lastTX+nextTX) < millis()) && ((millis()-lastTX) >= 20000L)) { 

Btw, last line, I think "if ( (lastTX+nextTX) < millis() )" instead of "if ( (lastTX+nextTX) <= millis() )" is correct,
because lastTX is equal to millis(), and nextTX is 0, we just have transmitted.

@mi-gri
Copy link

mi-gri commented Oct 21, 2021

I guess there is a { missing at the end of the last line of the corrected code?

mi-gri added a commit to mi-gri/TTGO-T-Beam-LoRa-APRS that referenced this issue Oct 21, 2021
@dl9sau
Copy link
Author

dl9sau commented Oct 21, 2021

I guess there is a { missing at the end of the last line of the corrected code?

Yes. Cut+Paste problem. Because: a new feature I did not mentioned yet:
stoping beacon, if kiss client with same call+ssid is connected and sends position reports, we stop sending on our own, until he keeps silent (for beacon max time) or gets disconnected) .
That's why my current code part is
if (!dont_send_own_position_packets && ((lastTX+nextTX) < millis()) && ((millis()-lastTX) >= 20000L)) {
if (gps.location.age() < 2000) {
....

@dl9sau
Copy link
Author

dl9sau commented Dec 18, 2021

Feature is stable in my development version

@dl9sau dl9sau closed this as completed Dec 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants