Welcome to the new FlexRadio Community! Please review the new Community Rules and other important new Community information on the Message Board.
Need the latest SmartSDR, Power Genius, Tuner Genius and Antenna Genius Software?
SmartSDR v3.8.20 and the SmartSDR v3.8.20 Release Notes
SmartSDR v2.12.1 and the SmartSDR v2.12.1 Release Notes
Power Genius XL Utility v3.8.9 and the Power Genius XL Release Notes v3.8.9
Tuner Genius XL Utility v1.2.11 and the Tuner Genius XL Release Notes v1.2.11
Antenna Genius Utility v4.1.8
SmartSDR v3.8.20 and the SmartSDR v3.8.20 Release Notes
SmartSDR v2.12.1 and the SmartSDR v2.12.1 Release Notes
Power Genius XL Utility v3.8.9 and the Power Genius XL Release Notes v3.8.9
Tuner Genius XL Utility v1.2.11 and the Tuner Genius XL Release Notes v1.2.11
Antenna Genius Utility v4.1.8
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.
Need technical support from FlexRadio? It's as simple as Creating a HelpDesk ticket.
Reading S Meter with FlexLib API
Mark Erbaugh
Member ✭✭
I'm having trouble getting a reliable SMeterDataReady callback in FlexLib API on a Slice receiver on my 6300. I have a callback routine. It will be called reliably for several hundred times, then will pause for several tens of seconds. Some times when I start my program from scratch, the callback doesn't seem to be called at all. I restart the program and it may work again, although it will pause.
I have successfully written callback routines to handle other callbacks from FlexLib API, is there something different with callbacks for S Meter?
I have successfully written callback routines to handle other callbacks from FlexLib API, is there something different with callbacks for S Meter?
1
Answers
-
I've revised the synchronization between the callback and the main program loop and the delays are gone, but it doesn't look like my external S Meter agrees with the S Meter on SSDR. I still have some work to do.0
-
I haven't observed the behaviors you're seeing... if that's any help.
Soooo, based the change in behavior resulting from your changes in serialization, I'd suspect a local bug not a FlexLib one at this point, at least.
0 -
Could you outline the steps you use to set things up? It might point out what I'm doing wrong.0
-
I'm happy to. But if you're getting ANY events, you must be doing it right.
When the slice is added, I add then event processing routine:
_theSlice.SMeterDataReady += OnSMeterDataReady;
And in the callback:
private void OnSMeterDataReady(float data) {
data = (float)Math.Round(data);
...
int valToDisplay = (int)data;
SMeterTextBox.Text = valToDisplay.ToString(CultureInfo.InvariantCulture);
}
I'm currently not concerned about serializing access to the main form, so I just slam the data from the callback, because I'm using the FlexAPI for fun not for work. But this is not an acceptable strategy for production code.
If I were doing this for real, I do the usual checking "<control-name>.InvokeRequired" blah blah blah. You probably know this, but for the archives: You can NOT do your own serialization or locking to protect from this cross-thread update. They way I understand it, that'll fix your code's synchronization issue, but won't address issues the CLR might have.
Hope that helps,
Peter
K1PGV1 -
I'm doing this with Python and not doing anything special re serialization as far as CLR is concerned. Python has a thread safe Queue that I use to pass data among threads, but I hadn't considered issue with the CLR0
-
Peter, I just wanted to say thank you for posting the code sample above. (and all the others that you have go generously shared) My little testbed program (appropriately
named K1PGV's Test program since a lot of it has come from you) now has a working S Meter Display! And amazingly enough, I have not yet started using v1.4 of the Flexlib and still, (so far) everything I have been working on still works!
It seems since I started working harder on using Threading that things are starting to click. So, code snippets like yours really help.
james
WD5GWY
Oh, and this is with v1.4 of SmartSDR running. Just not using v1.4 of Flexlib yet.0 -
My pleasure, James. I honored by your naming your test app after me. Feel free to request examples of various things.0
-
After further testing, I believe my S-Meter readings agree with those in SSDR0
-
Bravo! It's really pretty simple once you get the hang of it, isn't it!
de K1PGV
0 -
One more time.... Found something new today. Started a new project, (using C# VS 2012), add 'csproj's' Vita,Util, UiWpfFramework & FlexLib. It does NOT compile. Now, if I remove Vita & FlexLib the project compiles!! Anyone with a clue, pse? Using K1PGV's example.
Vern0 -
Vern, there is a particular order in which the individual projects need to be compiled. Some of the Flexlib projects depend on the other projects being compiled first. I'm on the road (again) or I would look up what the order is for you. Mark, posted a video that gives another way to compile all the projects together. But, even then, you'll see some error messages until all are compiled correctly. It is a hassle doing it this way. What I do most of the time when a new version of SSDR comes out is, after installing SSDR. , I make a folder on my C: drive with a name like SSDR dlls v1.6.17, and then I go to PROGRAM FILES on my C: drive and find where Windows installed the latest version of SSDR. I then COPY all of the dll's you mentioned, and paste them into the new folder I made for them earlier. Then, I load my test project and unreference the old dll files I had been using and once that is done, I add a Reference to each New dll file in the new folder I created earlier. Then, in the BUILD MENU, I select REBUILD PROJECT. It should build with no errors. Also be sure to put a copy of inoic.zip.dll in the new folder as well and reference it before Rebuilding your project. Hope this helps. James WD5GWY0
Leave a Comment
Categories
- All Categories
- 260 Community Topics
- 2.1K New Ideas
- 538 The Flea Market
- 7.6K Software
- 6K SmartSDR for Windows
- 139 SmartSDR for Maestro and M models
- 368 SmartSDR for Mac
- 242 SmartSDR for iOS
- 226 SmartSDR CAT
- 175 DAX
- 345 SmartSDR API
- 8.8K Radios and Accessories
- 7K FLEX-6000 Signature Series
- 45 FLEX-8000 Signature Series
- 859 Maestro
- 45 FlexControl
- 849 FLEX Series (Legacy) Radios
- 807 Genius Products
- 424 Power Genius XL Amplifier
- 280 Tuner Genius XL
- 87 Antenna Genius
- 227 Shack Infrastructure
- 153 Networking
- 410 Remote Operation (SmartLink)
- 130 Contesting
- 642 Peripherals & Station Integration
- 116 Amateur Radio Interests
- 878 Third-Party Software