Home Forums Module Development DTMF to CI-V (Rig Control)

Viewing 10 posts - 11 through 20 (of 28 total)
  • Author
    Posts
  • #2644

    Thanks Dan / Aaron,

    I have hamlib 3.0.1 (rigctl) working with my spare RPi 3 + 2018-11-13-raspbian-stretch-lite and IC-7100.

    There is a Tcl library, but I have yet to find any documentation on it.

    I am looking through Dan’s template module and am not quite sure if there is a way to make rigctl calls from the Tcl.

    -Gregg (WB6YAZ)

    #2646
    Dan, KG7PAR
    Forum Administrator

    How are you interacting with the rigctl currently?

    If you can use the console you could use system calls to call the commands from tcl.

    #2647

    Dan,

    Running rigctl through a bash shell. Have any suggestions for a good tcl tutorial?

    Thanks,

    -Gregg (WB6YAZ)

    #2648
    Dan, KG7PAR
    Forum Administrator

    I can’t say that I have found anything useful, although I have not really looked much. I pretty much studied some existing code (Remote Relay) and counted on my script programming background to get through it on the ones I have done so far.

    I have heard the nutshell series are pretty decent in general, but can’t comment from personal experience. The dummies series might be a consideration as well, depending on your background with code.

    One thing I would warn you about is the use of spaces. TCL uses white spaces as code breaks, so while normally this “}{” would be okay, it will break TCL. You instead need to put the space between them like this “} {“. This took me a painful amount of time and trial/error to figure out and find in the code.

    I would say keep it crude for now, get what you want working and it can always be improved later if someone else wants additional functionality, or if you come across a better reference for the TCL library for rigctl.

    Functional before pretty 🙂

    For executing system/console calls, you can do something like this, note that I have ignored the stderr response so it wouldn’t know if something went wrong or not, the console portion below starts at “sudo…”, exec is TCL version of making a console type call.

    if {$cmd == “999”} {
    # restart the service
    exec -ignorestderr sudo /usr/sbin/service svxlink restart
    }

    #2649
    Aaron, N3MBH
    Forum Administrator

    Gregg,
    Glad that you’ve gotten the hamlib/rigctrl working on the Pi. Sounds like it will be a cool module once we can put all the pieces together.

    In the meantime, now that you have rigctrl working on your pi, you can connect it to the outside world if you can punch a hole in your firewall or use a VPN or something then you can ssh into the pi to control your rig.

    Pretty neat stuff.

    73,
    Aaron – N3MBH / WRFV871

    OpenRepeater is offered free of charge. Find out how you can support us.

    #2653
    Aaron, N3MBH
    Forum Administrator

    I’ve also moved this into a new forum created for module development as that will be a thing in the upcoming release.

    73,
    Aaron – N3MBH / WRFV871

    OpenRepeater is offered free of charge. Find out how you can support us.

    #2655

    Thanks Aaron,

    Slowly learning tcl. Being a retired microwave engineer, learning a new programming language is a challenge. I am familiar with Matlab and Python and to a lesser extent bash scripting, so it will take me some time to understand the tcl structure.

    I have loaded tcl8.6 onto my Pi and was able to get the following to run:

    set rigfreq [exec rigctl -m 370 -r /dev/ttyUSB0 f]
    puts $rigfreq

    I think I will start with creating rigctl functions for simply changing memory locations. I can see that trying to do too much with dtmf commands will be difficult and hard to remember without carrying around a cheat sheet.

    The impetus for this project was to be able to access my IC-7100 and Echolink while riding my bike around the area. So far so good, fun stuff. Thanks again for your help.

    -Gregg (WB6YAZ)

    #2656
    Dan, KG7PAR
    Forum Administrator

    Gregg, I think your approach is the best one for now. Build out some limited scope functions in TCL that are discrete and easily testable in isolation. Once you have the basics in place, we can put them into a framework where the DTMF gets involved for higher level integrations.

    As you write your functions, try to include control variables that will enable abstraction to other rigs later, something like this as a prototype (note the syntax is likely wrong, and will need to be adjusted based on the RigCtl functionality):

    #start with constants, these can be abstracted later when integrated
    set RigType IC7100
    set MemoryChannelToRecall 5
    
    func RadioRecallMemory { $RigType $MemoryChannelToRecall } {
      switch $RigType {
        IC7100 {
           #send command to recall the memory channel $MemoryChannelToRecall
        }
      }
    }
    #2659

    Dan,

    The following works:

    set RigType IC7100
    set MemoryToRecall 06

    proc RadioRecallMemory {a b} {
    switch $a {
    IC7100 {
    exec rigctl {*}{-m 370 -r /dev/ttyUSB0 E} $b
    }
    }
    }

    RadioRecallMemory $RigType $MemoryToRecall
    puts $MemoryToRecall

    The rigctl get_mem (‘e’) function is not implemented.

    -Gregg (WB6YAZ)

    #2660
    Aaron, N3MBH
    Forum Administrator

    Gregg,
    Sounds like you are making some head way. I’ve only lightly tinkered with rigctrl. So if I understand correctly the ‘E’ (uppercase) writes the Memory to the radio and the ‘e’ (lowercase) reads the memory to the radio. I presume much like the F and f do for frequency. I assume that the library for the IC7100 is in Beta or just half baked. This feature is likely supported on other radios.

    So I am assuming that the ‘e’ feature yeilds no results when run directly from the command line. If that is the case then you would probably need to turn to the ic7100.c library in hamlib to track down the issue. If you can fix it maybe make a user contribution to get it up to par.

    I am not sure if you are making your edits to a direct SVXLink module under ORP 2.0.0 or if you are using the dev 2.1.0 code with the new module framework. My initial thoughts for UI for a Rig Control module would be to have the modules settings page present a dropdown list for the rig model (pulled from executing a hamlib/rigctrl command to populate the list) then provide a drop down for various baud rates, and a drop down for available serial pins.

    From there we could create some dynamic fields to allow users enter mapping DTMF commands to Rigctrl functions to suite their needs and what their radio supports. We could of course pre populate it with some defaults.

    I would also need to build in some sort of precheck when going to the settings page to check to make sure that the Hamlib package is installed.

    Just some initial thoughts, but it would be a pretty cool module.

    73,
    Aaron – N3MBH / WRFV871

    OpenRepeater is offered free of charge. Find out how you can support us.

Viewing 10 posts - 11 through 20 (of 28 total)
  • The forum ‘Module Development’ is closed to new topics and replies.