1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-17 02:52:12 +01:00

OP-932 Adds working one-way mode to the OPLink radio connection. In this mode, packets will only flow from the ground side (coordinator modem) to the flight side modem.

This commit is contained in:
Brian Webb 2013-06-16 10:07:56 -07:00
parent 774a74884a
commit fc0328a3cd

View File

@ -2013,8 +2013,18 @@ static portTickType rfm22_coordinatorTime(struct pios_rfm22b_dev *rfm22b_dev, po
static bool rfm22_timeToSend(struct pios_rfm22b_dev *rfm22b_dev)
{
portTickType time = rfm22_coordinatorTime(rfm22b_dev, xTaskGetTickCount());
bool is_coordinator = rfm22_isCoordinator(rfm22b_dev);
if (!rfm22_isCoordinator(rfm22b_dev)) {
// If this is a one-way link, only the coordinator can send.
if (rfm22b_dev->one_way_link) {
if (is_coordinator) {
return ((time -1) % (rfm22b_dev->packet_period)) == 0;
} else {
return false;
}
}
if (!is_coordinator) {
time += rfm22b_dev->packet_period - 1;
} else {
time -= 1;