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.

API return values and strange issue

Options
KD0RC
KD0RC Member, Super Elmer Moderator
I am building a "MiniMaestro" using an Arduino Due and the libraries by IW7DMH.  Most of what I have wired up and coded for is working fine, but I do not get slice volume back from the API.  I can easliy control the volume from an encoder, but I cannot see what it is set to initially.  Also, if I change the volume using the slider in SSDR, as soon as I turn the encoder knob, it picks up where it was instead of where I just set it in SSDR.  Other values come back to me like frequency, filter hi, filter low and AGC-T, so those functions are smoothly and can be set seamlessly by either the encoder or SSDR.  Does anyone have any insight into this? 

I also discovered what might be a small bug in the API. On 160 - 20 meters, I can set the step to 100, and it dutifully puts the frequency right on every time as I turn the encoder (I am not using the step size from SSDR, it is the local step size I set independently).  On 17 - 6 meters, however, sometimes it sets the frequency exactly as set (e.g. 18,150,000). Other times it adds one Hz (e.g. 18,150,101 when I sent 18,150,100).  There is a pattern that I have not fully studied yet, but it goes something like:
000
101
200
301
400
499
600

As you go up or down the band, the pattern repeats (0, +1, 0, +1, 0, -1, 0, 0, +1, etc).  It is not a debilitating thing, just kind of annoying to ask for an even 100 Hz step and get this oddball thing.

So has anyone used the IW7DMH Arduino Flex libraries?  Anyone seen and/or solved these little issues?
73,
Len, KD0RC

image

PS - This is a cardboard box used to prototype the layout.  All the knobs and their switches are operational at this point.  The tiny circles are indicator LEDs and the slightly larger circles are pushbutton switches.  I am already getting used to this thing, and really miss the functionality when I have it apart to solder in more rat's nest...

Answers

  • K5CG
    K5CG Member ✭✭
    edited June 2020
    Options
    Any chance you could  build an Arduino solution for the Behringer CMD Micro?
  • KD0RC
    KD0RC Member, Super Elmer Moderator
    edited June 2020
    Options
    Hi Danny, I have no idea what that is...
  • John G3WGV
    John G3WGV Member ✭✭
    edited June 2020
    Options
    I used Vincenzo's library a few years ago before I developed my own. I do not recall any problem with getting the initial audio level (it's part of the slice information sent when the slice is started) but I see he hasn't updated his library since 2017 and Flex version 2.0.19. If you are on a later version of the Flex protocol then you'll likely have to get into Vincenzo's code. The other problem suggests that Vincenzo's library is just not picking up the slice volume setting.

    The odd +1/-1 is probably rounding errors and I seem to recall coming across that myself. The solution was to change the floats in Vincenzo's code to double to improve the precision.

    You might find more information/inspiration in my Flex controller project Blog although the Mk 1 that used Vincenzo's code as its base was rather short-lived. Vincenzo used to be on this board a few years ago so he might pop up with more shortly.

    73, John, G3WGV

  • K5CG
    K5CG Member ✭✭
    edited June 2020
    Options
    @KD0RC There are lots of threads about it here on this community.

    For example (with pictures)
    https://community.flexradio.com/flexradio/topics/manual-instructions-for-the-behringer-cmd-micro

    But really, any MIDI DJ controller would be fantastic and it might simplify your hardware development with lots of knobs and LEDs to take advantage of.

  • K5CG
    K5CG Member ✭✭
    edited June 2020
    Options
    And Carl, before you jump in here and tell us Pegasus Plus does this, no it doesn't. Not the way I want it to. It's inflexible. Sorry, walk away from the keyboard.
  • KD0RC
    KD0RC Member, Super Elmer Moderator
    edited June 2020
    Options
    Thanks John, I will take a look at your blog.  I have the libraries working on V3.1.12, and all I did was change the buffer size from 350 bytes to 600.  I have seen the code that specified float, so I will go dig that up again and try double. A friend of mine is on the latest V2 software, so I am going to try this thing on his 6400 to see if it behaves the same as my V3 6400.  I haven't yet figured out if I am doing something wrong with the audio gain parameter of if there is a prob in the library, perhaps to do with V2 vs V3.  In any event, this has been a fun project, and I am looking forward to getting it finished and into a permanent box.  Thanks again for the response!

    Len
  • KD0RC
    KD0RC Member, Super Elmer Moderator
    edited June 2020
    Options
    John - you are genius!  The double worked to get rid of the odd rounding at higher frequencies.  Now I just need to do a little digging through to find out why some functions can be set but not read.
    Len
  • KD0RC
    KD0RC Member, Super Elmer Moderator
    edited June 2020
    Options
    So, are those virtual knobs on a screen or physical knobs in a box?
  • John G3WGV
    John G3WGV Member ✭✭
    edited June 2020
    Options
    Glad that bit worked. Some thoughts on the audio level stuff:

    When you open a slice, a ton of information about that slice is sent, including the audio level at that time. In general, if you subsequently change a parameter then that change is sent out to all clients except the one that originated the change. The logic is that the originating client knows it made the change so there is no need to tell it again.

    However... earlier versions of the FlexRadio API didn't strictly keep to this general rule. So some but not all updates would in fact be sent back to the originating client. Over time, the Flex code writers have been fixing these logical errors as they find them.

    Now, if Enzo's code assumes that an audio change is going to be sent back to his code but in fact it is not then you will get the exact problem that you are reporting.

    I remember that I tripped over this problem with slice mute, which was but now is no longer sent back to the originating client. It would be no surprise at all to find that the same thing happened along the line to audio level changes.

    Something to look into!

    73, John
  • KD0RC
    KD0RC Member, Super Elmer Moderator
    edited June 2020
    Options
    That may well be the issue. Mute does, in fact, behave the same way as audio gain.  Both initially report back from the radio as zero, so I set them to Slice A unmute, vol 30 and Slice B mute, vol 30.  That way I get a predictable starting point for both slices.  I will poke around in the libraries to see if I can figure out how to get the audio gain and mute to read without first setting them.
    73,
    Len
  • KD0RC
    KD0RC Member, Super Elmer Moderator
    edited June 2020
    Options
    I see that you use a 1 - 16 multiplexer for your switches.  I probably should have done that.  Instead, I use 10 Arduino pins arranged (logically, not physically) as 5 rows and 5 columns to get up to 25 buttons.  The 5 rows are interrupt driven, then I scan to see which column is selected.  Software works great, but the wiring is a real mess!  I made a mistake in assigning the pins sequentially as R0, C0, R1, C1... instead of R0, R1, R2...  C0, C1, C2...  Counting rows and columns amid the rat's nest of wiring is much harder this way.  If I buils a V2 of this thing, I think I will try the Teensy 4.1 (PJRC.com) with the built in ethernet.  I will definitely take your lead and use a multiplexer for the switches.  You can probably tell by now that I am a ham, not an engineer.  : )
    73,
    Len
  • John G3WGV
    John G3WGV Member ✭✭
    edited June 2020
    Options
    Just to be clear, the issue is not that Enzo's software doesn't read these messages. The problem is that the messages are no longer sent from the radio to the initiating client. So instead of the client relying on the radio to set the new value for that control at the client, the client has to do it for itself. Because that is not happening, each time you come to update it (e.g. you turned the audio up) you are starting from the slice startup value rather than the value from last change you made to the control.

    It can be a bit of a challenge to get your head round what is going on here!
  • John G3WGV
    John G3WGV Member ✭✭
    edited June 2020
    Options
    On multiplexers: I originally planned to do what you have done but quickly concluded that multiplexers was the way to go. I actually use two, so that gives me 32 switches from a total of six pins (four address, two mux chip select). It works perfectly and is much simpler to wire (and to code).
  • KD0RC
    KD0RC Member, Super Elmer Moderator
    edited June 2020
    Options
    I get an audio_gain_event fire if I set the gain with the encoder(so that is good!), but not if I change the gain via SSDR (i.e. what you are saying is true - the API does not send a new value).  So how do I initiate a read of the audio_gain?  I am trying to get the event to fire without setting a new value.

    Yes, quite challenging!!
  • John G3WGV
    John G3WGV Member ✭✭
    edited June 2020
    Options
    I'm rusty on how Enzo's events work but I think the audio_gain_event is when you change something. When another client (SSDR is a client) changes the audio then you should get a message from the radio that Enzo's code hooks. I think that is a separate event type.

    I just checked my V2 6500 and when SSDR changes the audio level I get this message

    SBFA89FDE|slice 0 audio_gain=5 audio_pan=50 audio_mute=0

    I then checked my 6600 which is on V3 and the same action got:

    S827582EC|slice 0 audio_level=10 audio_pan=50 audio_mute=0

    So there is a clear problem problem here. V3 sends a different message for the audio gain setting. You'll have to hack Enzo's code I'm afraid!

    However this isn't the original problem. The original problem is that V2 does send back an audio change initiated by your client. V3 does not. This is what I get (> to radio < from radio):

    V2
    > C15|audio client 0 slice 0 gain 4
    < S754F8EAA|slice 0 audio_gain=4 audio_pan=50 audio_mute=0
    < R15|0|     

    V3
    > C56|slice set 0 audio_level=12
    < R56|0|         

    You'll see that the outgoing command is also different for V3, although I think Flex supports the old V2 command albeit deprecated. I suspect you are going to find quite a few differences like this. I fear you will find that you have to make lots of changes to Enzo's code!

    73, John
  • KD0RC
    KD0RC Member, Super Elmer Moderator
    edited June 2020
    Options
    Thanks John, I really appreciate the help!  I have not really needed to change much so far, but I think this one will require some thought. I will poke around and see what I can come up with.
    73 and thanks again,
    Len
  • KD0RC
    KD0RC Member, Super Elmer Moderator
    edited June 2020
    Options
    Brilliant John!!  That was it.  I changed the command to "audio_level", and it works perfectly!  Hopefully, my understanding is getting better and I won't have to come back for more help.  Now I can get back to wiring up the rest of the switches and lights and finishing up the code.  Next challenge will be to find a suitable enclosure instead of the cardboard box.

    73,
    Len
  • John G3WGV
    John G3WGV Member ✭✭
    edited June 2020
    Options
    Happy to be able to help. I had great fun building my controller and I'm still making improvements to it, three years later! I hope you get the same satisfaction out of the project and then being able to use your own controller in the pileups.

    73, John

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.