From b799da29baeb9074bb35d041409cdb674104759f Mon Sep 17 00:00:00 2001 From: Craig McDaniel Date: Sun, 7 Dec 2025 17:12:59 -0600 Subject: [PATCH] Added auto frequency sensing script for 991a to run direwolf with HF, VHF or UHF config files automatically. --- ansible/playbooks/scanner/scanner.yml | 5 ++++ ansible/roles/scanner_ft991a/tasks/main.yml | 28 +++++++++++++++++-- .../templates/ft991a-direwolf-vhf.conf.j2 | 21 +++++++------- .../templates/ft991a-direwolf.service.j2 | 18 ++++++++++-- 4 files changed, 56 insertions(+), 16 deletions(-) diff --git a/ansible/playbooks/scanner/scanner.yml b/ansible/playbooks/scanner/scanner.yml index d08113b..11f5703 100644 --- a/ansible/playbooks/scanner/scanner.yml +++ b/ansible/playbooks/scanner/scanner.yml @@ -17,6 +17,11 @@ name: scanner_ft991a when: run_ft991a is defined and run_ft991a | bool + - name: Set up udev rules, rigctld and direwolf for Digirig digital sound card + ansible.builtin.import_role: + name: scanner_digirig + when: run_digirig is defined and run_digirig | bool + - name: Pat ansible.builtin.import_role: name: scanner_pat diff --git a/ansible/roles/scanner_ft991a/tasks/main.yml b/ansible/roles/scanner_ft991a/tasks/main.yml index 8042d16..11f8984 100644 --- a/ansible/roles/scanner_ft991a/tasks/main.yml +++ b/ansible/roles/scanner_ft991a/tasks/main.yml @@ -75,10 +75,32 @@ # chdir: /opt/busnet/direwolf/source/build # target: install -- name: Copy Direwolf config for Yaesu FT-991a +- name: Copy ft991a_monitor.py auto frequency sensing script + copy: + src: "templates/ft991a_monitor.py" + dest: "/opt/busnet/direwolf/ft991a_monitor.py" + owner: busnet + group: busnet + mode: "0755" + +- name: Copy Direwolf HF config for Yaesu FT-991a template: - src: "templates/ft991a-direwolf.conf.j2" - dest: "/opt/busnet/direwolf/config/ft991a.conf" + src: "templates/ft991a-direwolf-hf.conf.j2" + dest: "/opt/busnet/direwolf/config/ft991a-hf.conf" + owner: busnet + group: busnet + +- name: Copy Direwolf VHF config for Yaesu FT-991a + template: + src: "templates/ft991a-direwolf-vhf.conf.j2" + dest: "/opt/busnet/direwolf/config/ft991a-vhf.conf" + owner: busnet + group: busnet + +- name: Copy Direwolf UHF config for Yaesu FT-991a + template: + src: "templates/ft991a-direwolf-uhf.conf.j2" + dest: "/opt/busnet/direwolf/config/ft991a-uhf.conf" owner: busnet group: busnet diff --git a/ansible/roles/scanner_ft991a/templates/ft991a-direwolf-vhf.conf.j2 b/ansible/roles/scanner_ft991a/templates/ft991a-direwolf-vhf.conf.j2 index edd27d3..93504bb 100644 --- a/ansible/roles/scanner_ft991a/templates/ft991a-direwolf-vhf.conf.j2 +++ b/ansible/roles/scanner_ft991a/templates/ft991a-direwolf-vhf.conf.j2 @@ -1,7 +1,10 @@ # This file is managed by BusNet Ansible # # This is the Direwolf configuration for connecting Direwolf to the Yaesu FT-991a radio when it is -# plugged in via USB. +# plugged in via USB and tuned to an HF frequency. +# +# Note that only one direwolf will ever be running at the same time for this 991a radio, depending +# on what frequency it is tuned to. See /opt/busnet/direwolf/ft991a_monitor.py # # There us a udev rule which creates "/dev/radio/ft99a1-00" and "/dev/radio/ft991a-01" so that we # do not have to worry about what USB port or tty number is assigned when this radio is connected @@ -13,14 +16,12 @@ ADEVICE plughw:CODEC,0 # The custom udev rule makes this device available by name. PTT /dev/radio/ft991a-01 RTS -# Use rigctld that is running specifically for this FT-991a radio. -# The 2 means use the rigctld daemon that's already running. -# This doesn't work. It keys PTT but doesn't trasmit any audio. *shrug* -#PTT RIG 2 localhost:4000 +MYCALL K0BIT -MYCALL K0BIT-1 -KISSPORT 8001 -AGWPORT 8011 +MODEM 1200 -# This will start an APRS beacon -#PBEACON every=1 overlay=S symbol="bus" lat=29.958260914551104 long=-90.05442788530239 comment="I'm like testing APRS, man" via=WIDE1-1,WIDE2-1 \ No newline at end of file +# Enable FX.25 with fallback to regular AX.25 +FX25TX 1 + +KISSPORT 8005 +AGWPORT 8006 \ No newline at end of file diff --git a/ansible/roles/scanner_ft991a/templates/ft991a-direwolf.service.j2 b/ansible/roles/scanner_ft991a/templates/ft991a-direwolf.service.j2 index 2344c48..174d77c 100644 --- a/ansible/roles/scanner_ft991a/templates/ft991a-direwolf.service.j2 +++ b/ansible/roles/scanner_ft991a/templates/ft991a-direwolf.service.j2 @@ -7,15 +7,27 @@ # is disconnected. [Unit] -Description=Direwolf TNC for Yaesu FT-991a +Description=Direwolf TNC for Yaesu FT-991a Auto Frequency Sensing [Service] ExecStartPre=/bin/sleep 5 -ExecStart=/usr/local/bin/direwolf -t 0 -c /opt/busnet/direwolf/config/ft991a.conf + +# This no longer starts Direwolf directly. See below. +#ExecStart=/usr/local/bin/direwolf -t 0 -X 1 -c /opt/busnet/direwolf/config/ft991a.conf + +# This custom Python script connects to the rigctld daemon for the 991a and polls it every 5 seconds +# to determine what frequency it is set on. If set on HF frequencies, it runs direwolf with a HF +# config file for HF packet settings (300 baud). For VHF, it uses 1200 baud in a separate config file, +# and the same for UHF. +# +# This is automatic. All you have to do is switch the frequency on the 991a and this detects that and +# stops/starts Direwolf with the matching packet configuration. +ExecStart=/opt/busnet/direwolf/ft991a_monitor.py + Restart=on-failure RestartSec=5 User=busnet Group=busnet [Install] -WantedBy=multi-user.target \ No newline at end of file +WantedBy=multi-user.target