kopia lustrzana https://github.com/Hamlib/Hamlib
Do not crash if expected CTCSS tones not sepcified
Also added expected CTCSS tones to Icom IC-7300 capabilities.Hamlib-3.1
rodzic
5c947caf53
commit
7ddb7841f6
|
@ -40,7 +40,7 @@
|
||||||
#include "frame.h"
|
#include "frame.h"
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
#include "bandplan.h"
|
#include "bandplan.h"
|
||||||
|
#include "tones.h"
|
||||||
|
|
||||||
/* AM Data mode needs adding - this would require one more mode 'RIG_MODE_PKTAM' to rig.h */
|
/* AM Data mode needs adding - this would require one more mode 'RIG_MODE_PKTAM' to rig.h */
|
||||||
#define IC7300_ALL_RX_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_RTTYR|RIG_MODE_PKTLSB|RIG_MODE_PKTUSB)
|
#define IC7300_ALL_RX_MODES (RIG_MODE_AM|RIG_MODE_CW|RIG_MODE_CWR|RIG_MODE_SSB|RIG_MODE_RTTY|RIG_MODE_RTTYR|RIG_MODE_PKTLSB|RIG_MODE_PKTUSB)
|
||||||
|
@ -115,7 +115,7 @@ const struct rig_caps ic7300_caps = {
|
||||||
[LVL_RAWSTR] = { .min = { .i = 0 }, .max = { .i = 255 } },
|
[LVL_RAWSTR] = { .min = { .i = 0 }, .max = { .i = 255 } },
|
||||||
},
|
},
|
||||||
.parm_gran = {},
|
.parm_gran = {},
|
||||||
.ctcss_list = NULL,
|
.ctcss_list = full_ctcss_list,
|
||||||
.dcs_list = NULL,
|
.dcs_list = NULL,
|
||||||
.preamp = { 10, RIG_DBLST_END, }, /* FIXME: TBC it's a guess*/
|
.preamp = { 10, RIG_DBLST_END, }, /* FIXME: TBC it's a guess*/
|
||||||
.attenuator = { 20, RIG_DBLST_END, }, /* value taken from p.45 of manual*/
|
.attenuator = { 20, RIG_DBLST_END, }, /* value taken from p.45 of manual*/
|
||||||
|
|
14
icom/icom.c
14
icom/icom.c
|
@ -2623,12 +2623,14 @@ int icom_set_ctcss_tone(RIG *rig, vfo_t vfo, tone_t tone)
|
||||||
|
|
||||||
caps = rig->caps;
|
caps = rig->caps;
|
||||||
|
|
||||||
for (i = 0; caps->ctcss_list[i] != 0 && i<52; i++) {
|
if (caps->ctcss_list) {
|
||||||
if (caps->ctcss_list[i] == tone)
|
for (i = 0; caps->ctcss_list[i] != 0 && i<52; i++) {
|
||||||
break;
|
if (caps->ctcss_list[i] == tone)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (caps->ctcss_list[i] != tone)
|
||||||
|
return -RIG_EINVAL;
|
||||||
}
|
}
|
||||||
if (caps->ctcss_list[i] != tone)
|
|
||||||
return -RIG_EINVAL;
|
|
||||||
|
|
||||||
/* Sent as frequency in tenth of Hz */
|
/* Sent as frequency in tenth of Hz */
|
||||||
|
|
||||||
|
@ -2677,6 +2679,8 @@ int icom_get_ctcss_tone(RIG *rig, vfo_t vfo, tone_t *tone)
|
||||||
tone_len -= 2;
|
tone_len -= 2;
|
||||||
*tone = from_bcd_be(tonebuf+2, tone_len*2);
|
*tone = from_bcd_be(tonebuf+2, tone_len*2);
|
||||||
|
|
||||||
|
if (!caps->ctcss_list) return RIG_OK;
|
||||||
|
|
||||||
/* check this tone exists. That's better than nothing. */
|
/* check this tone exists. That's better than nothing. */
|
||||||
for (i = 0; caps->ctcss_list[i] != 0 && i<52; i++) {
|
for (i = 0; caps->ctcss_list[i] != 0 && i<52; i++) {
|
||||||
if (caps->ctcss_list[i] == *tone)
|
if (caps->ctcss_list[i] == *tone)
|
||||||
|
|
Ładowanie…
Reference in New Issue