trx controll switch on off

14 posts / 0 new
Last post
ik4yaz
ik4yaz's picture
trx controll switch on off

hello Peter, I ask, is it possible in the trx control window to implement the On OFf command to make the rtx switch on or off remotely?
thanks from ik4yaz Fabrizio

oh1kh
trx controll switch on off

Hi!
Do you mean PTT on and off, or turn whole rig contol (hamlib) on and off ?

If you need PPT on/off read this message: https://cqrlog.com/node/1958
Your rig must support PTT on/off via hamlib command to use nc from command window.

echo T 1 | nc localhost 4532

will turn PTT on and

echo T 0 | nc localhost 4532

Will turn it off.
If you have internet connection, with dns-name from dyndns or similar, and incoming firewall open for port 4532 you can access rig with console command as remote:

echo T 1 | nc my.networkname.com 4532

How ever I do not recommend that. Better solution is to make VPN connection between your ham-PC and remote PC and use terminal command as:

echo T 1 | nc hampc_ip_address 4532

Same with every setting (cqrlog, wsjt-x, fldigi etc.) where localhost or 127.0.0.1 is used: It can be also any local IP address or dns-name. I E you have access from remote PC. too.

--
Saku
OH1KH

--
Saku
OH1KH

oh1kh
trx control switch with GUI

Hi!

If you want graphical buttons to drive PTT you can try this script.
You need to have yad installed.

Installing from console with
sudo apt-get install yad

--------copy to file ptt.sh----------clip----------

#!/bin/bash

rigaddr=localhost
rigport=4532

for (( ; ; ))
do
ptt=$(echo t | nc $rigaddr $rigport)
case $ptt in
    0) pttinfo="PTT is OFF";;
    1) pttinfo="PTT is ON";;
esac
    yad --form 	--title="PTT control" \
        --posx=700 \
        --posy=300 \
        --text="$pttinfo" \
        --button="PTT OFF":0 \
        --button="PTT ON":1 \
        --button=gtk-quit:2 \
        2>/dev/null
case $? in
    0) echo "T 0" |  nc $rigaddr $rigport
       ;;
    1) echo "T 1" |  nc $rigaddr $rigport   
       ;;
    2) exit
       ;;   
esac
done

----------------------------------clip------------------------

After saving use
chmod a+x ptt.sh
to allow executing to all users
Start with
./ptt.sh
from console

Bad side is that it always pops into the same place even when you drag it to some other place. How ever you can preset the place altering numbers of posx and posy.

--
Saku
OH1KH

--
Saku
OH1KH

ik4yaz
ik4yaz's picture
hi!

hi!
Saku thank you for your prompt intervention.
No I intend to turn off or turn on my ftdx 1200 radio via cat,
with Flrig I launch this command PS1; PS; PS1; and the radio turns on, with the command
PS0; PS; PS0 the radio turns off, I would need to turn on the radio via teamwiever after launching cqrlog, everything here.
73 de ik4yaz fabrizio

oh1kh
Pwr control

Ok!
Now I got it!

But no problem. Rigctld has commands:

0x87, set_powerstat 'Power Status'
Set power On/Off/Standby 'Power Status'.
0 = Power Off, 1 = Power On, 2 = Power Standby. Defined as a bitmask in rig.h.

0x88, get_powerstat
Get power On/Off/Standby 'Power Status' as in set_powerstat above.

So just change the script to this kind:

---------save as pwr.sh--------------clip-----------

#!/bin/bash

rigaddr=localhost
rigport=4532

for (( ; ; ))
do
pwr=$(echo -n -e \\x88 | nc $rigaddr $rigport)
case $pwr in
    0) pwrinfo="PWR is OFF";;
    1) pwrinfo="PWR is ON";;
    2) pwrinfo="PWR is STBY";;
esac
    yad --form 	--title="PWR control" \
        --posx=700 \
        --posy=300 \
        --text="$pwrinfo" \
        --button="PWR OFF":0 \
        --button="PWR ON":1 \
        --button="PWR STBY":2 \
        --button=gtk-quit:3 \
        2>/dev/null
case $? in
    0) echo -n -e '\x87'0 |  nc $rigaddr $rigport
       ;;
    1) echo -n -e '\x87'1 |  nc $rigaddr $rigport   
       ;;
    2) echo -n -e '\x87'2 |  nc $rigaddr $rigport   
       ;;
    3) exit
       ;;   
esac
done

----------------------clip--------------------------------

chmod a+x pwr.sh
to give execute rights for everyone
Run with (when being in directory where file exists)
./pwr.sh

I do not have rig to test, but I tested this with -m 1 (model Dummy) and it seems to work ok.
Test it. Is this what you want?

--
Saku
OH1KH

--
Saku
OH1KH

ik4yaz
ik4yaz's picture
ok Saku, it works !!! now I

ok Saku, it works !!! now I ask you how can I do to ensure that when I launch cqrlog I also open this new window of control power ??
sorry but I'm not so good with linux.
Thanks for your time.
73 Fabrizio ik4yaz.

oh1kh
pwr.switch

Hi!
Ok fine.
I'm afraid cqrlog does not have "Execute after program start" option. At least I have never noticed that :)

Do you need them both to start together?

If you just make a desktop(or start menu) icon for pwr.sh script and start it manually after cqrlog.
I do not know what window manager you are using and start menu, or desktop icon is created differently on each window manager.
Use Google with the name of your linux distribution and words:
create dekstop icon start menu
to get hep for creating desktop icon or start menu item.

If you want just one startup (but you need to make menu entry or icon also for this) you could try to make script file named
start.sh

#!/bin/bash
cd ~
/usr/bin/cqrlog &
#wait for cqrlog to start rigctld
sleep 15
./pwr.sh &
exit

Again make it executable for all:
chmod a+x start.sh

Assume your pwr.sh is in your home directory /home/username

Start this start.sh from console with command:
./start.sh && exit
("&& exit" closes command window and this works (tested) in my Fedora 26/LXDE leaving cqrlog and pwr.sh still running)

Or put that line into your start menu or icon execute path

--
Saku
OH1KH

--
Saku
OH1KH

PA1SBM
PA1SBM's picture
I have to say, "poweroff trx

I have to say, "poweroff trx on program exit" would be an awesome feature.
WAY back when i user HRD, i loved the fact that when i closed the program, also the Tranceiver turned off...
This would be a nice to have feature.

oh1kh
I have to say, "poweroff trx

Hi!

Maybe it would be better to make edit boxes to preferences/program for binary/script paths "Run after program started" and "Run before program close".
That way anything could be done at the point program is fully running and when program is still up, put starting to close.
Setting rig power off is just one liner with nc , but rigctld must still be running I.E. just before cqrlog closes it.

--
Saku
OH1KH

--
Saku
OH1KH

ik4yaz
ik4yaz's picture
Fine Saku, everything works

Fine Saku, everything works perfectly, now it would be nice to have this command in the frame control rig of cqrlog, maybe in an upcoming release :)

73 thank you very much.
ik4yaz Fabrizio

oh1kh
poweroff trx

Hi!

I have done test version that have start and stop scripts and pwr-button in TRXcontol.
It has also some other bug fixes.

Source code is in https://github.com/OH1KH/cqrlog-devel and x86_64 test binary at http://www.saunalahti.fi/~sakny/bin/cqrlog2/

Read the end of file README.OH1KH

Comments?

--
Saku
OH1KH

--
Saku
OH1KH

ik4yaz
ik4yaz's picture
re

HI! Saku, I'm sorry but I do not know English well, and I'm not programming expert, I saw the file you indicated, but I have difficulty understanding, however, the work done before already works well, I use ubntu mate, I have created a pitcher on the desk as you indicated to me and everything works well, my only comment, many thanks for your good work and all the staff.
73 ik4yaz

oh1kh
poweroff trx

If your CPU is 64bit then copy ZIP from my "saunalahti.fi" web page.
unzip to /tmp
Save your current cqrlog file with:
sudo cp /usr/bin/cqrlog /usr/bin/cqrlog.old

Copy unzipped file cqrlog from /tmp:
sudo /tmp/cqrlog /usr/bin/cqrlog

Start normally. NewQso window, bottom, right text: 2.2.0(104)

You should have now "PWR" button at "TRXcontorl"-window. Works it ok?

You can make file ~/.config/cqrlog/start.sh and file ~/.config/cqrlog/stop.sh and they are run at cqrlog start and close.

You can do what ever you like with start.sh and stop.sh. Here are examples to switch rig ON and OFF (or standby).

---------start.sh-----------------
#!/bin/bash
echo -n -e '\x87'1 | nc localhost 4532
exit
------------------------------------

---------stop.sh-----------------
#!/bin/bash

#turn rig power off
echo -n -e '\x87'0 | nc localhost 4532

#turn rig power standby
# remove # from next line and put # in front of first "echo"-line
#echo -n -e '\x87'2 | nc localhost 4532

exit
------------------------------------

Remember to set executable bit for both files:
chmod a+x ~/.config/cqrlog/start.sh
chmod a+x ~/.config/cqrlog/stop.sh

If you want old version of cqrlog back:
sudo cp /usr/bin/cqrlog.old /usr/bin/cqrlog

--
Saku
OH1KH

--
Saku
OH1KH

ik4yaz
ik4yaz's picture
re

ok Saku, I'm sorry but my SO is 32 bit. my pc is now obsolete :)
I thank you for all the information you are giving me, do not worry, for now the first solution you gave me works very well.
73 k4yaz