mercury - Initial refactoring for the Mercury plug-and-play support in EmComm Tools. Moved to a model where ARQ, broadcast, and user-defined mode are the only options

This commit is contained in:
thetechprepper
2026-08-26 10:11:40 -07:00
parent 77fa9e7c0d
commit 486c284fe4
4 changed files with 502 additions and 37 deletions
+25 -37
View File
@@ -2,7 +2,7 @@
#
# Author : Gaston Gonzalez
# Date : 16 July 2026
# Updated : 12 August 2026
# Updated : 26 August 2026
# Purpose : Wrapper script for starting Mercury with PnP support
#
# Preconditions:
@@ -10,26 +10,16 @@
#
# Postconditions:
# 1. Mercury started with sane defaults
#
# Notes:
#
# Mercury supports many modulation types and configuration options. To
# keep usage simple, only three modulation settings have been configured
# that map to a combination of reliability and speed for most general
# purpose applications.
#
# The DATAC17 and QAM16C2 modes are documented on the RETICULUM.md
# documenation on the mercury GitHub project, but are not yet supported
# in version 1.9.9. Disabling these options from now.
ET_MERCURY_HOME="${HOME}/.local/share/emcomm-tools/mercury"
ET_MERCURY_LOG="${ET_MERCURY_HOME}/session.log"
usage() {
echo "usage: $(basename $0) <mode>"
echo " <mode>"
echo " reliability - Max reliability (Slower Speed) [DATAC1]"
echo " balanced - Balanced (Reliability and Speed) [DATAC17]"
echo " fast - Fast (Low Reliability) [QAM16C2]"
echo " winlink - Used for Winlink [DATAC3]"
echo " arq - Automatic Retry Request mode (Winlink)"
echo " broadcast - Broadcast mode (Reticulum)"
echo " custom - User defined mode for custom settings"
}
if [[ $# -ne 1 ]]; then
@@ -41,21 +31,17 @@ fi
MODE="$1"
case "${MODE}" in
reliability)
MODE_INDEX="0"
arq)
ET_MERCURY_INI="${ET_MERCURY_HOME}/mercury.arq.ini"
OPTS=""
;;
winlink)
MODE_INDEX="1"
broadcast)
ET_MERCURY_INI="${ET_MERCURY_HOME}/mercury.broadcast.ini"
OPTS="-m 0 -b 8100"
;;
balanced)
MODE_INDEX="9"
et-log "Mode not yet supported."
exit 1
;;
fast)
MODE_INDEX="10"
et-log "Mode not yet supported."
exit 1
custom)
ET_MERCURY_INI="${ET_MERCURY_HOME}/mercury.custom.ini"
OPTS=""
;;
*)
et-log "Can't started Mercury modem. Mode not supported."
@@ -64,8 +50,15 @@ case "${MODE}" in
;;
esac
[[ -z ${ET_LOG_DIR} ]] && ET_LOG_DIR="${HOME}/.local/share/emcomm-tools"
[[ ! -e ${ET_LOG_DIR} ]] && mkdir -p ${ET_LOG_DIR}
if [[ ! -e ${ET_MERCURY_HOME} ]]; then
et-log "ET_MERCURY_HOME does not exist at ${ET_MERCURY_HOME}. Exiting"
exit 1
fi
if [[ ! -e ${ET_MERCURY_INI} ]]; then
et-log "Mercury configuration file not found at ${ET_MERCURY_INI}. Exiting"
exit 1
fi
start() {
update_config
@@ -80,12 +73,7 @@ start() {
ALSA_DEVICE=$(et-system-info et-audio-card)
# Mercury implemented support for rigctld oddly. Even though the rigctld IP and port are
# specified with the -A option, the code will not trigger the PTT unless a rig model
# is specified. We can specify model '2' (network mode) with the -R option to ensure that
# the PTT conditional code blocks for hamlib are called. This explains why earlier tests
# only worked with the DigiRig Lite as it has an internal VOX circuit.
CMD="mercury -m ${MODE_INDEX} -i plughw:${ALSA_DEVICE} -o plughw:${ALSA_DEVICE} -A 127.0.0.1:4532 -R 2"
CMD="mercury -C ${ET_MERCURY_INI} -L ${ET_MERCURY_LOG} -i plughw:${ALSA_DEVICE} -o plughw:${ALSA_DEVICE} ${OPTS}"
et-log "Starting Mercury in mode ${MODE} with: '${CMD}'"
echo