Merge pull request #309 from luarvique/waterfall_colors

Now calculating waterfall colors based on what is on the screen (with…
This commit is contained in:
Jakob Ketterl 2022-07-31 22:08:01 +02:00 committed by GitHub
commit d5f7ce9508
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -943,9 +943,15 @@ var waterfall_measure_minmax_now = false;
var waterfall_measure_minmax_continuous = false; var waterfall_measure_minmax_continuous = false;
function waterfall_measure_minmax_do(what) { function waterfall_measure_minmax_do(what) {
// Get visible range
var range = get_visible_freq_range();
var start = center_freq - bandwidth / 2;
// this is based on an oversampling factor of about 1,25 // this is based on an oversampling factor of about 1,25
var ignored = .1 * what.length; range.start = Math.max(0.1, (range.start - start) / bandwidth);
var data = what.slice(ignored, -ignored); range.end = Math.min(0.9, (range.end - start) / bandwidth);
var data = what.slice(range.start * what.length, range.end * what.length);
return { return {
min: Math.min.apply(Math, data), min: Math.min.apply(Math, data),
max: Math.max.apply(Math, data) max: Math.max.apply(Math, data)