开云体育

ctrl + shift + ? for shortcuts
© 2025 Groups.io

Channel changing script


 

开云体育

I cobbled together a simple script to change frequencies faster on the SHARI pi hat using DTMF.

?

I had a need to be able to change it on the fly as some areas I frequent have interference and remoting into it and stepping through the SA818-prog script can be a pain.

?

This is python2 to support hamvoip.

?

In rpt.conf under functions you can add:

?

C01=cmd,/etc/asterisk/local/channel.sh --channel 1

C02=cmd,/etc/asterisk/local/channel.sh --channel 2

C03=cmd,/etc/asterisk/local/channel.sh --channel 3

?

I have it set the filters off and pre/deemph on. Volume set to 7. Reverse burst on.

?

Channel format is as follows:

spacing,FreqTx,FreqRx,tx_ctcss,squelch,rx_ctcss

?

So for 438.2500 simplex with a tone of 123.0(encoding and decoding), squelch set at 4, and 25khz channel spacing:

1: "AT+DMOSETGROUP=1,438.2500,438.2500,0018,4,0018\r\n",

?

Tone chart:

?? ?????"0": "0000"

??????? "67.0": "0001"

??????? "71.0": "0002"

??????? "74.4": "0003"

??????? "77.0": "0004"

??????? "79.7": "0005"

??????? "82.5": "0006"

??????? "85.4": "0007"

??????? "88.5": "0008"

??????? "91.5": "0009"

??????? "94.8": "0010"

??????? "97.4": "0011"

??????? "100.0": "0012"

??????? "103.5": "0013"

?

??????? "107.2": "0014"

??????? "110.9": "0015”

??????? "114.8": "0016"

??????? "118.8": "0017"

??????? "123.0": "0018"

??????? "127.3": "0019"

??????? "131.8": "0020"

??????? "136.5": "0021"

??????? "141.3": "0022"

??????? "146.2": "0023"

??????? "151.4": "0024"

??????? "156.7": "0025"

??????? "162.2": "0026"

??????? "167.9": "0027"

??????? "173.8": "0028"

??????? "179.9": "0029"

??????? "186.2": "0030"

??????? "192.8": "0031"

??????? "203.5": "0032"

??????? "210.7": "0033"

??????? "218.1": "0034"

??????? "225.7": "0035"

??????? "233.6": "0036"

??????? "241.8": "0037"

??????? "250.3": "0038"

?

?

?

?

?

#!/usr/bin/python2

?

import argparse

import time

import serial

?

def main():

??? parser = argparse.ArgumentParser(description='Send text string through serial port')

??? parser.add_argument('--channel', type=int, help='Channel number (1-3 for ham)')

??? args = parser.parse_args()

?

??? channel_map = {

??????? 1: "AT+DMOSETGROUP=1,438.2500,438.2500,0018,4,0018\r\n",

??????? 2: "AT+DMOSETGROUP=1,438.5000,438.5000,0018,4,0018\r\n",

??????? 3: "AT+DMOSETGROUP=1,438.7500,438.7500,0018,4,0018\r\n",

?

??? }

?

??? if args.channel not in channel_map:

??????? raise ValueError("Invalid channel number. Must be either 1 to 3.")

??? text = channel_map[args.channel]

?

??? ser = serial.Serial('/dev/ttyAMA0', baudrate=9600, timeout=1)

??? ser.write(text.encode())

??? ser.write("AT+DMOSETVOLUME=7\r\n".encode())

??? time.sleep(1)

??? ser.write("AT+SETTAIL=1\r\n".encode())

??? time.sleep(1)

??? ser.write("AT+SETFILTER=0,1,1\r\n".encode())

??? ser.close()

?

if __name__ == '__main__':

??? main()

?

?

?

Michael N5ZR

?


 

Thanks for sharing this cool idea. This begs the question in my mind whether the SA818-prog script could be adapted to have an "unattended" mode, so that it could be reused for this type of programmatic call.

Just a note, if you already have the radio programmed once, you probably don't need to call SETVOLUME, SETTAIL, and SETFILTER every time, since that data is not changing.


 

开云体育

True, but I constantly fiddle so I left that in there.

?

-Michael

?

From: [email protected] <[email protected]> On Behalf Of KI5KQB
Sent: Monday, February 13, 2023 8:09 PM
To: [email protected]
Subject: Re: [SHARI] Channel changing script

?

Thanks for sharing this cool idea. This begs the question in my mind whether the SA818-prog script could be adapted to have an "unattended" mode, so that it could be reused for this type of programmatic call.

Just a note, if you already have the radio programmed once, you probably don't need to call SETVOLUME, SETTAIL, and SETFILTER every time, since that data is not changing.


 

SA818-prog has a command-line interface that is not interactive (unattended). It's called?818cli-prog in /user/local/sbin but you should be cautioned that if an error is sent it might be trouble. It is an interesting idea though. I could easily imagine a script that might look like:

shari-prog 446.0500 446.0500 754N 6 754N
which would then send
818cli-prog -d /dev/ttyUSB0 -m 0 -g 446.0500,446.0500,754N,6,754N -v 4 -f 0,0,0

or if you wished "memories" perhaps
shari-prog 1
which would then send
818cli-prog -d /dev/ttyUSB0 -m 0 -g 446.0500,446.0500,754N,6,754N -v 4 -f 0,0,0
producing 446.0500 DCS 754N
(memory 1)

or

shari-prog 2
which would then send
818cli-prog -d /dev/ttyUSB0 -m 0 -g 446.0575,446.0575,754N,6,754N -v 4 -f 0,0,0
producing 446.0575 DCS 754N
(memory 2)

I'll try to whip this up and see if it works

-Pres W2PW


 

Any progress with seeing if the other solution works, wr2uhf? (Can you add your name to this group so we can see what it is rather than having to go to QRZ to find it? It's easy to do. Thanks.)
--
<X><
73 75 Mark? VE3JMR | VE3MR
Port Colborne, Ontario,?CANADA
Allstar Node# 531320?
?Echolink Node# 736666
LIFE has an EXPIRY date. No Trees were harmed in creating this message although many electrons were inconvenienced.


 

Michael;

I'm not a programmer but I can get through some things. I'm missing something with your instructions. 1. I cannot find "channel.sh" -- channel1 or --channel2 or --channel3 in /etc/asterisk/local nor can I find channel.sh? 2. What is the script called I have to make and put in /usr/bin/ ?? 3. Nothing in the script seems to point back to channel.sh
I'm lost here.

<X><
73 75 Mark? VE3JMR | VE3MR
Port Colborne, Ontario,?CANADA
Allstar Node# 531320?
?Echolink Node# 736666
LIFE has an EXPIRY date. No Trees were harmed in creating this message although many electrons were inconvenienced.


 

开云体育

channel.sh is the script that I pasted in the email.

?

You would need to create it and modify it with your desired channels and settings.

?

-Michael

?

From: [email protected] <[email protected]> On Behalf Of Mark VE3JMR
Sent: Monday, March 6, 2023 12:28 AM
To: [email protected]
Subject: Re: [SHARI] Channel changing script

?

Michael;

I'm not a programmer but I can get through some things. I'm missing something with your instructions. 1. I cannot find "channel.sh" -- channel1 or --channel2 or --channel3 in /etc/asterisk/local nor can I find channel.sh? 2. What is the script called I have to make and put in /usr/bin/ ?? 3. Nothing in the script seems to point back to channel.sh
I'm lost here.

<X><
73 75 Mark? VE3JMR | VE3MR

Port Colborne, Ontario,?CANADA
Allstar Node# 531320??Echolink Node# 736666

LIFE has an EXPIRY date. No Trees were harmed in creating this message although many electrons were inconvenienced.


 

I put his code in a file for you.