Hercules MIDI with 6300

  • 11
  • Idea
  • Updated 5 years ago
All,

I wrote a program in "processing" that allows me to control my 6300 over CAT with the Hercules DJ Instinct.

Currently working;
VFOA Freq w/variable speed
VFOB Freq w/variable speed
XIT offset
RIT offset
PTT

Planned;
ACGT
Main Volume
vfoA volume
vfoB volume
Step size
mode
bandwidth
etc.

I am somewhat limited with CAT.  DDUTIL adds in additional CAT commands (DD6) that will do most of what else I want.  However I cant seem to get the DDUTIL commands to work.  So if anyone has experience using DDUTIL commands.  Please help me out!

Anyway here is a short video, sorry about the shaking! :)

https://www.youtube.com/watch?feature=player_detailpage&v=oidCZVeAKbo&list=UUXPBbnOEFQ_MN6UM...

W4WHL
Photo of William Hemmingsen

William Hemmingsen

  • 573 Posts
  • 278 Reply Likes

Posted 5 years ago

  • 11
Photo of Jay -- N0FB

Jay -- N0FB, Elmer

  • 539 Posts
  • 213 Reply Likes
William, have you thought about using the Flex API for sending commands to the Flex instead of using CAT.  You will find that your programmatic control will be more robust.
Photo of William Hemmingsen

William Hemmingsen

  • 573 Posts
  • 278 Reply Likes
I have, but I know zero about .net.  The learning curve will be high.
Photo of Al K0VM

Al K0VM, Elmer

  • 615 Posts
  • 103 Reply Likes
William,
  I think K5FR would tell you that some of what DDUtil does with the DD6 commands are through the API and not through CAT....  I would not expect any DD6 commands to work in CAT although they might mimic CAT functionallity.

AL, K0VM
Photo of William Hemmingsen

William Hemmingsen

  • 573 Posts
  • 278 Reply Likes
My understanding was DDUTI intercepted theses DD6 commands and used FlexAPI to control the radio.  But I thought it received these commands via serial.  But I really am not sure, since it doesn't work.
Photo of William Hemmingsen

William Hemmingsen

  • 573 Posts
  • 278 Reply Likes
Ok I tore apart the API and I don't need it.  I figured out how to send commands to the radio directly from processing.  I just used the code in the API to figure out what I needed to send.

I added the code to adjust slice and main volume, and its working great.  Now I just have to rewrite the rest of the code to use TCPIP instead of CAT.

You can send the commands easily.  My only hiccup was I forgot to send the terminator.

W4WHL
Photo of Jay -- N0FB

Jay -- N0FB, Elmer

  • 539 Posts
  • 213 Reply Likes
See William!  Using the API was not a bad thought after all!  :-)
Photo of William Hemmingsen

William Hemmingsen

  • 573 Posts
  • 278 Reply Likes
In the TCPIP API, how do you call just slice frequency?  I know you can call "sub slice 0" but it returns a mass of info.  Any way to just get frequency?
Photo of William Hemmingsen

William Hemmingsen

  • 573 Posts
  • 278 Reply Likes
Ok I have completely converted my program to use TCPIP.  Its working great. 

W4WHL
Photo of Mark Erbaugh

Mark Erbaugh

  • 520 Posts
  • 46 Reply Likes
I'd be interested in seeing what your program does. I've spent a lot of time messing with FlexLib API, but can see some advantage to using TCI/IP directly.  Are you also processing some of the UDP data streams?
Photo of William Hemmingsen

William Hemmingsen

  • 573 Posts
  • 278 Reply Likes
No I'm using tcp only.  I do not process any streams.  The only query I get from the radio is slice frequencies, all else is just writes to the radio.

Here is how its setup now.  Its very basic. 

Photo of William Hemmingsen

William Hemmingsen

  • 573 Posts
  • 278 Reply Likes
I plan to add more functions, but for now this is all it controls.  I could not figure out how to discover the radio, so when I load the program it just ask for the IP address.  But all functions noted above work great.
Photo of Ken - NM9P

Ken - NM9P

  • 4239 Posts
  • 1351 Reply Likes
Very nice beginning!  I have been dreaming that someone would do this.
If I may be so bold...I would suggest these possible added functions.

1) Next to RIT/XIT knobs, use the buttons underneath for RIT/XIT ON/OFF and CLR
2) Add Slice B AGC-t to the right of the Slice A AGC-t
3) Use the horizontal slider for panadapter zoom width
4) Use the 1-4 cue buttons to send CWX memories.
5) Use another button under the main tuning dials to select which slice is TX,
6) Use another one to swap A/B

Ultimately, you could make a set-up screen and allow users to define each button themselves by linking to a list of commands available for each button/knob/control.

Would this program be compatible with other models of the Hercules?  I have a Hercules DJ LE controller that I got for about $69 about two years ago and I love it.
I would love to get it going on my 6500.

Good work!

Ken - NM9P
Photo of William Hemmingsen

William Hemmingsen

  • 573 Posts
  • 278 Reply Likes
Very good suggestions.  Any MIDI device would work, you would just have to modify a few parameters.  As far as allowing user setup.  That may be a bit hard with my limited time and knowledge.  But I will add most of what you suggested, they wil be fairly easy.

W4WHL
Photo of William Hemmingsen

William Hemmingsen

  • 573 Posts
  • 278 Reply Likes
Here is the current state.  I can not figure out how to change waterfall bandwidth, But its the least important to me.

Photo of Ken - NM9P

Ken - NM9P

  • 4239 Posts
  • 1351 Reply Likes
Looks nice.  Perhaps you can find the commands that mimic the +/- buttons on the panadapter zoom and use the << and >> buttons above the main tuning knob, instead of using the slider.  That may actually be more handy.  I hope you can find them.

Additional command possibilities:

The knob to the right of the "Main Volume," or the bottom horizontal slider could become the  "Power Output"  control.  

The Knob below AGC-T B could be "keyer speed."

The Numbered keys above Main Tuning Knob B could be used to turn on/off things like NB, NR, ANF, APF.

And you still have many more buttons and knobs to define!  

(This is fun, designing someone else's radio!... ha!)
Photo of William Hemmingsen

William Hemmingsen

  • 573 Posts
  • 278 Reply Likes
I found the commands, but they don't work.  Maybe the radio only accepts modifying the streams from the client that created them.  Maybe someone else knows.

W4WHL
Photo of William Hemmingsen

William Hemmingsen

  • 573 Posts
  • 278 Reply Likes
Here is a new video of it working.  The hiccups are my my netbook cpu maxing out.

https://www.youtube.com/watch?feature=player_detailpage&list=UUXPBbnOEFQ_MN6UMKzZfPpQ&v=1-uX...
Photo of David

David

  • 329 Posts
  • 55 Reply Likes
This looks like a great way to add the knobs and buttons to SDR. Does the MIDI have the same issue as the ShuttlePRO of following the focus of the mouse or does it stay locked to the SDR program like the Flex Control would. So that if you change focus to a browser to look up a call would using the MIDI to tune or adjust volume etc. work or would it be making possible changes to the active browser window like the ShuttlePRO would?

If you get a chance to do another video if you could use landscape it would improve the presentation.
Photo of William Hemmingsen

William Hemmingsen

  • 573 Posts
  • 278 Reply Likes
David,

The midi does not change focus at all.  It is totally independent of mouse.  You can tune 2 slices and type in logs at the same time if you have enough hands :)

William
Photo of KT0NY

KT0NY

  • 4 Posts
  • 0 Reply Likes
Great work, William. For cw split operation, it's helpful to be able to turn off/on the audio in the ear that's listening to the pileup. Sometimes when the dx is weak you can't hear him unless you have him in both ears. I had my Herc setup with the old-version Flex with the split audio on/off on the right-hand button where you have ptt. Anyway, this is terrific -- you da man!

73, Tony KT0NY
Photo of Ken - NM9P

Ken - NM9P

  • 4239 Posts
  • 1351 Reply Likes
I always have the DX in both ears and the "Mob" in the right ear, but it sure would be nice to be able to quickly turn the mob down some more when needed!
Photo of William Hemmingsen

William Hemmingsen

  • 573 Posts
  • 278 Reply Likes
I do not work CW, but I'm sure that can be added.  I'm open to pass my code to anyone who wants to mod it for their own purpose.  Its my first programing attempt in 25 years, so I'm sure its clunky.  However it works for my needs.  It was written in Processing, which is very similar to Arduino sketches.  I then compiled it into a java embedded executable.

W4WHL
Photo of Ken - NM9P

Ken - NM9P

  • 4239 Posts
  • 1351 Reply Likes
William, I would love to play with it for a while if I can get it to run on my machine with my controller.  But I am not very familiar with Processing or Java.  I know what they are, but have never done any programming in them.

Ken - NM9P
Photo of William Hemmingsen

William Hemmingsen

  • 573 Posts
  • 278 Reply Likes
I didn't either till 5 days ago, so if I can figure it out, it should be easy enough to modify.

https://www.dropbox.com/s/mu0rf5f52udnvic/flex.zip?dl=0
Photo of William Hemmingsen

William Hemmingsen

  • 573 Posts
  • 278 Reply Likes
download Processing and get the midibus library.  The library contains a basic example sketch that will allow you to discover the channel,note,controller, etc. from your device.  In the download source is my pde file.  This is the sketch to load into processing.  just make sure you install the midibus library first.

I'll be happy to answer any questions you have. 
Photo of Jeffrey Kerber, N3VE

Jeffrey Kerber, N3VE

  • 131 Posts
  • 20 Reply Likes
William, I am interested in you work.  I am not a programmer and would consider purchasing a controller if you would share your software.  Where can I find it?
Jeff
Photo of William Hemmingsen

William Hemmingsen

  • 573 Posts
  • 278 Reply Likes
its linked to dropbox above
Photo of Jeffrey Kerber, N3VE

Jeffrey Kerber, N3VE

  • 131 Posts
  • 20 Reply Likes
I just checked that out after my post, thanks.  I looked on eBay and the controller is selling for about $140 US
Photo of William Hemmingsen

William Hemmingsen

  • 573 Posts
  • 278 Reply Likes
its 125 on amazon I think
Photo of Ken - NM9P

Ken - NM9P

  • 4239 Posts
  • 1351 Reply Likes
Thanks, William. Today is my day off, so I may play a little today.
Photo of William Hemmingsen

William Hemmingsen

  • 573 Posts
  • 278 Reply Likes
i'll be here if you have any question
Photo of William Hemmingsen

William Hemmingsen

  • 573 Posts
  • 278 Reply Likes
If you have specific questions email my QRZ email.  I check it constantly.

W4WHL
Photo of William Hemmingsen

William Hemmingsen

  • 573 Posts
  • 278 Reply Likes
Ken, the only file you need in that download is a file called FlexMidiTCP.pde.  Just edit that file in Processing.  You need to update this line in that file:


myBus = new MidiBus(this, "Hercules DJControl Instinct", "Hercules DJControl Instinct");

To get the correct name of your device, create a new sketch with just this:

import themidibus.*;

MidiBus myBus;

void setup() {
  size(400, 400);
  background(0);

  MidiBus.list()

A list of all available MIDI devices will be printed.

After editing that line, try running the program from processing.  Check if everything works.  If not there is an example under the midibus library called basic.  edit the same line:
myBus = new MidiBus(this, "Hercules DJControl Instinct", "Hercules DJControl Instinct");

Run this program a then just start turning knobs and hitting buttons.  Write down each channel,note, value etc.  Then just update my PDE with your values.  The commands in the sketch are pretty self explanatory, so you should have no trouble figuring out what goes where.

After that adding new functions get a bit harder.  You have to dig into the API to find them.  I will help where I can.

W4WHL
Photo of William Hemmingsen

William Hemmingsen

  • 573 Posts
  • 278 Reply Likes
My guess is the mappings are the same or very similar, I doubt you will have to change much. to get basic functionality.  And once you get everything working to your liking, just export it to an aplication.
Photo of Jeffrey Kerber, N3VE

Jeffrey Kerber, N3VE

  • 131 Posts
  • 20 Reply Likes
William, looks like they took your drop box link and my last question off the thread.
Please send me the link to N3VE at arrl dot net  thanks, Jeff
Photo of Jeffrey Kerber, N3VE

Jeffrey Kerber, N3VE

  • 131 Posts
  • 20 Reply Likes

I switched browsers and it is there, please disregard last post

Jeff

Photo of Ken - NM9P

Ken - NM9P

  • 4239 Posts
  • 1351 Reply Likes
Hi William.
I have downloaded Processing and made a sketch with your little routine to discover the midi name of my controller.
It stops with an error message 
"unexpected token:null"

what's going wrong?
Photo of William Hemmingsen

William Hemmingsen

  • 573 Posts
  • 278 Reply Likes
import themidibus.*;

MidiBus myBus;

void setup() {
  size(400, 400);
  background(0);

  MidiBus.list();

}


Sorry This works
Photo of Ken - NM9P

Ken - NM9P

  • 4239 Posts
  • 1351 Reply Likes
Thanks.  Now it says:  

"the package "themidibus" does not exist.  You might be missing a library.
no library found for themidibus
Libraries must be installed in a folder named 'libraries' inside the 'sketchbook' folder."

I copied the 'lib' folder from the zipped file you sent me and put it into the folder that "Processing" set up for the new sketch I entered.  Then I named it "Libraries" and it still gave me this error.

I'm learning, but have a long way to go.  But I learn fast with the proper information.  I will also look for a tutorial/guide online.

BTW, I didn't find your email on QRZ.com

Thanks for your patient help....
Photo of William Hemmingsen

William Hemmingsen

  • 573 Posts
  • 278 Reply Likes
in processing, you need to Sketch>Import>Add Library

Then search midibus and install

William
Photo of William Hemmingsen

William Hemmingsen

  • 573 Posts
  • 278 Reply Likes
If you have google chat ping me at lee.hemmingsen@gmail.com its faster.  I will be happy to help with these little things.  Once the library is installed properly it should work.
Photo of Ken - NM9P

Ken - NM9P

  • 4239 Posts
  • 1351 Reply Likes
SUCCESS!  sort of...
I now have limited control using the Hercules DJControl MP3 LE MIDI Controller.
After loading the midibus library, the find midi device sketch worked.
Then I had to change the access name in your main program from
"Hercules DJControl Instinct"
 to
DJControl MP3 LE MIDI"  and then it came to life.

Unfortunately some of the controls so nothing, and all of the controls that do anything are in the wrong place and the tuning dials are very slow.  but this is a matter of tracing the correct midi note and replacing it on the controller.

Thanks.

Now, is there an easy way to move a control, knob or button and see a readout of what its code is so that I can direct it to the correct command?

We are getting places now!

Ken - NM9P
Photo of William Hemmingsen

William Hemmingsen

  • 573 Posts
  • 278 Reply Likes
Ken emailed you, but will post here also

To figure out what knobs and buttons are what, run this example code under the midibus library.

Under examples its Contributed Libraries>The MidiBus>Basic


Update this line as you did before:  myBus = new MidiBus(this, -1, "Java Sound Synthesizer"); //


Then it should print out the numbers as you turn the nobs and hit the buttons.

Write down what channel/number(or pitch for buttons) is for each knob.  Then just take that info and edit my code.

  For example

This is for rit freq up

if ((channel == 0) && (number == Change this) && (value == 1)) {rit_freq=rit_freq+10;  c.write("C44|slice set 0 rit_freq="+rit_freq+"\r\n");}

This is for rit freq down

if ((channel == 0) && (number == Change this) && (value == 127)) {rit_freq=rit_freq-10;  c.write("C44|slice set 0 rit_freq="+rit_freq+"\r\n");}

If you need help locating a particular function let me know.

Once you get it going, I will help you speed you the dials to your liking.  Also the windows software that comes with the Hercules has a utility to change the jog speed.

William
Photo of William Hemmingsen

William Hemmingsen

  • 573 Posts
  • 278 Reply Likes
VFO speed select is more to slow it down vs speed it up, but who knows what your knob(whichever one it is) is set at.  This is the line to edit wit the correct number to match you controller.

//VFO speed select
if ((channel == 0) && (number == Change This)) {speed = value; slowdown=0;}
Photo of William Hemmingsen

William Hemmingsen

  • 573 Posts
  • 278 Reply Likes
For CWX memories, I don't think can be a accessed via another client, so in order to do it with MIDI controller, you will just have to program a button with a canned message.  And also how to program a dial for wpm speed.  Like this:

//*************************************************

void controllerChange(int channel, int number, int value) {
//CW speed ?? = Pick a dial
//if ((channel == 0) && (number == ??) && (value < 101)) {c.write("C44|cwx wpm " + "+value+"\r\n");}

void noteOn(int channel, int pitch, int velocity) {
//CW Canned Messages ?? = Pick a button
if ((channel == 0) && (pitch == ??)) {c.write("C44|cwx send \QRZ CQWW DE W4WHL K\r\n"); }
if ((channel == 0) && (pitch == ??)) {c.write("C44|cwx send \CQ CQ DE W4WHL K\r\n"); }

//************************************************

Etc Etc.

Of course you will only want messages that NEVER change.  If you want to get fancy, you could write a GUI to input and change memories, but this adds complexity.  Its simpler for me to just update the code :)

Another option that would be much easier, is to create a XML file with all your memories, then have the program pull them from the XML file. I may work on this when I get time.

William
Photo of William Hemmingsen

William Hemmingsen

  • 573 Posts
  • 278 Reply Likes
Nevermind you can send CWX memories no problem here ya go:

void controllerChange(int channel, int number, int value) {
//CW speed ?? = Pick a dial
//if ((channel == 0) && (number == ??) && (value < 101)) {c.write("C44|cwx wpm " + "+value+"\r\n");}

void noteOn(int channel, int pitch, int velocity) {
//CW Canned Messages ?? = Pick a button
if ((channel == 0) && (pitch == ??)) {c.write("C44|cwx macro send 1\r\n"); }
if ((channel == 0) && (pitch == ??)) {c.write("C44|cwx macro send 2\r\n"); }
if ((channel == 0) && (pitch == ??)) {c.write("C44|cwx macro send 3\r\n"); }
if ((channel == 0) && (pitch == ??)) {c.write("C44|cwx macro send 4\r\n"); }

I will add this to my code this weekend



W4WHL
(Edited)
Photo of William Hemmingsen

William Hemmingsen

  • 573 Posts
  • 278 Reply Likes
Here is the newest layout, I will post a link later today or tomorrow once its tested.

(Edited)
Photo of William Hemmingsen

William Hemmingsen

  • 573 Posts
  • 278 Reply Likes
The balance does interesting thing, It switches A to left ear, B to right ear or vice verse.  In the center it mixes both channels.   So you can listen to slice a in the left ear and slice b in the right (or vice verse), centered you hear both in both ears, or any combination of the above.  If only one slice is open its acts as a standard balance, but the balance is reversed for slice b.  This was done on purpose.

That was quicker than I thought.  all new functions work as in the above photo.  I will post the new code in about 20 min.

W4WHL
Photo of Jay -- N0FB

Jay -- N0FB, Elmer

  • 539 Posts
  • 213 Reply Likes
William, what version of the Hercules are you picturing above?
Photo of William Hemmingsen

William Hemmingsen

  • 573 Posts
  • 278 Reply Likes
Hercules DJControl Instinct
Photo of Jay -- N0FB

Jay -- N0FB, Elmer

  • 539 Posts
  • 213 Reply Likes
Danke schön!!!
Photo of William Hemmingsen

William Hemmingsen

  • 573 Posts
  • 278 Reply Likes
Den man gerade willkommen
Photo of William Hemmingsen

William Hemmingsen

  • 573 Posts
  • 278 Reply Likes
Ok I made one more update.  I added mode switching.  Not sure how I forgot that :)



And here is the link to the new download.  I complied 64 & 32 bit versions. 

https://www.dropbox.com/s/re9tlop8r7y7wje/FlexMidiTCP.zip?dl=0
Photo of William Hemmingsen

William Hemmingsen

  • 573 Posts
  • 278 Reply Likes
Ken,  Did you get a chance to try this?

W4WHL
Photo of Ken - NM9P

Ken - NM9P

  • 4239 Posts
  • 1351 Reply Likes
Not yesterday, I ended up with too many projects. Perhaps today or tomorrow. I will be able to work on it.
Photo of Ken - NM9P

Ken - NM9P

  • 4239 Posts
  • 1351 Reply Likes
Last night I got things working, thanks. I have mapped out the layout on my Hercules DJControl MP3 LE, which is different from the Instinct, and will finish the programming Sunday afternoon, if all goes well.
Photo of William Hemmingsen

William Hemmingsen

  • 573 Posts
  • 278 Reply Likes
did you get the VFO speed better?
Photo of Ken - NM9P

Ken - NM9P

  • 4239 Posts
  • 1351 Reply Likes
I have gotten almost everything working except the RIT/XIT and the PTT buttons.
You are doing something on the PTT that I didn't quite catch, looks like it sends two different values, one on make and another on break.
Your RIT controller is different, mine is a detented rotary knob, like on many 2 meter rigs.
Yours seems to be a push lever.  I haven't traced down the different values to get them working yet, but I haven't run the utility program yet, either.

My latest update is built upon your last file which includes changing the step size.
I have found that with my controller I do not need the "slowdown" knob or routine, so I cut it out.

I enhanced the CW speed with this little bit of math...

if ((channel == 0) && (number == 58) && (value < 101)) {c.write("C44|cwx wpm "+(5+(value/3))+"\r\n");}  

By doing some math on the value reported by the control, I was able to reduce the span of the control from 5 WPM to 38 WPM, which is just about exactly where I wanted it.  As it was, it was too touchy and I didn't use about 2/3 of the range of the control.  I plan to do similar things with other controls as I need it.

I have the whole control panel mapped out, with the exception of the RIT/XIT knobs.  I know what their number is, but not what values they send, yet.  But I will get it.
I am confident that I will be able to completely customize the entire board with every function I wish.
The more I look at your code, the more I am impressed with your work, and how easy this is, once we get over a few hurdles.  Thank you for leading the way!

With that, I have a few basic questions:

1) Which part of the code is the section you are using to display frequencies on the tuning dials?  My controller doesn't have any display, so I would like to cut it out.  I just don't want to cut out anything essential.

2) Where did you get the lost of commands and addresses for the various functions for the flex API?  I haven't found a convenient list.

3)  Is it possible on these controllers to control the various lights under the keys?  I would like to expand my controller to allow, for example, toggling RIT/XIT with a single button and turn the light on when active and off when inactive, or turning NB, ANF, NR, etc on and off with the light as feedback as to the state of the function.

4)Would it be OK with you to link my version of this program with tutorial comments in this form and the PowerSDR-UI forum so the many people who have my particular controller can know they have this wonderful option for the 6000 Series?  (I don't want to steal any thunder from you and your efforts.)

Thanks for your help.  This has been some of the most creative programming I have done in years.  It is very refreshing!

Ken - NM9P
Photo of William Hemmingsen

William Hemmingsen

  • 573 Posts
  • 278 Reply Likes
Sounds good, see my answers below.  It really is not hard to mod.  Once you have the basic idea, adding and changing becomes second nature.


1) Which part of the code is the section you are using to display frequencies on the tuning dials?  My controller doesn't have any display, so I would like to cut it out.  I just don't want to cut out anything essential.


It displays it on the APP window, but you can remove it if you wish. 

  fill(0);
  rect(95, 320, 100, 30);
  rect(310, 320, 100, 30);
  rect(510, 320, 100, 30); //This is for step display
  fill(255);
  textSize(14);
  text(nf(FreqA,1,5)+"0",107,338);
  text(nf(FreqB,1,5)+"0",535,338);
  text(" Step="+nf((Fstep*1000000),1,0)+"Hz",315,338);//This is for step display




2) Where did you get the lost of commands and addresses for the various functions for the flex API?  I haven't found a convenient list.


I just dug through the API files till I found what I needed.  Not exactly easy.  Look in the files for "sendcommand".  in void setup I run a command called "sub slice all".  This command subscribes to all slice related info.  So when a variable changes, it sends a string to the client.  Currently I only strip out the frequency for each slice.  But there is tons of info you can pull out.  However parsing strings is not very fun.  And too much can be a strain and slow down the program causing jittery controls.  I felt the only necessary info was the current frequency.


3)  Is it possible on these controllers to control the various lights under the keys?  I would like to expand my controller to allow, for example, toggling RIT/XIT with a single button and turn the light on when active and off when inactive, or turning NB, ANF, NR, etc on and off with the light as feedback as to the state of the function.


I have not found a way yet, But still looking.  If I find it I will let you know.


for your controller the RIT /XIT uses encoders so you will want to slow it down a lot else it will ve very touch.  Start at 5 and adjust to you liking. Also adjust rit_freq+10 to your desired step size.

if ((channel == 0) && (number == ??) && (value == 1)) { if (slowdown != 5) {slowdown=slowdown+1;} else {rit_freq=rit_freq+10;  c.write("C44|slice set 0 rit_freq="+rit_freq+"\r\n");slowdown=0;}}
if ((channel == 0) && (number == ??) && (value == 127)) { if (slowdown != 5) {slowdown=slowdown+1;} else {rit_freq=rit_freq-10;  c.write("C44|slice set 0 rit_freq="+rit_freq+"\r\n");slowdown=0}
if ((channel == 0) && (number == ??) && (value == 1)) { if (slowdown != 5) {slowdown=slowdown+1;} else {xit_freq=xit_freq+10;  c.write("C44|slice set 0 xit_freq="+xit_freq+"\r\n");slowdown=0}
if ((channel == 0) && (number == ??) && (value == 127)) { if (slowdown != 5) {slowdown=slowdown+1;} else {xit_freq=xit_freq-10;  c.write("C44|slice set 0 xit_freq="+xit_freq+"\r\n");slowdown=0}


If you want 1 button to toggle on and off, that is easy. something like this should toggle just fine;


Under void setup

int x=0;


Under void noteOn;

if ((channel == 0) && (pitch == ??))  {int x=x+1; if (x == 1) {c.write("C44|slice set 0 rit_on=1\r\n");} else {c.write("c44|slice set 0 rit_on=0\r\n"); step = 0;}}




4)Would it be OK with you to link my version of this program with tutorial comments in this form and the PowerSDR-UI forum so the many people who have my particular controller can know they have this wonderful option for the 6000 Series?  (I don't want to steal any thunder from you and your efforts.)


Sure I don't care, but please through me some credit my way.



William


W4WHL
Photo of Ken - NM9P

Ken - NM9P

  • 4239 Posts
  • 1351 Reply Likes
Thanks, William.
As soon as I can master the RIT/XIT encoders, I am almost finished.

I have already figured out a slightly better logic for changing modes by incrementing the counter and setting overrun values BEFORE the IF/THEN routines.  Also, it is possible to increment/decrement a counter simply by "COUNTER++" or "COUNTER--" instead of "COUNTER = COUNTER + 1" ,  etc.  This is a little cleaner in my book. 

The math I added really smoothed out CW SPEED control.  I may apply this to other functions, too.

When I find the commands in the API, I may try to add band up/down buttons, filter selection, or program a few function keys for favorite bands, using the shift function of the CWX send buttons.

Then I hope to tackle some more complicated logic, such as using a single button to toggle RIT or XIT on and off instead of needing two buttons each.  This will free a couple of other buttons.  Then refining the tuning speed selections so that moving from 10 to 100 tuning speed doesn't leave me with hanging numbers, but that everything tunes on even 100's.

Then perhaps having the TX buttons automatically select TX-A or TX-B respectively when pressed.  (If that will work)

Or even auto-variable tuning steps?  
The sky's the limit!
You have unleashed a monster!

Thanks,

Ken - NM9P

BTW...I just discovered this afternoon that your display is on the picture, not on the actual controller!  I always minimized this when working on it and noticed it by accident....Doh!  
(Edited)
Photo of William Hemmingsen

William Hemmingsen

  • 573 Posts
  • 278 Reply Likes
yes Var++ is cleaner.  I plan to do a lot of cleanup.  Its composite of 5 days of my twisted mind.

By the way the LEDs dont work via midi under Windows.  Under windows they are controlled via directdraw.  Under MAC driver they do work via Midi.  I'm not even tempted to go down that road LOL.

Anyway enjoy, sounds like your having fun.  It was a way for me to kill a week of solar blackout.  Next is to make my own controller hardware.

I'm going to clean up my program a bit, then let the community run with it.

William
Photo of Ken - NM9P

Ken - NM9P

  • 4239 Posts
  • 1351 Reply Likes
I got the RIT and XIT going last night...I had copied the wrong channel numbers into the program!

I spent lots of time looking for solutions and trying various Coding variations. Then I saw my dumb error. Moral: never code when you are tired...

This will probably take a while to "perfect" but it is completely usable right now. I need to do some cleaning up, documentation, and a few more additions that will require some API research. Then I will export it, compile it, or whatever it needs to do to make it a stand alone program.

BTW... This code looks very similar in style to C#, that I have just started trying to learn. Are they related?

I got the book, downloaded the Community Visual Studio 2013, and have only done the first two lessons, which let me open a window and print a sentence, and make a push button. So I have a long way to go. But using "Processing" makes me think that it can't be all that different, or all that hard. I was amazed that the logic and math came back to me so quickly.

Again, thanks a lot for your help getting me started.
I can use this as a basis for more utilities in the future, now that I know that I can really do this! This is one reason I got a Flex in the first place!
(Edited)
Photo of William Hemmingsen

William Hemmingsen

  • 573 Posts
  • 278 Reply Likes
I made another small update, the main screen now displays VFO frequencies.  I thought it would be nice to have some visual feedback the program is doing something.



Here is the updated download;

https://www.dropbox.com/s/re9tlop8r7y7wje/FlexMidiTCP.zip?dl=0
Photo of Ken - NM9P

Ken - NM9P

  • 4239 Posts
  • 1351 Reply Likes
Looks really nice.
Photo of Jeffrey Kerber, N3VE

Jeffrey Kerber, N3VE

  • 131 Posts
  • 20 Reply Likes

I received my Instinct today and have it working.  I must tell you it was a lot of fun figuring this out as I am not a programmer. 

Thanks,

Jeff N3VE

Please keep posting updates as you complete them, thanks to you William.

By the way what is your call?

Photo of William Hemmingsen

William Hemmingsen

  • 573 Posts
  • 278 Reply Likes
great!! How is it working for you?

W4WHL
Photo of Jeffrey Kerber, N3VE

Jeffrey Kerber, N3VE

  • 131 Posts
  • 20 Reply Likes

Works quite well, now all I need is an Elmer to help with the PW-1 and ddutil


Photo of MH_Flexer

MH_Flexer

  • 65 Posts
  • 13 Reply Likes
William,

Thanks for all the effort and for sharing the files. For anyone who wants to go this route, below is an eBay link. Best Buy has them via the link for $129.95 with free shipping.

http://www.ebay.com/itm/Hercules-DJ-C...

Dmr
Photo of William Hemmingsen

William Hemmingsen

  • 573 Posts
  • 278 Reply Likes
Let me know if you think some functions should be moved or replaced.  I would like to maybe create a couple different layouts.

one thing to note.  When using 2 slices, make sure the frequencies show up correctly in the MIDI software.  If not just move the slices with the mouse once and everything should sync.

Also I would like comments on the VFO scroll speed.  My "Speed" dial was to slow it down, not speed it up.  So I could make fine adjustments.  But wondering if its fast enough?  It currently uses 10Hz stepping, 

User defined layout may come one day, but that is 100x more coding.  So for now a couple popular layout options would be easier.

William
W4WHL
Photo of William Hemmingsen

William Hemmingsen

  • 573 Posts
  • 278 Reply Likes
New update.  Now pressing the Jog wheels down changes the step size.  Now you can tune across band fast.  Default step is 10hz, pressing either Jog wheel switches to 100hz, and pressing it again switches it back to 10hz.  A display was added to the main screen that shows active step



Updated code will be uploaded shortly

William
Photo of William Hemmingsen

William Hemmingsen

  • 573 Posts
  • 278 Reply Likes
Photo of William Hemmingsen

William Hemmingsen

  • 573 Posts
  • 278 Reply Likes
Small update, I was constantly accidentally pushing down on the jog wheels so I moved the step buttons.




(Edited)
Photo of William Hemmingsen

William Hemmingsen

  • 573 Posts
  • 278 Reply Likes
Made a few small updates.  I did some optimization and updated the VFO code.  Now when using 100Hz stepping the frequency snaps to even 100hz increments.  Updated the WPM speed similar to Kens suggestion.

https://www.dropbox.com/s/re9tlop8r7y7wje/FlexMidiTCP.zip?dl=0

William
Photo of Ken - NM9P

Ken - NM9P

  • 4239 Posts
  • 1351 Reply Likes
William,
I looked at your code and you cleaned it up nicely.  I wouldn't have guessed that you haven't put any code down for 15-20 years!  

I like the way you did the CW WPM line.  I didn't know you could separate the (value) out like that.  It is much cleaner.  This gives me some additional ideas for the future.

I found that with my controller, I don't need the Slowdown routine, so I will drop it.
I plan to use your cleaned up VFO and Tuning speed routine to make multiple tuning speeds of 10, 100, and 1K,  perhaps even 50, 250, and 500, too.  I am not sure the odd steps sizes will work, but I will play with some additional logic.

On your mode changing routine, I noticed that you check for overrun/underrun and then reset the counter to 0.  This works for going UP, but when coming back down, I found it worked better to enter the MAX (10 in my case, because I added a few modes that you didn't have). It made the rollover work more smoothly.   The nice thing is that we can add as few or many modes as we want in any order we wish!

When I put mine out, I plan to put some credit lines at the bottom.
For the background picture and legend, I assume I should be able to simply edit my own picture of the controller, using the same resolution and dimensions and it should work?
Photo of William Hemmingsen

William Hemmingsen

  • 573 Posts
  • 278 Reply Likes
Yep that's all you need to do.  You may have to shift around the text and rect boxes (freq and step displays) to line up with your image.

Please share your mode code, yes I noticed mine was a bit finicky.

William
Photo of Ken - NM9P

Ken - NM9P

  • 4239 Posts
  • 1351 Reply Likes
Will do, as soon as I get home tonight and clean things up.
Thanks,

BTW, upon reading the API docs, I discovered that I don't need to add the +5 in my CW WPM statement, because 5 wpm is already the lower limit... Don't know if it will make any difference in the smoothness.  I like your method, and may simply tweak the adjustment number to set the range that I want.

I finally found some of the documentation that I was looking for and it is very helpful.  There are even some things that cannot be adjusted with SSDR right now.  I don't know if that is for future use or whether the API gives us access to things like APF Gain and APF Q, etc. that are not in the current release.  I may play with that tonight.

Ken - NM9P
Photo of William Hemmingsen

William Hemmingsen

  • 573 Posts
  • 278 Reply Likes
I updated the Volume, AGC-T, RF Power and Balance controls for better granularity and smoother action.

https://www.dropbox.com/s/re9tlop8r7y7wje/FlexMidiTCP.zip?dl=0

 William
(Edited)
Photo of William Hemmingsen

William Hemmingsen

  • 573 Posts
  • 278 Reply Likes
New update coming.  I updated XIT/RIT On/Off into one button.  Also added LED support.  Turning on XIT/RIT lights up the button.  Also TX select lights up the selected button.

Photo of William Hemmingsen

William Hemmingsen

  • 573 Posts
  • 278 Reply Likes
Ken, I know I said it LED control couldn't be done, well I figured it out for mine.  Will it work on yours, no clue.

Photo of Ken - NM9P

Ken - NM9P

  • 4239 Posts
  • 1351 Reply Likes
Very neat!  I will look at it tonight.
Thanks!
Photo of Ken - NM9P

Ken - NM9P

  • 4239 Posts
  • 1351 Reply Likes
Here is my latest effort.
I spent several hours last night with some success and some frustration:

I was finally able to get a routine going to toggle RIT & XIT ON/OFF with single buttons.

I found that clearing the RIT/XIT didn't clear the memory it used to calculate the offset so it just picked up where it left off when you turned the knob again, so I added a statement to clear the memories used to enter RIT/XIT offsets.

I was NOT able to get the buttons to light up.  I know it is possible because there is one that flashes constantly whenever the thing is plugged in.  It is probably a matter of finding the correct command or message channel to address, just I needed to reprogram all the other function channels.

I am still cleaning it up and looking for a way to perfect the mode switching routines.  I may just leave it alone, it probably will add as much code is it takes to clean it up.

I will tackle band switching and filter selection next.

I was going to send you a copy last night but I was up WAY too late and had to quit as soon as I solved a particularly vexing problem caused by a syntax error that I accidently introduced up the line while trying to clean up my code.  Had to hit the sack!  Moral:  Programming when sleepy only takes you longer!

I hope to put something up tonight.

Ken - NM9P
Photo of William Hemmingsen

William Hemmingsen

  • 573 Posts
  • 278 Reply Likes
Uploading now, give it 5 min before downloading :)

https://www.dropbox.com/s/re9tlop8r7y7wje/FlexMidiTCP.zip?dl=0
Photo of GI4FZD

GI4FZD

  • 129 Posts
  • 18 Reply Likes
Just a quickie, will any of this work on the older hercules mp3 e2 version of this controller
cheers
Paul GI4FZD
Photo of Ken - NM9P

Ken - NM9P

  • 4239 Posts
  • 1351 Reply Likes
As Far as I know, the MP3 e2 is laid out the same as my MP3 LE controler and should work with either no or a few modifications.  The buttons, knobs, sliders and other functions on the one William is using all have different codes, which must be changed before it will work.  Once you learn how, it isn't a really big deal, if you aren't afraid of a little programming.

Once I get my version of William's programmer cleaned up, I will publish it here.

Ken - NM9P
Photo of GI4FZD

GI4FZD

  • 129 Posts
  • 18 Reply Likes
Thanks Ken,
I will give it a try when you publish it,
Paul
GI4FZD
Photo of William Hemmingsen

William Hemmingsen

  • 573 Posts
  • 278 Reply Likes
I made a few more slight mods today.  I set it so when you change to CW mode it lights up the CWX memory keys.  I also changed the step keys from 2 toggles to separate keys, one for 10hz and the other for 100hz.  I find this easier than a toggle.

I printed out and installed labels on my controller.  It looks really nice now.  Next thing I want to do is weight the jog wheels.

I think I'm about done with this project.  Its time to start enjoying it..LOL.  I have only made 3 DX contacts since I started this. 

I'll post up the code tomorrow.

For the LED's I found that you need to send a message to the controller.

myBus.sendMessage(144, xx, 127);  // xx = pitch, 127 turns on, 0 turns off

Not sure if this works for the MP3 LE or not. 


William
Photo of Jeffrey Kerber, N3VE

Jeffrey Kerber, N3VE

  • 131 Posts
  • 20 Reply Likes

Keep up the good work, I am enjoying this.

Jeff N3VE

Photo of Chris DL5NAM

Chris DL5NAM

  • 689 Posts
  • 154 Reply Likes
Have orderd my Hercules last friday, DHL tracking shows should come today.

Hope i get it started. I am not a programmer - i am in this case double left handed. Hope i found a small tutorial or any assistance.

Thanks for good work
Photo of William Hemmingsen

William Hemmingsen

  • 573 Posts
  • 278 Reply Likes
which one did you buy?
Photo of Chris DL5NAM

Chris DL5NAM

  • 689 Posts
  • 154 Reply Likes
I got it a hour b4. Hercules DJ Control Instinct from Amazon. Cost 89.-€ = 98$ incl. postage
Photo of William Hemmingsen

William Hemmingsen

  • 573 Posts
  • 278 Reply Likes
Then you should be able to just run the program and use it right away.  I'm uploading a windows installer package as we speak.  I'll post link in a few min.  Its large because it includes Java runtime.  Just install the app and have fun.  Source is included if you want to try modifying it.

William
Photo of Chris DL5NAM

Chris DL5NAM

  • 689 Posts
  • 154 Reply Likes
Not working proper. Will uninstall all DJ parts/driver and FlexMidi and start again at zero. Turning VFO A or B button change only in FlexMidi the freq. If i change band with SmartSDR it show my old QRG as used last time. If turn VFO A or B Flex jump to 21.000.000 in case of 15m or at 80m to 3.000.000 and then no changes possible with VFO button
Photo of William Hemmingsen

William Hemmingsen

  • 573 Posts
  • 278 Reply Likes
Ok after reinstalling.  Start SmartSDR then start FlexMidi.  Tune around in SmartSDR with the mouse.  Verify the frequency is changing correctly in the FlexMidi App window.  If the frequencies are not updating correctly let me know.  If they do update correctly, you should be able to use the controller.

Keep me posted.

William
Photo of William Hemmingsen

William Hemmingsen

  • 573 Posts
  • 278 Reply Likes
One other note, every time before using the Hercules, it is a good idea to verify they are synced by starting both VFO's and tuning them around with the mouse.  Then verify the FlexMidi App is properly synced.  Once they are synced everything should work properly.  You only need to do this if you close the FlexMidi App.  Closing SmartSDR makes no difference.

William
Photo of Ken - NM9P

Ken - NM9P

  • 4239 Posts
  • 1351 Reply Likes
William,

I have found that occasionally, upon initial start-up of the program, that "VFO-B" does not get read by the software and turning the tuning knob makes it start tuning with whatever frequency happens to be in the cue...usually 0.000 Mhz.  It then sends the Slice to that frequency.  (I have occasionally found this on Slice-A after the slice has been closed and opened on a different band.

But if some other action happens on the controller, or on the rig with a mouse, that the program reads the Slice-B frequency and things work fine.  Often I will simply hit the button to change TX to B then back to A and things work fine.  I am not sure what a software solution to this might be.  Perhaps it is doing the initial frequency read before the program is fully connected to the rig and is missing it?

I have a similar delay the first time I turn RIT or XIT ON.  It misses the first button press, then everything works fine after that.  Occasionally this is true on the mode switching as well.  Ahh, the mysteries of software development.

I remember many years ago when programming that it was sometimes necessary to "toss a null" at a serial port to "clear the lines" or initialize it before using it.  I don't know if any of that is valid any more.

Ken - NM9P
Photo of Chris DL5NAM

Chris DL5NAM

  • 689 Posts
  • 154 Reply Likes
No changes. Same as b4.
If i start FlexMidi he takes the QRG from SmartSDR correct. If i turn VFO button SmartSdr jump to 3.000.000 but FlexMidi using the old freq and counts up or down only at FlexMidi display. Flex it self is fixed. 
Balance A-B also work wrong. At right side VFO A is at highest level; at left side quiet (if i only using 1 VFO)
Photo of Chris DL5NAM

Chris DL5NAM

  • 689 Posts
  • 154 Reply Likes
VFO speed is also wrong. Full CCW is fast, full CW is slow.
Photo of William Hemmingsen

William Hemmingsen

  • 573 Posts
  • 278 Reply Likes
Can I ask which version of FlexMidi you are running 32bit or 64bit?  Also what version of SmartSDR. 
Photo of William Hemmingsen

William Hemmingsen

  • 573 Posts
  • 278 Reply Likes
Chris, just found an error in the code in the latest version.  This may have been what caused your issues.  Give me a few to test it and I'll post an update.
Photo of William Hemmingsen

William Hemmingsen

  • 573 Posts
  • 278 Reply Likes
The balance works correct for me, middle both speakers on, slide it right only the right speaker, slide it left only the right.  The balance for VFOB is backwards on purpose.  This is done so you can listen to each vfo out a separate speaker

Photo of William Hemmingsen

William Hemmingsen

  • 573 Posts
  • 278 Reply Likes
"VFO speed is also wrong. Full CCW is fast, full CW is slow."  This is the way its supposed to work.  Maybe I should of called it "Delay".  Its meant to slow down the VFO's for fine tuning. You can change it is you like.   The source is included.

As for the code I'm uploading a fix for the error I found.  This only affected VFOB.  Please give it a try and let me know.
Photo of William Hemmingsen

William Hemmingsen

  • 573 Posts
  • 278 Reply Likes
Uninstall the previous version and just install this one manually.  Just unzip the files and run the app under the application.windows32 or
application.windows64.

https://www.dropbox.com/s/re9tlop8r7y7wje/FlexMidiTCP.zip?dl=0
Photo of Chris DL5NAM

Chris DL5NAM

  • 689 Posts
  • 154 Reply Likes
William, here W7 64
Will download try now lastest version, QRX
Photo of Chris DL5NAM

Chris DL5NAM

  • 689 Posts
  • 154 Reply Likes
NO changes,


SS=SmartSDR   FM=FlexMidi

start ss, vfo shows 3.505.00
start fm, fm vfo 3.505.000
change freq at ss to 3.515.000
fm shows also the new freq 3.515.000

now i using vfo button from fm
ss jump to 3.000.000
fm shows 3.515.000

i dial ff vfo down to 3.000.000
ss shows always 3.000.000

i dial ff under 3.000.000
ss jump to 2.000.000

Install  manually, first at disk D: and then also at C:  - no difference
also no difference between W32 and W64
Photo of William Hemmingsen

William Hemmingsen

  • 573 Posts
  • 278 Reply Likes
Chris, I tried the exact step you did, but everything worked as expected for me.  What version of smartSDR are you running??

Are you running a English or German language for windows?

Something is causing the app to not send the correct frequency to smartSDR.  This is whats causing the VFO to jump. 

FlexMidi is receiving the correct frequency from smartSDR, as it is displaying it correctly in the APP.  When you turn the VFO dial it should increment the frequency and send it back to the radio.  This is where it breaks.  It obviously is sending garbage, because your frequency jumps by 1mhz not 10hz like it is supposed to.

Something in your system is breaking the math, But I need to figure out what is different in your setup that may be causing this.
Photo of Chris DL5NAM

Chris DL5NAM

  • 689 Posts
  • 154 Reply Likes
run SS1.4

but it's a good point ( it was also still idea here b4 ) i using the german version of win and between USA an DL there is a difference in using DOT and COMMA
It a nice place for doing "errors"  - i remember the old CT contest software day's
Photo of William Hemmingsen

William Hemmingsen

  • 573 Posts
  • 278 Reply Likes
Chris in FlexMidi.  Does the Frequency show a dot or a comma?  I think we are getting somewhere.
Photo of Chris DL5NAM

Chris DL5NAM

  • 689 Posts
  • 154 Reply Likes
FM  3,515000    COMMA
SS    3.515.000    DOT (2 times)
Photo of William Hemmingsen

William Hemmingsen

  • 573 Posts
  • 278 Reply Likes
Ah Ha, FM should be displaying a dot.  So I need to rethink how to account for this.  Give me some time to think about this.  I'm sure this is whats causing the issue. 


Let me try a few things and get back to you.

William
Photo of William Hemmingsen

William Hemmingsen

  • 573 Posts
  • 278 Reply Likes
I have a file uploading for you to try.  Lets cross fingers!

I'll post the link shortly

William
Photo of William Hemmingsen

William Hemmingsen

  • 573 Posts
  • 278 Reply Likes
Chris,  Extract and run this version.  I suspect your computer is using commas instead of periods in the calculations.  Then its sending the number with the comma back to the 6000.  The 6000 does not know what to do with this.  In this version I convert the frequency to text, than replace the comma back to a period before sending to the 6000.  Let me know!

If this version does not fix it, I have another idea also.

https://www.dropbox.com/s/77j3vvsh5h7dgt5/application.windows64.zip?dl=0
(Edited)
Photo of Chris DL5NAM

Chris DL5NAM

  • 689 Posts
  • 154 Reply Likes
Now it works!
Will test all other buttons/function.
Will give you feedback

73 Chris
DL5NAM
Photo of William Hemmingsen

William Hemmingsen

  • 573 Posts
  • 278 Reply Likes
Woo Hoo!!!  Let me know what else you find.  Glad I could help!

I will incorporate this modification in all future releases. 

William
(Edited)
Photo of KD8TVB

KD8TVB

  • 49 Posts
  • 11 Reply Likes
Got the Midi controller today from Amazon... Very cool I must say. William you are a good man!

I will continue to play, thanks
Photo of William Hemmingsen

William Hemmingsen

  • 573 Posts
  • 278 Reply Likes
Glad its working foe you!