Open GoogleCodeExporter opened 9 years ago
Code contributed from - Gary / k3wow Index: Source/Console/display.cs =================================================================== --- Source/Console/display.cs (revision 252) +++ Source/Console/display.cs (working copy) @@ -772,6 +772,7 @@ get { return waterfall_low_threshold; } set { waterfall_low_threshold = value; } } + private static float waterfall_dynamic_low_threshold = -130.0f; private static float display_line_width = 1.0F; public static float DisplayLineWidth @@ -3067,6 +3068,11 @@ row = (byte *)bitmapData.Scan0; // draw new data + float min_waterfall_value = float.MaxValue; + float actual_waterfall_dynamic_low_threshold = waterfall_low_threshold; + if (waterfall_low_threshold == 0) + actual_waterfall_dynamic_low_threshold = waterfall_dynamic_low_threshold; + for(int i=0; i<W; i++) // for each pixel in the new line { int R, G, B; // variables to save Red, Green and Blue component values @@ -3105,8 +3111,10 @@ }*/ //waterfall_data[i] = (float)i/W*(waterfall_high_threshold - waterfall_low_threshold) + waterfall_low_threshold; + if (waterfall_data[i] < min_waterfall_value) + min_waterfall_value = waterfall_data[i]; - if(waterfall_data[i] <= waterfall_low_threshold) + if (waterfall_data[i] <= actual_waterfall_dynamic_low_threshold) { R = waterfall_low_color.R; G = waterfall_low_color.G; @@ -3120,8 +3128,8 @@ } else // value is between low and high { - float range = waterfall_high_threshold - waterfall_low_threshold; - float offset = waterfall_data[i] - waterfall_low_threshold; + float range = waterfall_high_threshold - actual_waterfall_dynamic_low_threshold; + float offset = waterfall_data[i] - actual_waterfall_dynamic_low_threshold; float overall_percent = offset / range; // value from 0.0 to 1.0 where 1.0 is high and 0.0 is low. if(overall_percent < (float)2/9) // background to blue @@ -3180,6 +3188,13 @@ row[i*pixel_size + 1] = (byte)G; row[i*pixel_size + 2] = (byte)R; } + + // tweak a dynamic low threshold to better meet band conditions + if (min_waterfall_value < waterfall_dynamic_low_threshold) + waterfall_dynamic_low_threshold -= 0.1f; + else + waterfall_dynamic_low_threshold += 0.1f; + if(rx == 1) waterfall_bmp.UnlockBits(bitmapData); else
Original issue reported on code.google.com by mccleme...@gmail.com on 21 Jul 2010 at 1:44
mccleme...@gmail.com
Original issue reported on code.google.com by
mccleme...@gmail.com
on 21 Jul 2010 at 1:44