Memory Bank

* Correct/add memory bank read/write for the following transceivers
    - 7100
    - Xiegu-G90
This commit is contained in:
David Freese 2020-10-10 08:30:43 -05:00
parent 3c2ee3ae51
commit 547a27351f
5 changed files with 123 additions and 114 deletions

View file

@ -398,7 +398,7 @@ struct status {
bool start_stop_trace;
int rpc_level;
// bands; defaults for FT857 / FT897
// bands; defaults for FT857 / FT897 / Xiegu-G90
// frequency, mode, txCTCSS, rxCTCSS, offset, offset_freq;
int f160, m160, txT_160, rxT_160, offset_160, oF_160;
int f80, m80, txT_80, rxT_80, offset_80, oF_80;
@ -412,6 +412,8 @@ struct status {
int f6, m6, txT_6, rxT_6, offset_6, oF_6;
int f2, m2, txT_2, rxT_2, offset_2, oF_2;
int f70, m70, txT_70, rxT_70, offset_70, oF_70;
int f12G, m12G, txT_12G, rxT_12G, offset_12G, oF_12G;
int fgen, mgen, txT_gen, rxT_gen, offset_gen, oF_gen;
// memory management
Fl_Font memfontnbr;

View file

@ -1708,27 +1708,23 @@ int RIG_IC7100::get_noise_reduction_val()
// Read/Write band stack registers
//
// Read 23 bytes
//
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
// FE FE nn E0 1A 01 bd rn f5 f4 f3 f2 f1 mo fi fg t1 t2 t3 r1 r2 r3 FD
// Write 23 bytes
//
// FE FE E0 nn 1A 01 bd rn f5 f4 f3 f2 f1 mo fi fg t1 t2 t3 r1 r2 r3 FD
//
// nn - CI-V address
// bd - band selection 1/2/3
// rn - register number 1/2/3
// f5..f1 - frequency BCD reverse
// mo - mode
// fi - filter #
// fg flags: x01 use Tx tone, x02 use Rx tone, x10 data mode
// t1..t3 - tx tone BCD fwd
// r1..r3 - rx tone BCD fwd
//
// FE FE E0 94 1A 01 06 01 70 99 08 18 00 01 03 10 00 08 85 00 08 85 FD
//
// band 6; freq 0018,089,970; USB; data mode; t 88.5; r 88.5
// ( 0) xFE xFE x88 xE0 x1A x01 band stack command
// ( 6) x01 frequency band code
// ( 7) x01 register code
// ( 8) x00 x00 x91 x01 x00 frequency
// (13) x03 x02 operating mode / filter setting
// (15) x00 data mode 0x00 / 0x01
// (16) x00 duplex tone setting
// (17) x00 digital squelch setting
// (18) x00 x08 x85 repeater tone frequency
// (21) x00 x08 x85 tone squelch frequency
// (24) x00 x00 x23 dtcs code
// (27) x00 digital squelch code
// (28) x00 x50 x00 duplex offset frequency
// (31) x43 x51 x43 x51 x43 x51 x20 x20 destination call, 8 chars "CKCKCK "
// (39) x20 x20 x20 x20 x20 x20 x20 x20 x20 x20 x20 x20 x20 x20 x20 x20 memory name, 16 chars
// (55) xFD
void RIG_IC7100::get_band_selection(int v)
{
@ -1738,11 +1734,11 @@ void RIG_IC7100::get_band_selection(int v)
cmd += '\x01';
cmd.append( post );
if (waitFOR(23, "get band stack")) {
if (waitFOR(56, "get band stack")) {
set_trace(2, "get band stack", str2hex(replystr.c_str(), replystr.length()));
size_t p = replystr.rfind(pre_fm);
if (p != string::npos) {
unsigned long int bandfreq = fm_bcd_be(replystr.substr(p+8, 5), 10);
unsigned long int bandfreq = fm_bcd_be(replystr.substr(p + 8, 5), 10);
int bandmode = replystr[p+13];
int bandfilter = replystr[p+14];
int banddata = replystr[p+15] & 0x10;
@ -1750,6 +1746,22 @@ void RIG_IC7100::get_band_selection(int v)
if ((bandmode == 1) && banddata) bandmode = 11;
if ((bandmode == 2) && banddata) bandmode = 12;
if ((bandmode == 5) && banddata) bandmode = 13;
int tone = fm_bcd(replystr.substr(p + 18, 3), 6);
tTONE = 0;
for (size_t n = 0; n < sizeof(PL_tones) / sizeof(*PL_tones); n++) {
if (tone == PL_tones[n]) {
tTONE = n;
break;
}
}
tone = fm_bcd(replystr.substr(p + 21, 3), 6);
rTONE = 0;
for (size_t n = 0; n < sizeof(PL_tones) / sizeof(*PL_tones); n++) {
if (tone == PL_tones[n]) {
rTONE = n;
break;
}
}
if (useB) {
set_vfoB(bandfreq);
set_modeB(bandmode);
@ -1774,26 +1786,25 @@ void RIG_IC7100::set_band_selection(int v)
cmd.append("\x1A\x01");
cmd += to_bcd_be( v, 2 );
cmd += '\x01';
cmd.append( to_bcd_be( freq, 10 ) );
cmd += mode;
cmd += fil;
if (mode >= 9)
cmd += '\x10';
cmd.append( to_bcd_be( freq, 10 ) ); // byte 8
cmd += IC7100_mode_nbr[mode]; // byte 13
cmd += fil; // byte 14
if (mode >= 9) // byte 15 data mode
cmd += '\x01';
else
cmd += '\x00';
cmd.append(to_bcd(PL_tones[tTONE], 6));
cmd.append(to_bcd(PL_tones[rTONE], 6));
cmd += '\x00'; // byte 16 duplex tone
cmd += '\x00'; // byte 17 dig squelch
cmd.append(to_bcd(PL_tones[tTONE], 6)); // byte 18 repeater tone
cmd.append(to_bcd(PL_tones[rTONE], 6)); // byte 21 tone squelch freq
cmd += '\x00'; cmd += '\x00'; cmd += '\x23'; // byte 24 dtcs tone
cmd += '\x00'; // byte 27 digitital squelch code
cmd += '\x00'; cmd += '\x60'; cmd += '\x00'; // byte 28 duplex offset frequency
cmd.append("CKCKCK "); // byte 31 destination call
cmd.append(" "); // byte 39 memory name, 16 chars
cmd.append(post);
waitFB("set_band_selection");
set_trace(2, "set_band_selection()", str2hex(replystr.c_str(), replystr.length()));
cmd.assign(pre_to);
cmd.append("\x1A\x01");
cmd += to_bcd_be( v, 2 );
cmd += '\x01';
cmd.append( post );
waitFOR(23, "get band stack");
}
void RIG_IC7100::setVfoAdj(double v)

View file

@ -2075,13 +2075,29 @@ void RIG_IC7300::set_band_selection(int v)
cmd.append(post);
waitFB("set_band_selection");
isett("set_band_selection");
cmd.assign(pre_to);
cmd.append("\x1A\x01");
cmd += to_bcd_be( v, 2 );
cmd += '\x01';
cmd.append( post );
waitFOR(23, "get band stack");
}
/*
rn - register number 1/2/3
f5..f1 - frequency BCD reverse
mo - mode
fi - filter #
fg flags: x01 use Tx tone, x02 use Rx tone, x10 data mode
t1..t3 - tx tone BCD fwd
r1..r3 - rx tone BCD fwd
FE FE 94 E0 1A 01 05 01 FD
FE FE E0 94 1A 01
05
01
00 00 07 14 00
01
03
10
00 10 00
00 08 85
FD
*/

View file

@ -24,6 +24,8 @@
#include <iostream>
#include <sstream>
#include "gettext.h"
//=============================================================================
// IC-_g90
/*
@ -95,7 +97,9 @@ void RIG_Xiegu_G90::initialize()
btn_icom_select_10->deactivate();
btn_icom_select_11->deactivate();
btn_icom_select_12->deactivate();
btn_icom_select_13->deactivate();
btn_icom_select_13->copy_label(_("GEN"));
btn_icom_select_13->tooltip(_("General RX"));
choice_rTONE->deactivate();
choice_tTONE->deactivate();
@ -960,34 +964,22 @@ void RIG_Xiegu_G90::get_band_selection(int v)
int bandfreq, bandmode;
switch (v) {
default:
case 1: bandfreq = progStatus.f160;
bandmode = progStatus.m160;
break;
case 2: bandfreq = progStatus.f80;
bandmode = progStatus.m80;
break;
case 3: bandfreq = progStatus.f40;
bandmode = progStatus.m40;
break;
case 4: bandfreq = progStatus.f30;
bandmode = progStatus.m30;
break;
case 5: bandfreq = progStatus.f20;
bandmode = progStatus.m20;
break;
case 6: bandfreq = progStatus.f17;
bandmode = progStatus.m17;
break;
case 7: bandfreq = progStatus.f15;
bandmode = progStatus.m15;
break;
case 8: bandfreq = progStatus.f12;
bandmode = progStatus.m12;
break;
case 9: bandfreq = progStatus.f10;
bandmode = progStatus.m10;
break;
case 1: bandfreq = progStatus.f160; bandmode = progStatus.m160; break;
case 2: bandfreq = progStatus.f80; bandmode = progStatus.m80; break;
case 3: bandfreq = progStatus.f40; bandmode = progStatus.m40; break;
case 4: bandfreq = progStatus.f30; bandmode = progStatus.m30; break;
case 5: bandfreq = progStatus.f20; bandmode = progStatus.m20; break;
case 6: bandfreq = progStatus.f17; bandmode = progStatus.m17; break;
case 7: bandfreq = progStatus.f15; bandmode = progStatus.m15; break;
case 8: bandfreq = progStatus.f12; bandmode = progStatus.m12; break;
case 9: bandfreq = progStatus.f10; bandmode = progStatus.m10; break;
case 10: bandfreq = progStatus.f6; bandmode = progStatus.m6; break;
// case 11: bandfreq = progStatus.f2; bandmode = progStatus.m2; break;
// case 12: bandfreq = progStatus.f70; bandmode = progStatus.m70; break;
case 13: bandfreq = progStatus.fgen; bandmode = progStatus.mgen; break;
}
if (bandmode < 0) bandmode = 0;
if (bandmode > 4) bandmode = 0;
if (useB) {
set_vfoB(bandfreq);
set_modeB(bandmode);
@ -1002,33 +994,19 @@ void RIG_Xiegu_G90::set_band_selection(int v)
{
switch (v) {
default:
case 1: progStatus.f160 = vfo->freq;
progStatus.m160 = vfo->imode;
break;
case 2: progStatus.f80 = vfo->freq;
progStatus.m80 = vfo->imode;
break;
case 3: progStatus.f40 = vfo->freq;
progStatus.m40 = vfo->imode;
break;
case 4: progStatus.f30 = vfo->freq;
progStatus.m30 = vfo->imode;
break;
case 5: progStatus.f20 = vfo->freq;
progStatus.m20 = vfo->imode;
break;
case 6: progStatus.f17 = vfo->freq;
progStatus.m17 = vfo->imode;
break;
case 7: progStatus.f15 = vfo->freq;
progStatus.m15 = vfo->imode;
break;
case 8: progStatus.f12 = vfo->freq;
progStatus.m12 = vfo->imode;
break;
case 9: progStatus.f10 = vfo->freq;
progStatus.m10 = vfo->imode;
break;
case 1: progStatus.f160 = vfo->freq; progStatus.m160 = vfo->imode; break;
case 2: progStatus.f80 = vfo->freq; progStatus.m80 = vfo->imode; break;
case 3: progStatus.f40 = vfo->freq; progStatus.m40 = vfo->imode; break;
case 4: progStatus.f30 = vfo->freq; progStatus.m30 = vfo->imode; break;
case 5: progStatus.f20 = vfo->freq; progStatus.m20 = vfo->imode; break;
case 6: progStatus.f17 = vfo->freq; progStatus.m17 = vfo->imode; break;
case 7: progStatus.f15 = vfo->freq; progStatus.m15 = vfo->imode; break;
case 8: progStatus.f12 = vfo->freq; progStatus.m12 = vfo->imode; break;
case 9: progStatus.f10 = vfo->freq; progStatus.m10 = vfo->imode; break;
case 10: progStatus.f6 = vfo->freq; progStatus.m6 = vfo->imode; break;
// case 11: progStatus.f2 = vfo->freq; progStatus.m2 = vfo->imode; break;
// case 12: progStatus.f70 = vfo->freq; progStatus.m70 = vfo->imode; break;
case 13: progStatus.fgen = vfo->freq; progStatus.mgen = vfo->imode; break;
}
set_trace(1, "set_band_selection()");
}

View file

@ -414,20 +414,22 @@ status progStatus = {
false, // bool start_stop_trace;
0, // int rpc_level;
// bands; defaults for FT857 / FT897
// bands; defaults for FT857 / FT897 / Xiegu-G90
// frequency, mode, txCTCSS, rxCTCSS, offset, offset_freq;
1805000L, 6, 0, 0, 0, 600, // f160
3580000L, 6, 0, 0, 0, 600, // f80 meters
7070000L, 6, 0, 0, 0, 600, // f40 meters
10140000L, 6, 0, 0, 0, 600, // f30 meters
14070000L, 6, 0, 0, 0, 600, // f20 meters
18100000L, 6, 0, 0, 0, 600, // f17 meters
21070000L, 6, 0, 0, 0, 600, // f15 meters
24920000L, 6, 0, 0, 0, 600, // f12 meters
28070000L, 6, 0, 0, 0, 600, // f10 meters
50070000L, 6, 0, 0, 0, 600, // f6 meters
144070000L, 6, 0, 0, 0, 600, // f2 meters
432100000L, 6, 0, 0, 0, 600, // f70 cent'
1805000L, 0, 0, 0, 0, 600, // f160
3580000L, 0, 0, 0, 0, 600, // f80 meters
7070000L, 0, 0, 0, 0, 600, // f40 meters
10140000L, 0, 0, 0, 0, 600, // f30 meters
14070000L, 0, 0, 0, 0, 600, // f20 meters
18100000L, 0, 0, 0, 0, 600, // f17 meters
21070000L, 0, 0, 0, 0, 600, // f15 meters
24920000L, 0, 0, 0, 0, 600, // f12 meters
28070000L, 0, 0, 0, 0, 600, // f10 meters
50070000L, 0, 0, 0, 0, 600, // f6 meters
144070000L, 0, 0, 0, 0, 600, // f2 meters
432100000L, 0, 0, 0, 0, 600, // f70 cent'
1210000000L, 0, 0, 0, 0, 600, // f12G
15000000L, 0, 0, 0, 0, 600, // general
// memory management
4, // Fl_Font memfontnbr;