Add Main/Sub support to kenwood data mode determination

Improve simkenwood
https://github.com/Hamlib/Hamlib/issues/872
Hamlib-4.4
Mike Black W9MDB 2021-11-23 08:33:57 -06:00
rodzic e283e2b039
commit ccac553f1b
3 zmienionych plików z 20 dodań i 4 usunięć

Wyświetl plik

@ -2223,17 +2223,18 @@ int kenwood_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
datamode = 1; datamode = 1;
} }
} }
rig_debug(RIG_DEBUG_VERBOSE, "%s: curr_mode=%s, new_mode=%s\n", __func__, rig_strrmode(priv->curr_mode), rig_strrmode(mode)); rig_debug(RIG_DEBUG_VERBOSE, "%s: vfo=%s, curr_mode=%s, new_mode=%s\n", __func__, rig_strvfo(vfo), rig_strrmode(priv->curr_mode), rig_strrmode(mode));
// only change mode if needed // only change mode if needed
if (priv->curr_mode != mode) if (priv->curr_mode != mode)
{ {
snprintf(buf, sizeof(buf), "MD%c", c); snprintf(buf, sizeof(buf), "MD%c", c);
err = kenwood_transaction(rig, buf, NULL, 0); err = kenwood_transaction(rig, buf, NULL, 0);
} }
// determine if we need to set datamode on A or B
needdata = 0; needdata = 0;
if ((vfo == RIG_VFO_A) && ((priv->datamodeA == 0 && datamode) || (priv->datamodeA == 1 && !datamode))) if ((vfo & (RIG_VFO_A|RIG_VFO_MAIN)) && ((priv->datamodeA == 0 && datamode) || (priv->datamodeA == 1 && !datamode)))
needdata = 1; needdata = 1;
if ((vfo == RIG_VFO_B) && ((priv->datamodeB == 0 && datamode) || (priv->datamodeB == 1 && !datamode))) if ((vfo == (RIG_VFO_B|RIG_VFO_SUB)) && ((priv->datamodeB == 0 && datamode) || (priv->datamodeB == 1 && !datamode)))
needdata = 1; needdata = 1;
if (needdata) if (needdata)
@ -2244,6 +2245,10 @@ int kenwood_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width)
if (err != RIG_OK) { RETURNFUNC(err); } if (err != RIG_OK) { RETURNFUNC(err); }
} }
else if (datamode)
{
rig_debug(RIG_DEBUG_VERBOSE, "%s: datamode set on %s not needed\n", __func__, rig_strvfo(vfo));
}
if (RIG_PASSBAND_NOCHANGE == width) { RETURNFUNC(RIG_OK); } if (RIG_PASSBAND_NOCHANGE == width) { RETURNFUNC(RIG_OK); }

Wyświetl plik

@ -28,7 +28,7 @@
#include "token.h" #include "token.h"
#include "misc.h" #include "misc.h"
#define BACKEND_VER "20211122" #define BACKEND_VER "20211122.1"
#define EOM_KEN ';' #define EOM_KEN ';'
#define EOM_TH '\r' #define EOM_TH '\r'

Wyświetl plik

@ -11,6 +11,7 @@
float freqA = 14074000; float freqA = 14074000;
float freqB = 14074500; float freqB = 14074500;
int filternum = 7;
// ID 0310 == 310, Must drop leading zero // ID 0310 == 310, Must drop leading zero
typedef enum nc_rigid_e typedef enum nc_rigid_e
@ -223,6 +224,16 @@ int main(int argc, char *argv[])
{ {
sscanf(buf, "MD%d", &modeA); // not worried about modeB yet for simulator sscanf(buf, "MD%d", &modeA); // not worried about modeB yet for simulator
} }
else if (strncmp(buf,"FL;",3) == 0)
{
sprintf(buf, "FL%03d;", filternum);
write(fd, buf, strlen(buf));
}
else if (strncmp(buf,"FL",2) == 0)
{
sscanf(buf, "FL%d", &filternum);
}
else if (strlen(buf) > 0) else if (strlen(buf) > 0)