lightaprs / LightAPRS-1.0

Arduino based APRS Tracker
GNU General Public License v3.0
92 stars 46 forks source link

Feature request: add CSMA packet scheduling #12

Open maqifrnswa opened 3 years ago

maqifrnswa commented 3 years ago

To prevent on air packet collisions, simple CSMA can be implemented like in AX.25 TNCs http://www.ax25.net/kiss.aspx

The libAPRS turns a pin high when receiving data, which can be used to check if there's something on the air.

Before activating PTT: While LED_RX pin is high, delay(SlotTime). Then check if a random number is less than or equal than P. If it is, turn on PTT, delay(TXDELAY), then send the packet. Else, delay(SlotTime) and go back to the start of this process.

It's possible that digipeaters receiving this packet may be really far away where there still may be collisions, but at least you'd avoid some locally.

This is easy enough to do, if I get a chance to do it I can make a pull request if someone else doesn't get to it first.

m1geo commented 3 years ago

Agreed!

But there is no connection from the radio back to the MCU so it is not able to receive. I have added this functionality on mine (bias ADC0 at half supply, capacitive couple in signal, volume on module up, squelch off)

I'll impliment this in my variant which I am using in my car (with significant changes).