PhantomSDR Support Forum

General Category => PhantomSDR Bugs => Topic started by: Bas ON5HB on Sep 08, 2024, 11:14 AM

Title: Auto-adjust fails to switch back.
Post by: Bas ON5HB on Sep 08, 2024, 11:14 AM
Auto-Adjust works perfectly, however when turn it off it doesn't switch back.
It stays at the level-auto-adjust has set.

Version 1.5.4
Title: Re: Auto-adjust fails to switch back.
Post by: linkz on Sep 08, 2024, 03:49 PM
Yes, noticed that bug too
Title: Re: Auto-adjust fails to switch back.
Post by: Emmanuel SV1BTL on Dec 22, 2024, 11:12 AM
After many tries, SV2AMK and I have modified the autoAdjust code as following. Activating Auto Adjust returns a darker waterfall in all cases, and de-activating it, returns to the previous settings, without to mess the custom "min_waterfall" and "max_waterfall" which were stored in band buttons.
I don't know why it works, but it does work. Please someone let keep a look, to find a much better (and reasonable) solution.

function handleAutoAdjust(value) {
    autoAdjust = value;
    waterfall.autoAdjust = autoAdjust;
      waterfall.setMinOffset(-30);
      waterfall.setMaxOffset(110);
  }
Title: Re: Auto-adjust fails to switch back.
Post by: Phil - NY4Q on Dec 22, 2024, 03:01 PM
This mod will store & restore the previous setting if you want to do that.

Add :

  let previous_min_waterfall;
  let previous_max_waterfall;
  let previous_brightness;
  let storeWaterfallSettings = false;

Modify handleAutoAdjust(value)

  function handleAutoAdjust(value) {
    autoAdjust = value;
    waterfall.autoAdjust = autoAdjust;

    if(autoAdjust && !storeWaterfallSettings) {
      previous_min_waterfall = min_waterfall;
      previous_max_waterfall = max_waterfall;
      previous_brightness = brightness;
      storeWaterfallSettings = true;
    }
    if(!autoAdjust && storeWaterfallSettings) {
     min_waterfall = previous_min_waterfall;
     max_waterfall = previous_max_waterfall;
     brightness = previous_brightness;
     storeWaterfallSettings = false;
     handleMinMove();
     handleMaxMove();
     handleBrightnessMove();
   }
}

Title: Re: Auto-adjust fails to switch back.
Post by: Bas ON5HB on Dec 22, 2024, 04:02 PM
Guy's,

I love all the work you do, but please upload the modified files as well.
And please add comments in the files, so people see what and where you have done stuff.

As with all the modifications, it's becomming a mess ;D

Not that this is a bad thing, but we may want to decide what version is the 'latest community' version and upload that to the forum...for all to download.

When sections are documented, people know what to alter.

Best would be if we have a few config/json files that allow easy adapt to local settings.

We do everything in the code now....should be taken out. Like band-buttons/sections like 40/80/160m etc/personal text.

OR put them all in a variable at the beginging of the Svelte, all variables in there.

I'm not a good enough programmer in this language, but who can do this? Move all stuff to the top instead of spread all over the code(s).
Title: Re: Auto-adjust fails to switch back.
Post by: Phil - NY4Q on Dec 22, 2024, 04:19 PM
I am with you Bas. I can read what people want and modify as needed, but to properly build the structure as you are talking about is something that I have not done in a looooong time and I am not that familiar with this language as I would like to be.

That being said, I will post another message and place all my modded files there, but I will also look at creating a variables of json file that will populate the introduction / buttons / etc and trying to move toward better programming.

I will also add the comments needed to the functions that I have modified.

Phil
Title: Re: Auto-adjust fails to switch back.
Post by: Emmanuel SV1BTL on Dec 22, 2024, 04:47 PM
Thank you very much Phill for your precious efforts, but in my case this does not work as I would like. Let me explain:
Let us say that 20m band is "brighter" than 40m. band and I have "min_waterfall" and "max_waterfall" set up -40 & 90, stored in "20m.band" button. I activate and de-activate Auto Adjust and it works.
Then, I jump to 40m band with the button, where are stored "min_waterfall" and "max_waterfall" as -20 and 100, much "darker" than 20m. band. I found then that brightness is as on 20m. band, although "min_waterfall" and "max_waterfall" sliders are shown as I have set them up for 40m. band.
So, maybe "previous_min_waterfall" and "previous_max_waterfall" have to be defined in another way, to pickup values are stored on band buttons?

P.S. Sorry for my terrible english...
Title: Re: Auto-adjust fails to switch back.
Post by: Phil - NY4Q on Dec 22, 2024, 05:01 PM
Ah ok,

What you need to do Emmanuel is go through each band and write down the settings you desire, then use the setBand function to set the min and max values. The brightness and darkness gradient you are seeing is the difference in sensitivity of your antenna/receiver for that particular band.


You can modify the case: section inside setBand and then add a min_waterfall and max_waterfall setting there inside that case.

Phil

For Example :
case 80:
       l -= 34650;
       r += 34650;
// Add this section for each band Emmanuel to set your waterfall.
       max_waterfall = 120;
       min_waterfall = -40;
       handleMaxMove();
       handleMinMove();
// End of addition
       break;
Title: Re: Auto-adjust fails to switch back.
Post by: Emmanuel SV1BTL on Dec 22, 2024, 05:13 PM
Quote from: Phil - NY4Q on Dec 22, 2024, 05:01 PMAh ok,

What you need to do Emmanuel is go through each band and write down the settings you desire, then use the setBand function to set the min and max values. The brightness and darkness gradient you are seeing is the difference in sensitivity of your antenna/receiver for that particular band.


You can modify the case: section inside setBand and then add a min_waterfall and max_waterfall setting there inside that case.

Phil

For Example :
case 80:
       l -= 34650;
       r += 34650;
// Add this section for each band Emmanuel to set your waterfall.
       max_waterfall = 120;
       min_waterfall = -40;
       handleMaxMove();
       handleMinMove();
// End of addition
       break;

Well, this is my settings, and I am going to add missing handleMaxMove(); and  handleMinMove();

case 160:
       l -= 15000;
       r += 15000;       
       min_waterfall= -20;
       max_waterfall= 110;;
       break;
Title: Re: Auto-adjust fails to switch back.
Post by: Emmanuel SV1BTL on Dec 22, 2024, 05:20 PM
SUCCESS!!!
My congratulation Phill!
 :)  :)  :)
Title: Re: Auto-adjust fails to switch back.
Post by: 9a7aof on Dec 26, 2024, 04:51 PM
Thanks Phil,

it works well for me too.
Auto Adjust On/Off and Stored Frequencies, everything is fine.

73!

Darko, 9a7aof