mirror of
https://github.com/oliverschmidt/contiki.git
synced 2024-12-22 10:30:13 +00:00
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;
|
||||
int lqi = ((DGRMDestinationRadio)r).lqi;
|
||||
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);
|
||||
if(green > 1) green = 1;
|
||||
if(green < 0) green = 0;
|
||||
if (prob == 0.0d) {
|
||||
continue;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user