Cooja, DGRM: Fix problems with out-of-range RSSI-Values.
Certain values cause the DGRMVisualizerSkin to calculate color values that are out of range.
This commit is contained in:
parent
80e7a6fd8c
commit
3c3b25a54b
|
@ -122,7 +122,11 @@ public class DGRMVisualizerSkin implements VisualizerSkin {
|
||||||
double pos_rssi = rssi + 100;
|
double pos_rssi = rssi + 100;
|
||||||
int lqi = ((DGRMDestinationRadio)r).lqi;
|
int lqi = ((DGRMDestinationRadio)r).lqi;
|
||||||
float red = (float)(1 - prob*pos_rssi/90*lqi/100);
|
float red = (float)(1 - prob*pos_rssi/90*lqi/100);
|
||||||
|
if(red > 1) red = 1;
|
||||||
|
if(red < 0) red = 0;
|
||||||
float green = (float)(prob*pos_rssi/90*lqi/100);
|
float green = (float)(prob*pos_rssi/90*lqi/100);
|
||||||
|
if(green > 1) green = 1;
|
||||||
|
if(green < 0) green = 0;
|
||||||
if (prob == 0.0d) {
|
if (prob == 0.0d) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue