[Hamlib-commits] Hamlib -- Ham radio control libraries branch master updated. e38c69602bdfadf0203ac
Library to control radio transceivers and receivers
                
                Brought to you by:
                
                    n0nb
                    
                
            
            
        
        
        
    | 
      
      
      From: Michael B. <mdb...@us...> - 2021-01-25 17:20:49
      
     | 
| This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Hamlib -- Ham radio control libraries".
The branch, master has been updated
       via  e38c69602bdfadf0203ac6788f2e8787a3397c87 (commit)
       via  9322479117388eb7688992f420760ddf33c03aa7 (commit)
       via  14eb9af7fe21470b2cff03a3e66589ce4c5f4788 (commit)
       via  ed5728c321a39905db7006f122c601d37ee13c06 (commit)
       via  e6fa200152fb926ec8d6f76dd28eef0ab0303fe3 (commit)
      from  11be167354c87f6c2914a70d50f947486c332131 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit e38c69602bdfadf0203ac6788f2e8787a3397c87
Author: Michael Black W9MDB <mdb...@ya...>
Date:   Mon Jan 25 11:20:28 2021 -0600
    astyle k3.c
diff --git a/rigs/kenwood/k3.c b/rigs/kenwood/k3.c
index 1691f7b0..dc37c67d 100644
--- a/rigs/kenwood/k3.c
+++ b/rigs/kenwood/k3.c
@@ -2129,6 +2129,7 @@ int kx3_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
         val->f = pwr;
         return retval;
     }
+
     case RIG_LEVEL_RFPOWER_METER_WATTS:
     {
         struct kenwood_priv_data *priv = rig->state.priv;
commit 9322479117388eb7688992f420760ddf33c03aa7
Author: Michael Black W9MDB <mdb...@ya...>
Date:   Mon Jan 25 11:19:32 2021 -0600
    Fix kx3/kx2 RFPOWER_METER_WATTS and buffer size
diff --git a/rigs/kenwood/k3.c b/rigs/kenwood/k3.c
index abe1f491..1691f7b0 100644
--- a/rigs/kenwood/k3.c
+++ b/rigs/kenwood/k3.c
@@ -181,7 +181,7 @@ const struct rig_caps k3_caps =
     RIG_MODEL(RIG_MODEL_K3),
     .model_name =       "K3",
     .mfg_name =     "Elecraft",
-    .version =      BACKEND_VER ".2",
+    .version =      BACKEND_VER ".3",
     .copyright =        "LGPL",
     .status =       RIG_STATUS_STABLE,
     .rig_type =     RIG_TYPE_TRANSCEIVER,
@@ -1584,7 +1584,7 @@ static int k3_get_maxpower(RIG *rig)
 {
     int retval;
     int maxpower = 12; // K3 default power level
-    char levelbuf[16];
+    char levelbuf[KENWOOD_MAX_BUF_LEN];
     struct kenwood_priv_data *priv = rig->state.priv;
 
     // default range is 0-12 if there is no KPA3 installed
@@ -2129,6 +2129,23 @@ int kx3_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
         val->f = pwr;
         return retval;
     }
+    case RIG_LEVEL_RFPOWER_METER_WATTS:
+    {
+        struct kenwood_priv_data *priv = rig->state.priv;
+        char levelbuf[KENWOOD_MAX_BUF_LEN];
+        int pwr;
+
+        retval = kenwood_safe_transaction(rig, "PO", levelbuf, sizeof(levelbuf), 5);
+
+        if (retval != RIG_OK)
+        {
+            return retval;
+        }
+
+        sscanf(levelbuf + 2, "%d", &pwr);
+        val->f = priv->has_kpa100 ? pwr : pwr / 10.0;
+        return retval;
+    }
     }
 
     return k3_get_level(rig, vfo, level, val);
commit 14eb9af7fe21470b2cff03a3e66589ce4c5f4788
Merge: 11be1673 ed5728c3
Author: Michael Black <mdb...@ya...>
Date:   Mon Jan 25 11:15:17 2021 -0600
    Merge pull request #518 from code-posse/master
    
    SatEL rotator support
commit ed5728c321a39905db7006f122c601d37ee13c06
Author: Joshua Lynch <jo...@co...>
Date:   Sun Jan 24 23:54:07 2021 -0600
    factored io functions out.
    improve reliability...i hope.
diff --git a/rotators/satel/satel.c b/rotators/satel/satel.c
index 1a9aa0e2..6a0e12db 100644
--- a/rotators/satel/satel.c
+++ b/rotators/satel/satel.c
@@ -1,5 +1,5 @@
 /*
- *  Hamlib Sat/El backend - main file
+ *  Hamlib SatEL backend - main file
  *  Copyright (c) 2021 Joshua Lynch
  *
  *
@@ -19,6 +19,7 @@
  *
  */
 
+#include "hamlib/rig.h"
 #include <strings.h>
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -32,6 +33,7 @@
 #include <ctype.h>
 #include <stddef.h>
 #include <stdint.h>
+#include <stdbool.h>
 
 #include "hamlib/rotator.h"
 #include "serial.h"
@@ -41,14 +43,132 @@
 #include "satel.h"
 
 
-static int satel_rot_open(ROT *rot)
+/**
+ * Protocol documentation.
+ *
+ * Apparently, the system is modeled after this one:
+ * “An Inexpensive Az-El Rotator System”
+ *   "Dec, 1999, QST article by Jim Koehler, VE5FP
+ *
+ * '?' - returns 'SatEL\r\n'. a good test to see if there's
+ *       connectivity.
+ *
+ * 'g' - enable motion. nothing happens without this enabled.
+ *
+ * 'z' - display rotator status. contains current Az/El among other
+ *       things. here's an example:
+ *
+ *       Motion ENABLED
+ *       Mode 0 - azimuth break at NORTH
+ *       Time: 2001/00/00 00:00:07
+ *       Azimuth = 000     Absolute = 000
+ *       Elevation = 000
+ *
+ *       Number of stored positions: 00
+ *
+ *
+ * '*' - reset the rotator controller.
+ *
+ * 'pAZ EL\r\n' - tell the rotator where to point where AZ is the
+ *                integer azimuth and EL is the integer
+ *                elevation. e.g. 'p010 045\n'. the controller will
+ *                report the current pointing status after the
+ *                operation has completed.
+ *
+ * NOTE: The SatEL system changed a few commands as described in the
+ * user's manual. They are not used here. You can find the manual for
+ * this rotator here:
+ *
+ * http://www.codeposse.com/~jlynch/SatEL%20Az-EL.pdf
+ *
+ */
+
+/**
+ * Idiosyncrasies
+ *
+ * - the controller does zero input checking. you can put it into an
+ *   incredibly bad state very easily.
+ *
+ * - the controller doesn't accept any data whilst moving the
+ *   rotators. In fact, you can put the controller into a bad state on
+ *   occasion if you try and send it commands while its slewing the
+ *   rotators. this means we have a really long read timeout so we can
+ *   wait for the rotators to slew around before accepting any more
+ *   commands.
+ *
+ */
+
+
+
+#define BUF_SIZE 256
+
+
+typedef struct satel_stat satel_stat_t;
+struct satel_stat
+{
+    bool   motion_enabled;
+    int    mode;
+    time_t time;
+    int    absolute;
+    int    az;
+    int    el;
+};
+
+
+static int satel_read_status(ROT *rot, satel_stat_t *stat)
 {
-    #define RES_BUF_SIZE 256
-    char buf[RES_BUF_SIZE];
+    char resbuf[BUF_SIZE];
+    char *p;
     int ret;
     struct rot_state *rs;
 
 
+    rs = &rot->state;
+
+    
+    // XXX skip for now
+    for (int i = 0; i < 3; i++)
+    {
+        ret = read_string(&rs->rotport, resbuf, BUF_SIZE, "\n", 1);
+        if (ret < 0)
+            return ret;
+    }
+    
+    // read azimuth line
+    ret = read_string(&rs->rotport, resbuf, BUF_SIZE, "\n", 1);
+    if (ret < 0)
+        return ret;
+
+    p = resbuf + 10;
+    p[3] = '\0';
+    stat->az = (int)strtof(p, NULL);
+    
+    // read elevation line
+    ret = read_string(&rs->rotport, resbuf, BUF_SIZE, "\n", 1);
+    if (ret < 0)
+        return ret;
+
+    p = resbuf + 12;
+    p[3] = '\0';
+    stat->el = (int)strtof(p, NULL);
+    
+    // XXX skip for now
+    for (int i = 0; i < 2; i++)
+    {
+        ret = read_string(&rs->rotport, resbuf, BUF_SIZE, "\n", 1);
+        if (ret < 0)
+            return ret;
+    }
+
+    return RIG_OK;
+}
+
+
+static int satel_cmd(ROT *rot, char *cmd, int cmdlen, char *res, int reslen)
+{
+    int ret;
+    struct rot_state *rs;
+
     
     rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
 
@@ -57,136 +177,123 @@ static int satel_rot_open(ROT *rot)
 
     rig_flush(&rs->rotport);
 
-    // check if we're connected to the rotator
-    ret = write_block(&rs->rotport, "?", 1);
+    ret = write_block(&rs->rotport, cmd, cmdlen);
     if (ret != RIG_OK)
         return ret;
 
-    ret = read_string(&rs->rotport, buf, RES_BUF_SIZE, "\n", 1);
-    if (ret < 0)
+    if (reslen > 0 && res != NULL)
+    {
+        ret = read_string(&rs->rotport, res, reslen, "\n", 1);
+        if (ret < 0)
+            return ret;
+    }
+    
+
+    return RIG_OK;
+}
+
+
+static int satel_rot_open(ROT *rot)
+{
+    char resbuf[BUF_SIZE];
+    int ret;
+
+    
+    
+    rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
+
+
+    // are we connected?
+    ret = satel_cmd(rot, "?", 1, resbuf, BUF_SIZE);
+    if (ret != RIG_OK)
         return ret;
 
-    ret = strncasecmp("SatEL", buf, 5); 
+    ret = strncasecmp("SatEL", resbuf, 5); 
     if (ret != 0)
-        return RIG_EIO;
+        return -RIG_EIO;
 
-    // yep, now enable motion
-    ret = write_block(&rs->rotport, "g", 1);
+    // yep, reset system
+    ret = satel_cmd(rot, "*", 1, NULL, 0);
+    if (ret != RIG_OK)
+        return ret;
+
+    // enable motion
+    ret = satel_cmd(rot, "g", 1, NULL, 0);
     if (ret != RIG_OK)
         return ret;
 
-    
     return RIG_OK;
 }
 
+
 static int satel_rot_set_position(ROT *rot, azimuth_t az, elevation_t el)
 {
-#define BUF_CMD_SIZE 20
-    char buf[BUF_CMD_SIZE];
-    struct rot_state *rs;
+    char cmdbuf[BUF_SIZE];
+    int ret;
+    satel_stat_t stat;
 
     
     rig_debug(RIG_DEBUG_VERBOSE, "%s called: %.2f %.2f\n", __func__,
               az, el);
 
     
-    rs = &rot->state;
+    snprintf(cmdbuf, BUF_SIZE, "p%d %d\r\n", (int)az, (int)el);
+    ret = satel_cmd(rot, cmdbuf, strlen(cmdbuf), NULL, 0);
+    if (ret != RIG_OK)
+        return ret;
 
-    rig_flush(&rs->rotport);
+    // wait-for, read and discard the status message
+    ret = satel_read_status(rot, &stat);
+    if (ret < 0)
+        return ret;
+    
 
-    snprintf(buf, BUF_CMD_SIZE, "p%03d %03d\r\n", (int)az, (int)el);
-    return write_block(&rs->rotport, buf, strlen(buf));
+    return RIG_OK;
 }
 
+
 static int satel_rot_get_position(ROT *rot, azimuth_t *az, elevation_t *el)
 {
-    #define RES_BUF_SIZE 256
-    char buf[RES_BUF_SIZE];
-    char *p;
     int ret;
-    struct rot_state *rs;
-
+    satel_stat_t stat;
 
     
     rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
 
     
-    rs = &rot->state;
-
-    rig_flush(&rs->rotport);
-    
-    ret = write_block(&rs->rotport, "z", 1);
+    ret = satel_cmd(rot, "z", 1, NULL, 0);
     if (ret != RIG_OK)
         return ret;
 
-
-    // skip header information
-    for (int i = 0; i < 3; i++)
-    {
-        ret = read_string(&rs->rotport, buf, RES_BUF_SIZE, "\n", 1);
-        if (ret < 0)
-            return ret;
-    }
-
-    
-    // read azimuth line
-    ret = read_string(&rs->rotport, buf, RES_BUF_SIZE, "\n", 1);
+    ret = satel_read_status(rot, &stat);
     if (ret < 0)
         return ret;
 
-    p = buf + 10;
-    p[3] = '\0';
-    *az = strtof(p, NULL);
-
-    rig_debug(RIG_DEBUG_VERBOSE, "AZIMUTH %f[%s]", *az, p);
-    
-    
-    // read elevation line
-    ret = read_string(&rs->rotport, buf, RES_BUF_SIZE, "\n", 1);
-    if (ret < 0)
-        return ret;
-
-    p = buf + 12;
-    p[3] = '\0';
-    *el = strtof(p, NULL);
+    *az = stat.az;
+    *el = stat.el;
 
-    rig_debug(RIG_DEBUG_VERBOSE, "ELEVATION %f[%s]", *el, p);
     
-    // skip trailer information
-    for (int i = 0; i < 2; i++)
-    {
-        ret = read_string(&rs->rotport, buf, RES_BUF_SIZE, "\n", 1);
-        if (ret < 0)
-            return ret;
-    }
-    
-
     return RIG_OK;
 }
 
 
 static int satel_rot_stop(ROT *rot)
 {
-    struct rot_state *rs;
-
-    
     rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
 
-    
-    rs = &rot->state;
-
-    rig_flush(&rs->rotport);
-    
-    return write_block(&rs->rotport, "*", 1);
+    // send reset command
+    return satel_cmd(rot, "*", 1, NULL, 0);
 }
 
+
 static const char *satel_rot_get_info(ROT *rot)
 {
     rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
 
-    return "Satel rotator";
+    return "SatEL rotator";
 }
 
+
 /*
  * Satel rotator capabilities.
  */
@@ -206,9 +313,9 @@ const struct rot_caps satel_rot_caps =
     .serial_stop_bits = 1,
     .serial_parity    = RIG_PARITY_NONE,
     .serial_handshake = RIG_HANDSHAKE_NONE,
-    .write_delay      = 250,
+    .write_delay      = 0,
     .post_write_delay = 0,
-    .timeout          = 1000,
+    .timeout          = 60000,
     .retry            = 0,
     .min_az           = 0.,
     .max_az           = 360.,
diff --git a/rotators/satel/satel.h b/rotators/satel/satel.h
index 8f5dfd93..402f234b 100644
--- a/rotators/satel/satel.h
+++ b/rotators/satel/satel.h
@@ -1,5 +1,5 @@
 /*
- *  Hamlib Sat/El backend - main header
+ *  Hamlib SatEL backend - main header
  *  Copyright (c) 2021 Joshua Lynch
  *
  *
commit e6fa200152fb926ec8d6f76dd28eef0ab0303fe3
Author: Joshua Lynch <jo...@co...>
Date:   Sat Jan 23 23:26:01 2021 -0600
    initial SatEL rotator support
diff --git a/configure.ac b/configure.ac
index cea90ff5..3c4a6ee0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -52,7 +52,7 @@ dnl Beware of duplication should a backend directory include both rig and
 dnl rotor definitions, e.g. "dummy".  Optional backends will not be listed
 dnl here but will be added later, e.g. "winradio".
 RIG_BACKEND_LIST="rigs/adat rigs/alinco rigs/aor rigs/barrett rigs/dorji rigs/drake rigs/dummy rigs/elad rigs/flexradio rigs/icom rigs/icmarine rigs/jrc rigs/kachina rigs/kenwood rigs/kit rigs/lowe rigs/pcr rigs/prm80 rigs/racal rigs/rft rigs/rs rigs/skanti rigs/tapr rigs/tentec rigs/tuner rigs/uniden rigs/winradio rigs/wj rigs/yaesu"
-ROT_BACKEND_LIST="rotators/amsat rotators/ars rotators/celestron rotators/cnctrk rotators/easycomm rotators/ether6 rotators/fodtrack rotators/gs232a rotators/heathkit rotators/m2 rotators/meade rotators/rotorez rotators/sartek rotators/spid rotators/ts7400 rotators/prosistel rotators/ioptron"
+ROT_BACKEND_LIST="rotators/amsat rotators/ars rotators/celestron rotators/cnctrk rotators/easycomm rotators/ether6 rotators/fodtrack rotators/gs232a rotators/heathkit rotators/m2 rotators/meade rotators/rotorez rotators/sartek rotators/spid rotators/ts7400 rotators/prosistel rotators/ioptron rotators/satel"
 # Amplifiers are all in the amplifiers directory
 AMP_BACKEND_LIST="amplifiers/elecraft"
 
@@ -842,6 +842,7 @@ rotators/sartek/Makefile
 rotators/spid/Makefile
 rotators/ts7400/Makefile
 rotators/indi/Makefile
+rotators/satel/Makefile
 rigs/adat/Makefile
 rigs/alinco/Makefile
 rigs/aor/Makefile
diff --git a/include/hamlib/rotlist.h b/include/hamlib/rotlist.h
index bab32d20..29de6eba 100644
--- a/include/hamlib/rotlist.h
+++ b/include/hamlib/rotlist.h
@@ -491,6 +491,20 @@
 #define ROT_MODEL_INDI ROT_MAKE_MODEL(ROT_INDI, 1)
 
 
+/**
+ *  \def ROT_MODEL_SATEL
+ *  \brief A macro that returns the model number of the SatEL backend.
+ *
+ *  The SatEL backend can be used with rotators that support the VE5FP
+ *  interface.
+ */
+//! @cond Doxygen_Suppress
+#define ROT_SATEL 21
+#define ROT_BACKEND_SATEL "satel"
+//! @endcond
+#define ROT_MODEL_SATEL ROT_MAKE_MODEL(ROT_SATEL, 1)
+
+
 
 
 /**
diff --git a/rotators/satel/Makefile.am b/rotators/satel/Makefile.am
new file mode 100644
index 00000000..920baa1c
--- /dev/null
+++ b/rotators/satel/Makefile.am
@@ -0,0 +1,6 @@
+SATELSRC = satel.c satel.h
+
+noinst_LTLIBRARIES = libhamlib-satel.la
+libhamlib_satel_la_SOURCES = $(SATELSRC)
+
+EXTRA_DIST = Android.mk
diff --git a/rotators/satel/satel.c b/rotators/satel/satel.c
new file mode 100644
index 00000000..1a9aa0e2
--- /dev/null
+++ b/rotators/satel/satel.c
@@ -0,0 +1,232 @@
+/*
+ *  Hamlib Sat/El backend - main file
+ *  Copyright (c) 2021 Joshua Lynch
+ *
+ *
+ *   This library is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU Lesser General Public
+ *   License as published by the Free Software Foundation; either
+ *   version 2.1 of the License, or (at your option) any later version.
+ *
+ *   This library is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *   Lesser General Public License for more details.
+ *
+ *   You should have received a copy of the GNU Lesser General Public
+ *   License along with this library; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ */
+
+#include <strings.h>
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <math.h>
+#include <ctype.h>
+#include <stddef.h>
+#include <stdint.h>
+
+#include "hamlib/rotator.h"
+#include "serial.h"
+#include "misc.h"
+#include "register.h"
+
+#include "satel.h"
+
+
+static int satel_rot_open(ROT *rot)
+{
+    #define RES_BUF_SIZE 256
+    char buf[RES_BUF_SIZE];
+    int ret;
+    struct rot_state *rs;
+
+
+    
+    rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
+
+
+    rs = &rot->state;
+
+    rig_flush(&rs->rotport);
+
+    // check if we're connected to the rotator
+    ret = write_block(&rs->rotport, "?", 1);
+    if (ret != RIG_OK)
+        return ret;
+
+    ret = read_string(&rs->rotport, buf, RES_BUF_SIZE, "\n", 1);
+    if (ret < 0)
+        return ret;
+
+    ret = strncasecmp("SatEL", buf, 5); 
+    if (ret != 0)
+        return RIG_EIO;
+
+    // yep, now enable motion
+    ret = write_block(&rs->rotport, "g", 1);
+    if (ret != RIG_OK)
+        return ret;
+
+    
+    return RIG_OK;
+}
+
+static int satel_rot_set_position(ROT *rot, azimuth_t az, elevation_t el)
+{
+#define BUF_CMD_SIZE 20
+    char buf[BUF_CMD_SIZE];
+    struct rot_state *rs;
+
+    
+    rig_debug(RIG_DEBUG_VERBOSE, "%s called: %.2f %.2f\n", __func__,
+              az, el);
+
+    
+    rs = &rot->state;
+
+    rig_flush(&rs->rotport);
+
+    snprintf(buf, BUF_CMD_SIZE, "p%03d %03d\r\n", (int)az, (int)el);
+    return write_block(&rs->rotport, buf, strlen(buf));
+}
+
+static int satel_rot_get_position(ROT *rot, azimuth_t *az, elevation_t *el)
+{
+    #define RES_BUF_SIZE 256
+    char buf[RES_BUF_SIZE];
+    char *p;
+    int ret;
+    struct rot_state *rs;
+
+
+    
+    rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
+
+    
+    rs = &rot->state;
+
+    rig_flush(&rs->rotport);
+    
+    ret = write_block(&rs->rotport, "z", 1);
+    if (ret != RIG_OK)
+        return ret;
+
+
+    // skip header information
+    for (int i = 0; i < 3; i++)
+    {
+        ret = read_string(&rs->rotport, buf, RES_BUF_SIZE, "\n", 1);
+        if (ret < 0)
+            return ret;
+    }
+
+    
+    // read azimuth line
+    ret = read_string(&rs->rotport, buf, RES_BUF_SIZE, "\n", 1);
+    if (ret < 0)
+        return ret;
+
+    p = buf + 10;
+    p[3] = '\0';
+    *az = strtof(p, NULL);
+
+    rig_debug(RIG_DEBUG_VERBOSE, "AZIMUTH %f[%s]", *az, p);
+    
+    
+    // read elevation line
+    ret = read_string(&rs->rotport, buf, RES_BUF_SIZE, "\n", 1);
+    if (ret < 0)
+        return ret;
+
+    p = buf + 12;
+    p[3] = '\0';
+    *el = strtof(p, NULL);
+
+    rig_debug(RIG_DEBUG_VERBOSE, "ELEVATION %f[%s]", *el, p);
+    
+    // skip trailer information
+    for (int i = 0; i < 2; i++)
+    {
+        ret = read_string(&rs->rotport, buf, RES_BUF_SIZE, "\n", 1);
+        if (ret < 0)
+            return ret;
+    }
+    
+
+    return RIG_OK;
+}
+
+
+static int satel_rot_stop(ROT *rot)
+{
+    struct rot_state *rs;
+
+    
+    rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
+
+    
+    rs = &rot->state;
+
+    rig_flush(&rs->rotport);
+    
+    return write_block(&rs->rotport, "*", 1);
+}
+
+static const char *satel_rot_get_info(ROT *rot)
+{
+    rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
+
+    return "Satel rotator";
+}
+
+/*
+ * Satel rotator capabilities.
+ */
+const struct rot_caps satel_rot_caps =
+{
+    ROT_MODEL(ROT_MODEL_SATEL),
+    .model_name       = "SatEL",
+    .mfg_name         = "SatEL",
+    .version          = "20210123.0",
+    .copyright        = "LGPL",
+    .status           = RIG_STATUS_ALPHA,
+    .rot_type         = ROT_TYPE_AZEL,
+    .port_type        = RIG_PORT_SERIAL,
+    .serial_rate_max  = 9600,
+    .serial_rate_min  = 9600,
+    .serial_data_bits = 8,
+    .serial_stop_bits = 1,
+    .serial_parity    = RIG_PARITY_NONE,
+    .serial_handshake = RIG_HANDSHAKE_NONE,
+    .write_delay      = 250,
+    .post_write_delay = 0,
+    .timeout          = 1000,
+    .retry            = 0,
+    .min_az           = 0.,
+    .max_az           = 360.,
+    .min_el           = 0.,
+    .max_el           = 90.,
+    .rot_open         = satel_rot_open,
+    .get_position     = satel_rot_get_position,
+    .set_position     = satel_rot_set_position,
+    .stop             = satel_rot_stop,
+    .get_info         = satel_rot_get_info,
+    .priv             = NULL,   /* priv */
+};
+
+DECLARE_INITROT_BACKEND(satel)
+{
+    rig_debug(RIG_DEBUG_VERBOSE, "%s: _init called\n", __func__);
+
+    rot_register(&satel_rot_caps);
+
+    return RIG_OK;
+}
diff --git a/rotators/satel/satel.h b/rotators/satel/satel.h
new file mode 100644
index 00000000..8f5dfd93
--- /dev/null
+++ b/rotators/satel/satel.h
@@ -0,0 +1,28 @@
+/*
+ *  Hamlib Sat/El backend - main header
+ *  Copyright (c) 2021 Joshua Lynch
+ *
+ *
+ *   This library is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU Lesser General Public
+ *   License as published by the Free Software Foundation; either
+ *   version 2.1 of the License, or (at your option) any later version.
+ *
+ *   This library is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *   Lesser General Public License for more details.
+ *
+ *   You should have received a copy of the GNU Lesser General Public
+ *   License along with this library; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ */
+
+#ifndef _ROT_SATEL_H
+#define _ROT_SATEL_H 1
+
+extern const struct rot_caps satel_rot_caps;
+
+
+#endif /* _ROT_SATEL_H */
diff --git a/src/rot_reg.c b/src/rot_reg.c
index 3353e7bc..8a341872 100644
--- a/src/rot_reg.c
+++ b/src/rot_reg.c
@@ -84,6 +84,7 @@ DEFINE_INITROT_BACKEND(cnctrk);
 DEFINE_INITROT_BACKEND(prosistel);
 DEFINE_INITROT_BACKEND(meade);
 DEFINE_INITROT_BACKEND(ioptron);
+DEFINE_INITROT_BACKEND(satel);
 #if HAVE_LIBINDI
 DEFINE_INITROT_BACKEND(indi);
 #endif
@@ -126,6 +127,7 @@ static struct
     { ROT_PROSISTEL, ROT_BACKEND_PROSISTEL, ROT_FUNCNAMA(prosistel) },
     { ROT_MEADE, ROT_BACKEND_MEADE, ROT_FUNCNAMA(meade) },
     { ROT_IOPTRON, ROT_BACKEND_IOPTRON, ROT_FUNCNAMA(ioptron) },
+    { ROT_SATEL, ROT_BACKEND_SATEL, ROT_FUNCNAMA(satel) },
 #if HAVE_LIBINDI
     { ROT_INDI, ROT_BACKEND_INDI, ROT_FUNCNAMA(indi) },
 #endif
-----------------------------------------------------------------------
Summary of changes:
 configure.ac                            |   3 +-
 include/hamlib/rotlist.h                |  14 ++
 rigs/kenwood/k3.c                       |  22 ++-
 rotators/satel/Makefile.am              |   6 +
 rotators/satel/satel.c                  | 339 ++++++++++++++++++++++++++++++++
 rotators/{m2/rc2800.h => satel/satel.h} |  12 +-
 src/rot_reg.c                           |   2 +
 7 files changed, 390 insertions(+), 8 deletions(-)
 create mode 100644 rotators/satel/Makefile.am
 create mode 100644 rotators/satel/satel.c
 copy rotators/{m2/rc2800.h => satel/satel.h} (80%)
hooks/post-receive
-- 
Hamlib -- Ham radio control libraries
 |