FlexAPI Object Properties

  • 1
  • Question
  • Updated 4 weeks ago
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.
Photo of Mark Erbaugh

Mark Erbaugh

  • 512 Posts
  • 43 Reply Likes

Posted 1 month ago

  • 1
Photo of James Whiteway

James Whiteway

  • 1050 Posts
  • 300 Reply Likes
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

Photo of Mark Erbaugh

Mark Erbaugh

  • 512 Posts
  • 43 Reply Likes
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.
Photo of James Whiteway

James Whiteway

  • 1050 Posts
  • 300 Reply Likes
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
Photo of Mark Erbaugh

Mark Erbaugh

  • 512 Posts
  • 43 Reply Likes
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.
Photo of James Whiteway

James Whiteway

  • 1050 Posts
  • 300 Reply Likes
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? :-)
Photo of Mark Erbaugh

Mark Erbaugh

  • 512 Posts
  • 43 Reply Likes
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.