From 206a34b16280d5dad46753a90e14fd13e77b0ab7 Mon Sep 17 00:00:00 2001 From: "Joop Stakenborg, PG4I" Date: Fri, 20 Dec 2002 15:43:31 +0000 Subject: [PATCH] use FW command to set bandpass git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@1321 7ae35d74-ebe9-4afe-98af-79ac388436b8 --- kenwood/ts870s.c | 43 ++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 40 insertions(+), 3 deletions(-) diff --git a/kenwood/ts870s.c b/kenwood/ts870s.c index 34797fff4..4200eea77 100644 --- a/kenwood/ts870s.c +++ b/kenwood/ts870s.c @@ -2,7 +2,7 @@ * Hamlib Kenwood backend - TS870S description * Copyright (c) 2000-2002 by Stephane Fillod * - * $Id: ts870s.c,v 1.30 2002-12-20 10:35:13 pa4tu Exp $ + * $Id: ts870s.c,v 1.31 2002-12-20 15:43:31 pa4tu Exp $ * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as @@ -107,6 +107,43 @@ int ts870s_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode, pbwidth_t *width) return RIG_OK; } +int ts870s_set_mode(RIG *rig, vfo_t vfo, rmode_t mode, pbwidth_t width) +{ + unsigned char buf[16],ackbuf[16]; + int buf_len, ack_len, kmode, retval; + + switch (mode) + { + case RIG_MODE_CW: kmode = MD_CW; break; + case RIG_MODE_CWR: kmode = MD_CWR; break; + case RIG_MODE_USB: kmode = MD_USB; break; + case RIG_MODE_LSB: kmode = MD_LSB; break; + case RIG_MODE_FM: kmode = MD_FM; break; + case RIG_MODE_AM: kmode = MD_AM; break; + case RIG_MODE_RTTY: kmode = MD_FSK; break; + case RIG_MODE_RTTYR: kmode = MD_FSKR; break; + default: + rig_debug(RIG_DEBUG_ERR,"ts870s_set_mode: " + "unsupported mode %d\n", mode); + return -RIG_EINVAL; + } + + buf_len = sprintf(buf, "MD%c;", kmode); + ack_len = 0; + retval = kenwood_transaction (rig, buf, buf_len, ackbuf, &ack_len); + if (retval != RIG_OK) return retval; + +/* + * This rig will simply use an IF bandpass which is closest to width, + * so we don't need to check the value... + */ + buf_len = sprintf(buf, "FW%04d;", (int)width/10); + ack_len = 0; + retval = kenwood_transaction (rig, buf, buf_len, ackbuf, &ack_len); + if (retval != RIG_OK) return retval; + + return RIG_OK; +} /* * ts870s rig capabilities. @@ -120,7 +157,7 @@ const struct rig_caps ts870s_caps = { .rig_model = RIG_MODEL_TS870S, .model_name = "TS-870S", .mfg_name = "Kenwood", -.version = "0.3", +.version = "0.3.1", .copyright = "LGPL", .status = RIG_STATUS_BETA, .rig_type = RIG_TYPE_TRANSCEIVER, @@ -248,7 +285,7 @@ const struct rig_caps ts870s_caps = { .get_rit = kenwood_get_rit, .set_xit = kenwood_set_xit, .get_xit = kenwood_get_xit, -.set_mode = kenwood_set_mode, +.set_mode = ts870s_set_mode, .get_mode = ts870s_get_mode, .set_vfo = kenwood_set_vfo, .get_vfo = kenwood_get_vfo,