mirror of
https://git.code.sf.net/p/fldigi/flrig
synced 2026-08-13 17:28:24 -04:00
tci interface
* fix various issues with slice vice channel * fix various issues with set/get mode * add tci "sendCommand"
This commit is contained in:
parent
ea4735f691
commit
97cb3b8394
4 changed files with 51 additions and 41 deletions
|
|
@ -457,18 +457,16 @@ int RIG_TCI_SDR::get_modeA()
|
|||
if (--wait_on_mode > 0) return A.imode;
|
||||
|
||||
std::string tcicmd = slice_0.A.mod;
|
||||
|
||||
try {
|
||||
size_t n = 0;
|
||||
for (n = 0; n < TCI_modes.size(); n++) {
|
||||
if (tcicmd.find(TCI_modes.at(n)) == 0) {
|
||||
if (tcicmd.find(TCI_modes.at(n)) != std::string::npos) {
|
||||
if (n != (size_t)A.imode) {
|
||||
A.imode = n;
|
||||
A.iBW = set_widths(n);
|
||||
}
|
||||
return A.imode;
|
||||
}
|
||||
n++;
|
||||
}
|
||||
} catch (const std::exception& e) {
|
||||
std::cout << e.what() << '\n';
|
||||
|
|
@ -476,10 +474,13 @@ int RIG_TCI_SDR::get_modeA()
|
|||
return A.imode;
|
||||
}
|
||||
|
||||
// set modeB is identical to set modeA as the ExpertSDR2/3 does not differentiate
|
||||
// between the two
|
||||
|
||||
void RIG_TCI_SDR::set_modeB(int mode)
|
||||
{
|
||||
try {
|
||||
std::string tcicmd = "MODULATION:1,";
|
||||
std::string tcicmd = "MODULATION:0,";
|
||||
tcicmd.append(TCI_modes.at(mode)).append(";");
|
||||
tci_send(tcicmd);
|
||||
|
||||
|
|
@ -501,14 +502,13 @@ int RIG_TCI_SDR::get_modeB()
|
|||
try {
|
||||
size_t n = 0;
|
||||
for (n = 0; n < TCI_modes.size(); n++) {
|
||||
if (tcicmd.find(TCI_modes.at(n)) == 0) {
|
||||
if (n != (size_t)B.imode) {
|
||||
if (tcicmd.find(TCI_modes.at(n)) != std::string::npos) {
|
||||
if (n != (size_t)A.imode) {
|
||||
B.imode = n;
|
||||
B.iBW = set_widths(n);
|
||||
}
|
||||
return B.imode;
|
||||
}
|
||||
n++;
|
||||
}
|
||||
} catch (const std::exception& e) {
|
||||
std::cout << e.what() << '\n';
|
||||
|
|
@ -589,6 +589,8 @@ int RIG_TCI_SDR::get_bwA()
|
|||
return A.iBW;
|
||||
}
|
||||
|
||||
// set bwB is identical to set bwA as the ExpertSDR2/3 does not differentiate
|
||||
// between the two
|
||||
void RIG_TCI_SDR::set_bwB(int val)
|
||||
{
|
||||
tci_adjust_widths();
|
||||
|
|
|
|||
|
|
@ -2428,7 +2428,7 @@ public:
|
|||
nuvals.imode = i;
|
||||
nuvals.iBW = selrig->def_bandwidth(i);
|
||||
guard_lock serial_lock(&mutex_serial);
|
||||
serviceB(nuvals);
|
||||
serviceA(nuvals);
|
||||
Fl::awake(updateUI);
|
||||
result = 1;
|
||||
break;
|
||||
|
|
@ -2467,7 +2467,7 @@ public:
|
|||
nuvals.imode = i;
|
||||
nuvals.iBW = selrig->def_bandwidth(i);
|
||||
guard_lock serial_lock(&mutex_serial);
|
||||
serviceB(nuvals);
|
||||
serviceA(nuvals);
|
||||
Fl::awake(updateUI);
|
||||
result = (nuvals.imode == selrig->get_modeA());
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -185,6 +185,11 @@ int sendCommand (std::string s, int nread, int wait)
|
|||
// reply was from this command, when it really was from a previous command.
|
||||
assignReplyStr("");
|
||||
|
||||
if (tci_running()) {
|
||||
tci_send(s);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (progStatus.use_tcpip) {
|
||||
readResponse();
|
||||
send_to_remote(s);
|
||||
|
|
|
|||
|
|
@ -95,20 +95,21 @@ void handle_message(const std::string & message)
|
|||
char szstr[50];
|
||||
std::string str;
|
||||
std::string rx = message;
|
||||
size_t p = 0;
|
||||
|
||||
for (size_t n = 0; n < rx.length(); n++)
|
||||
rx[n] = toupper(rx[n] & 0xFF);
|
||||
|
||||
if (rx.find("RX_SMETER:") == 0) { // smeter reading
|
||||
sscanf(rx.c_str(), "RX_SMETER:%d,%d,%d;", &rxnbr, &vfo, &ival);
|
||||
if ((p = rx.find("RX_SMETER:")) != std::string::npos) { // smeter reading
|
||||
sscanf(rx.substr(p).c_str(), "RX_SMETER:%d,%d,%d;", &rxnbr, &vfo, &ival);
|
||||
if (rxnbr == 0) {
|
||||
if (vfo == 0) slice_0.smeter = ival;
|
||||
}
|
||||
}
|
||||
else {
|
||||
tci_trace(2, "PARSE:", rx.c_str());
|
||||
if (rx.find("VFO:") == 0) { // vfo:0,0,7032050;
|
||||
sscanf(rx.c_str(), "VFO:%d,%d,%d", &rxnbr, &vfo, &ival);
|
||||
if ((p = rx.find("VFO:")) != std::string::npos) { // vfo:0,0,7032050;
|
||||
sscanf(rx.substr(p).c_str(), "VFO:%d,%d,%d", &rxnbr, &vfo, &ival);
|
||||
if (rxnbr == 0) {
|
||||
if (vfo == 0) slice_0.A.freq = ival;
|
||||
else slice_0.B.freq = ival;
|
||||
|
|
@ -117,26 +118,28 @@ void handle_message(const std::string & message)
|
|||
else slice_1.B.freq = ival;
|
||||
}
|
||||
}
|
||||
else if (rx.find("DDS:") == 0) { // dds:1,14070000;
|
||||
sscanf(rx.c_str(), "DDS:%d,%d", &rxnbr, &ival);
|
||||
else if ((p = rx.find("DDS:")) != std::string::npos) { // dds:1,14070000;
|
||||
sscanf(rx.substr(p).c_str(), "DDS:%d,%d", &rxnbr, &ival);
|
||||
if (rxnbr == 0) {
|
||||
slice_0.dds = ival;
|
||||
} else {
|
||||
slice_1.dds = ival;
|
||||
}
|
||||
}
|
||||
else if (rx.find("RX_FILTER_BAND:") == 0) { // rx_filter_band:0,-600,600;
|
||||
sscanf(rx.c_str(), "RX_FILTER_BAND:%d,%s", &vfo, szstr);
|
||||
if (vfo == 0) {slice_0.A.bw = szstr; }
|
||||
else {slice_0.B.bw = szstr; }
|
||||
else if ((p = rx.find("RX_FILTER_BAND:")) != std::string::npos) { // rx_filter_band:0,-600,600;
|
||||
int slice;
|
||||
sscanf(rx.substr(p).c_str(), "RX_FILTER_BAND:%d,%s", &slice, szstr);
|
||||
if (slice == 0) {slice_0.A.bw = slice_0.B.bw = szstr; }
|
||||
else {slice_1.A.bw = slice_1.B.bw = szstr; }
|
||||
}
|
||||
else if (rx.find("MODULATION:") == 0) { // modulation:0,cw;
|
||||
sscanf(rx.c_str(), "MODULATION:%d,%s", &vfo, szstr);
|
||||
if (vfo == 0) { slice_0.A.mod = szstr; }
|
||||
else { slice_0.B.mod = szstr; }
|
||||
else if ((p = rx.find("MODULATION:")) != std::string::npos) { // modulation:0,cw;
|
||||
int slice = 0;
|
||||
sscanf(rx.substr(p).c_str(), "MODULATION:%d,%s", &slice, szstr);
|
||||
if (slice == 0) { slice_0.A.mod = slice_0.B.mod = szstr; }
|
||||
else { slice_1.A.mod = slice_1.B.mod = szstr; }
|
||||
}
|
||||
else if (rx.find("TRX:") == 0) {
|
||||
sscanf(rx.c_str(), "TRX:%d,%s", &rxnbr, szstr);
|
||||
else if ((p = rx.find("TRX:")) != std::string::npos) {
|
||||
sscanf(rx.substr(p).c_str(), "TRX:%d,%s", &rxnbr, szstr);
|
||||
str = szstr;
|
||||
if (rxnbr == 0) {
|
||||
slice_0.ptt = (str == "TRUE;");
|
||||
|
|
@ -144,8 +147,8 @@ void handle_message(const std::string & message)
|
|||
slice_1.ptt = (str == "TRUE;");
|
||||
}
|
||||
}
|
||||
else if (rx.find("SPLIT_ENABLE:") == 0) { // split_enable:0,false;
|
||||
sscanf(rx.c_str(), "SPLIT_ENABLE:%d,%s", &rxnbr, szstr);
|
||||
else if ((p = rx.find("SPLIT_ENABLE:")) != std::string::npos) { // split_enable:0,false;
|
||||
sscanf(rx.substr(p).c_str(), "SPLIT_ENABLE:%d,%s", &rxnbr, szstr);
|
||||
str = szstr;
|
||||
if (rxnbr == 0) {
|
||||
slice_0.split = (str == "TRUE;");
|
||||
|
|
@ -153,32 +156,32 @@ void handle_message(const std::string & message)
|
|||
slice_1.split = (str == "TRUE;");
|
||||
}
|
||||
}
|
||||
else if (rx.find("VOLUME:") == 0) { // volume:-16;
|
||||
sscanf(rx.c_str(), "VOLUME:%d", &ival);
|
||||
else if ((p = rx.find("VOLUME:")) != std::string::npos) { // volume:-16;
|
||||
sscanf(rx.substr(p).c_str(), "VOLUME:%d", &ival);
|
||||
slice_0.vol = ival;
|
||||
}
|
||||
else if (rx.find("SQL_ENABLE:") == 0) { // sql_enable:1,false;
|
||||
sscanf(rx.c_str(), "SQL_ENABLE:%d,%s", &rxnbr, szstr);
|
||||
else if ((p = rx.find("SQL_ENABLE:")) != std::string::npos) { // sql_enable:1,false;
|
||||
sscanf(rx.substr(p).c_str(), "SQL_ENABLE:%d,%s", &rxnbr, szstr);
|
||||
str = szstr;
|
||||
if (rxnbr == 0) {
|
||||
slice_0.sql = (str == "TRUE;");
|
||||
} else
|
||||
slice_1.sql = (str == "TRUE;");
|
||||
}
|
||||
else if (rx.find("SQL_LEVEL:") == 0) { // sql_level:0,-79;
|
||||
sscanf(rx.c_str(), "SQL_LEVEL:%d,%d", &rxnbr, &ival);
|
||||
else if ((p = rx.find("SQL_LEVEL:")) != std::string::npos) { // sql_level:0,-79;
|
||||
sscanf(rx.substr(p).c_str(), "SQL_LEVEL:%d,%d", &rxnbr, &ival);
|
||||
if (rxnbr == 0) {
|
||||
slice_0.sql_level = ival;
|
||||
} else {
|
||||
slice_1.sql_level = ival;
|
||||
}
|
||||
}
|
||||
else if (rx.find("DRIVE:") == 0) { // drive:100;
|
||||
sscanf(rx.c_str(), "DRIVE:%d", &ival);
|
||||
else if ((p = rx.find("DRIVE:")) != std::string::npos) { // drive:100;
|
||||
sscanf(rx.substr(p).c_str(), "DRIVE:%d", &ival);
|
||||
slice_0.pwr = ival;
|
||||
}
|
||||
else if (rx.find("TUNE:") == 0) { // tune:0,false;
|
||||
sscanf(rx.c_str(), "TUNE:%d,%s", &rxnbr, szstr);
|
||||
else if ((p = rx.find("TUNE:")) != std::string::npos) { // tune:0,false;
|
||||
sscanf(rx.substr(p).c_str(), "TUNE:%d,%s", &rxnbr, szstr);
|
||||
str = szstr;
|
||||
if (rxnbr == 0) {
|
||||
slice_0.tune = (str == "TRUE;");
|
||||
|
|
@ -186,12 +189,12 @@ void handle_message(const std::string & message)
|
|||
slice_1.tune = (str == "TRUE;");
|
||||
}
|
||||
}
|
||||
else if (rx.find("TX_POWER:") == 0) { // tx_power:4.3;
|
||||
sscanf(rx.c_str(), "TX_POWER:%f", &fval);
|
||||
else if ((p = rx.find("TX_POWER:")) != std::string::npos) { // tx_power:4.3;
|
||||
sscanf(rx.substr(p).c_str(), "TX_POWER:%f", &fval);
|
||||
slice_0.tx_power = fval;
|
||||
}
|
||||
else if (rx.find("TX_SWR:") == 0) { // tx_swr:1.3;
|
||||
sscanf(rx.c_str(), "TX_SWR:%f", &fval);
|
||||
else if ((p = rx.find("TX_SWR:")) != std::string::npos) { // tx_swr:1.3;
|
||||
sscanf(rx.substr(p).c_str(), "TX_SWR:%f", &fval);
|
||||
slice_0.tx_swr = fval;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue