Welcome to the new FlexRadio Community! Please review the new Community Rules and other important new Community information on the Message Board.
If you are having a problem, please refer to the product documentation or check the Help Center for known solutions.
Need technical support from FlexRadio? It's as simple as Creating a HelpDesk ticket.

FlexAPI Object Properties

Mark Erbaugh
Mark Erbaugh Member ✭✭
edited February 2020 in SmartSDR API
There must be something I don't understand about the properties of some FlexAPI C# objects. 

In response to a PanadapterAdded message, my program creates a display form. It sets panadapter.CenterFreq and waterfall.CenterFreq to 3.919 (hard-coded for now). In my waterfall.OnDataReady event, I query the panadapter.CenterFreq and waterfall.CenterFreq properties and they are changed.  They are 14.1. Also, the Waterfall tile.FrameLowFreq shows around 13. 


Interestingly, when I plot the panadapter, it seems to be at 3.919.

Answers

  • James Whiteway
    edited August 2019
    Reread the explanation that I posted the link to. The Waterfall Tile data covers a wider frequency range than the panadapter data does. I believe part of the reason for that is to allow smoother side scrolling without the smearing effect that was in PowerSDR when the panadapter was scrolled back and forth.
    One of the problems I encountered trying to get the waterfall to work correctly, (I never truly did) was lining up the frequencies of both the panadapter and the waterfall so that the waterfall displayed the correct signal data for a given frequency that was in the panadapter display. I was just happy to get it to work at all. But, for now, my code is broken. One of these days I'll get back to it and fix the issue.
    James
    WD5GWY

  • Mark Erbaugh
    Mark Erbaugh Member ✭✭
    edited February 2020
    James,

    Thanks for the reply. I do understand why the waterfall data covers a wider frequency.

    I was able to get the waterfall and panadapter and waterfall to line up, but I had to hard code the panadapter CenterFreq and Bandwidth instead of retrieving it from the panadapter object.

    Here's how I lined them up.  In the waterfall OnDataReady handler, I calculate the MHz / pixel on the panadapter display by dividing the Panadapter.Bandwidth by the Panadapter.Width.  Then I set currentFreq to the minimum panadapter frequency by subtracting half the Panadapter.Bandwidth from the Panadapter.CenterFreq. Ideally, I would get this data from the Panadapter properties, but to get things working, I had to use hard-coded values. I loop through all the pixels in the panadapter, incrementing currentFreq by the bin width.

    In the loop, I calculate the index of appropriate data element in the WaterfallTile data array.

    int binIndex = (int)((currentFreq - tile.FrameLowFreq) / tile.BinBandwidth))


    I could improve this by interpolating with adjacent bins, but the waterfall track the panadapter pretty well.

    One issue I found in addition to the properties is that at the beginning, I usually get a WaterfallTile (maybe more than one) for a frequency other than what I set. I'm thinking that this data comes from the radio before it has processed the frequency request. I put a binIndex sanity check to make sure that it is within the range of possible values in tile.data.
  • James Whiteway
    edited August 2019
    I'm jealous! I had a hard time getting any of it to be even close to the correct signal. The spectrum display ( panadapter) was a piece of cake compared to the waterfall. Another issue I have, in my code I use Color.From.ARGB to get the correct color and intensity of the signal. That turns out to be processor intensive and can bog down the CPU. Eric told me they use a lookup table for the waterfall colors in SSDR. That seems to be a better solution. But, I never got around to trying to build one. From all your posts it appears you're making great progress. Makes me want to get back at it. James WD5GWY
  • Mark Erbaugh
    Mark Erbaugh Member ✭✭
    edited February 2020
    James,

    I'm also using Color.FromARGB in my code and it didn't seem to bog things down. I'm running on a 10 year old quad core AMD Phenom processor at 2 GHz. Here's a picture of my Panafall. A lot of stuff was hard coded but it still looked pretty good to me.
  • James Whiteway
    edited August 2019
    It's pretty likely that the slowdown is elsewhere in my code. You're really doing good.
    When can we expect the Erbaugh app to show up? :-)

  • Mark Erbaugh
    Mark Erbaugh Member ✭✭
    edited February 2020
    Now I'm stuck with Waterfall.FallColorGain and Waterfall.FallBlackLevel. I adjust them each from 0 - 100 (the published range) and it seems to make no different to my waterfall display. I also turn AutoBlackLevelEnable on and off with no effect.


    I'm guessing I don't understand how to use these settings.

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.