radio medium bugfix: a combination of changing channels while radio is off and with a nearby ongoing transmission, and

then immediately turning on the radio caused it to incorrectly detect the ongoing transmission (bug reported by Beshr Al Nahas)
This commit is contained in:
Fredrik Osterlind 2012-03-09 15:23:16 +01:00
parent babcc76757
commit 2c486aacd7
3 changed files with 32 additions and 1 deletions

View file

@ -300,6 +300,11 @@ public class MRM extends AbstractRadioMedium {
for (RadioConnection conn : conns) {
for (Radio dstRadio : ((MRMRadioConnection) conn).getDestinations()) {
double signalStrength = ((MRMRadioConnection) conn).getDestinationSignalStrength(dstRadio);
if (conn.getSource().getChannel() >= 0 &&
dstRadio.getChannel() >= 0 &&
conn.getSource().getChannel() != dstRadio.getChannel()) {
continue;
}
if (dstRadio.getCurrentSignalStrength() < signalStrength) {
dstRadio.setCurrentSignalStrength(signalStrength);
}
@ -313,6 +318,11 @@ public class MRM extends AbstractRadioMedium {
if (intfRadio.getCurrentSignalStrength() < signalStrength) {
intfRadio.setCurrentSignalStrength(signalStrength);
}
if (conn.getSource().getChannel() >= 0 &&
intfRadio.getChannel() >= 0 &&
conn.getSource().getChannel() != intfRadio.getChannel()) {
continue;
}
if (!intfRadio.isInterfered()) {
/*logger.warn("Radio was not interfered: " + intfRadio);*/

View file

@ -147,6 +147,11 @@ public abstract class AbstractRadioMedium extends RadioMedium {
conn.getSource().setCurrentSignalStrength(SS_STRONG);
}
for (Radio dstRadio : conn.getDestinations()) {
if (conn.getSource().getChannel() >= 0 &&
dstRadio.getChannel() >= 0 &&
conn.getSource().getChannel() != dstRadio.getChannel()) {
continue;
}
if (dstRadio.getCurrentSignalStrength() < SS_STRONG) {
dstRadio.setCurrentSignalStrength(SS_STRONG);
}
@ -159,7 +164,11 @@ public abstract class AbstractRadioMedium extends RadioMedium {
if (intfRadio.getCurrentSignalStrength() < SS_STRONG) {
intfRadio.setCurrentSignalStrength(SS_STRONG);
}
if (conn.getSource().getChannel() >= 0 &&
intfRadio.getChannel() >= 0 &&
conn.getSource().getChannel() != intfRadio.getChannel()) {
continue;
}
if (!intfRadio.isInterfered()) {
/*logger.warn("Radio was not interfered");*/
intfRadio.interfereAnyReception();

View file

@ -287,6 +287,12 @@ public class UDGM extends AbstractRadioMedium {
conn.getSource().setCurrentSignalStrength(SS_STRONG);
}
for (Radio dstRadio : conn.getDestinations()) {
if (conn.getSource().getChannel() >= 0 &&
dstRadio.getChannel() >= 0 &&
conn.getSource().getChannel() != dstRadio.getChannel()) {
continue;
}
double dist = conn.getSource().getPosition().getDistanceTo(dstRadio.getPosition());
double maxTxDist = TRANSMITTING_RANGE
@ -303,6 +309,12 @@ public class UDGM extends AbstractRadioMedium {
/* Set signal strength to below weak on interfered */
for (RadioConnection conn : conns) {
for (Radio intfRadio : conn.getInterfered()) {
if (conn.getSource().getChannel() >= 0 &&
intfRadio.getChannel() >= 0 &&
conn.getSource().getChannel() != intfRadio.getChannel()) {
continue;
}
double dist = conn.getSource().getPosition().getDistanceTo(intfRadio.getPosition());
double maxTxDist = TRANSMITTING_RANGE