Autostart

* Changes to transceiver autostart methods in supported
    transceivers
This commit is contained in:
David Freese 2020-12-16 16:49:25 -06:00
parent f197ce68ff
commit b9030b3184
17 changed files with 252 additions and 162 deletions

View file

@ -368,4 +368,8 @@ extern Fl_Tree *tab_tree;
extern void select_tab(const char *);
extern void update_progress(int);
extern bool xcvr_online;
#endif

View file

@ -862,7 +862,12 @@ void RIG_FT450::set_xcvr_auto_on()
cmd = "ID;";
sendCommand(cmd);
// wait 1 to 2 seconds
MilliSleep(1500);
// wake up time for initialization
for (int i = 0; i < 1500; i += 100) {
MilliSleep(100);
update_progress(100 * i / 5000);
Fl::awake();
}
cmd = "PS1;";
sendCommand(cmd);
// wait for power on status

View file

@ -1408,9 +1408,23 @@ void RIG_FT891::set_xcvr_auto_on()
if (p == string::npos) { // rig is off, power on
cmd = "PS1;";
sendCommand(cmd);
MilliSleep(1500); // 1.0 < T < 2.0 seconds
// wake up time for initialization
for (int i = 0; i < 1500; i += 100) {
MilliSleep(100);
update_progress(100 * i / 6000);
Fl::awake();
}
for (int i = 1500; i < 3000; i += 100) {
MilliSleep(100);
update_progress(100 * i / 6000);
Fl::awake();
}
sendCommand(cmd);
MilliSleep(3000); // Wait for rig startup? Maybe not needed.
for (int i = 3000; i < 6000; i += 100) {
MilliSleep(100);
update_progress(100 * i / 6000);
Fl::awake();
}
}
}

View file

@ -1552,9 +1552,17 @@ void RIG_FT950::set_xcvr_auto_on()
if (p == string::npos) { // rig is off, power on
cmd = "PS1;";
sendCommand(cmd);
MilliSleep(1500); // 1.0 < T < 2.0 seconds
for (int i = 0; i < 1500; i += 100) {
MilliSleep(100);
update_progress(100 * i / 4500);
Fl::awake();
}
sendCommand(cmd);
MilliSleep(3000); // Wait for rig startup? Maybe not needed.
for (int i = 1500; i < 4500; i += 100) {
MilliSleep(100);
update_progress(100 * i / 4500);
Fl::awake();
}
}
}

View file

@ -1368,10 +1368,23 @@ void RIG_FT991A::set_xcvr_auto_on()
if (p == string::npos) { // rig is off, power on
cmd = "PS1;";
sendCommand(cmd);
MilliSleep(1100); // 1.0 < T < 2.0 seconds
for (int i = 0; i < 1500; i += 100) {
MilliSleep(100);
update_progress(100 * i / 4500);
Fl::awake();
}
sendCommand(cmd);
for (int i = 2500; i < 3000; i += 100) {
MilliSleep(100);
update_progress(100 * i / 4500);
Fl::awake();
}
sendCommand(cmd);
MilliSleep(3000); // Wait for rig startup? Maybe not needed.
for (int i = 3000; i < 4500; i += 100) {
MilliSleep(100);
update_progress(100 * i / 4500);
Fl::awake();
}
}
sett("set_xcvr_auto_on");
}

View file

@ -228,7 +228,11 @@ void RIG_FTdx101D::set_xcvr_auto_on()
cmd = "ID;";
sendCommand(cmd);
// wait 1 to 2 seconds
MilliSleep(1500);
for (int i = 0; i < 1500; i += 100) {
MilliSleep(100);
update_progress(100 * i / 1500);
Fl::awake();
}
cmd = "PS1;";
sendCommand(cmd);
// wait for power on status

View file

@ -1545,9 +1545,17 @@ void RIG_FTdx1200::set_xcvr_auto_on()
if (p == string::npos) { // rig is off, power on
cmd = "PS1;";
sendCommand(cmd);
MilliSleep(1500); // 1.0 < T < 2.0 seconds
for (int i = 0; i < 1500; i += 100) {
MilliSleep(100);
update_progress(100 * i / 4500);
Fl::awake();
}
sendCommand(cmd);
MilliSleep(3000); // Wait for rig startup? Maybe not needed.
for (int i = 1500; i < 4500; i += 100) {
MilliSleep(100);
update_progress(100 * i / 4500);
Fl::awake();
}
}
}

View file

@ -297,20 +297,25 @@ void RIG_IC705::swapAB()
void RIG_IC705::set_xcvr_auto_on()
{
cmd.clear();
int fes[] = { 2, 2, 2, 3, 7, 13, 25, 50, 75, 150, 150, 150 };
if (progStatus.comm_baudrate >= 0 && progStatus.comm_baudrate <= 11) {
cmd.append( fes[progStatus.comm_baudrate], '\xFE');
}
cmd.append(pre_to);
cmd += '\x18'; cmd += '\x01';
cmd.append(post);
waitFB("Power ON", 200);
cmd = pre_to;
cmd += '\x19'; cmd += '\x00';
cmd.append(post);
waitFOR(8, "get ID", 10000);
if (waitFOR(8, "get ID", 100) == false) {
cmd.clear();
int fes[] = { 2, 2, 2, 3, 7, 13, 25, 50, 75, 150, 150, 150 };
if (progStatus.comm_baudrate >= 0 && progStatus.comm_baudrate <= 11) {
cmd.append( fes[progStatus.comm_baudrate], '\xFE');
}
cmd.append(pre_to);
cmd += '\x18'; cmd += '\x01';
cmd.append(post);
waitFB("Power ON", 200);
for (int i = 0; i < 5000; i += 100) {
MilliSleep(100);
update_progress(100 * i / 5000);
Fl::awake();
}
}
}
void RIG_IC705::set_xcvr_auto_off()
@ -1975,7 +1980,7 @@ void RIG_IC705::setVfoAdj(double v)
cmd.assign(pre_to);
cmd.append("\x1A\x05");
cmd += '\x00';
cmd += '\x58';
cmd += '\x89';
cmd.append(bcd255(int(v)));
cmd.append(post);
waitFB("SET vfo adjust");
@ -1986,7 +1991,7 @@ double RIG_IC705::getVfoAdj()
cmd.assign(pre_to);
cmd.append("\x1A\x05");
cmd += '\x00';
cmd += '\x58';
cmd += '\x89';
cmd.append(post);
if (waitFOR(11, "get vfo adj")) {

View file

@ -24,6 +24,7 @@
#include <sstream>
#include "tod_clock.h"
#include "support.h"
//=============================================================================
// IC-7100
@ -274,7 +275,6 @@ RIG_IC7100::RIG_IC7100() {
//======================================================================
// IC7100 unique commands
//======================================================================
extern void update_progress(int);
void RIG_IC7100::set_xcvr_auto_on()
{
@ -282,24 +282,26 @@ void RIG_IC7100::set_xcvr_auto_on()
progStatus.comm_baudrate == 5 ? 13 :
progStatus.comm_baudrate == 4 ? 7 :
progStatus.comm_baudrate == 3 ? 3 : 2;
cmd.assign( nr, '\xFE');
cmd.append(pre_to);
cmd += '\x18'; cmd += '\x01';
cmd.append(post);
waitFB("Power ON", 2000);
int msec = 5000; // wake up time for initialization
for (int i = 0; i < msec; i += 100) {
MilliSleep(100);
update_progress(progress->value() + 2);
Fl::awake();
}
cmd.assign(pre_to);
cmd += '\x19'; cmd += '\x00';
cmd.append(post);
std::string again = cmd;
waitFOR(8, "get ID", 100);
if (waitFOR(8, "get ID", 100) == false) { // xcvr must be OFF
cmd.assign( nr, '\xFE');
cmd.append(pre_to);
cmd += '\x18'; cmd += '\x01';
cmd.append(post);
waitFB("Power ON", 2000);
isett("Power ON");
// wake up time for initialization
for (int i = 0; i < 5000; i += 100) {
MilliSleep(100);
update_progress(100 * i / 5000);
Fl::awake();
}
}
return;
}
void RIG_IC7100::set_xcvr_auto_off()
@ -308,10 +310,8 @@ void RIG_IC7100::set_xcvr_auto_off()
cmd.append(pre_to);
cmd += '\x18'; cmd += '\x00';
cmd.append(post);
//std::cout << ztime() << " Power OFF " << hexstr(cmd).c_str() << std::endl;
waitFB("Power OFF", 200);
// isett("Power OFF");
//std::cout << ztime() << " Power OFF " << hexstr(replystr).c_str() << std::endl;
isett("Power OFF");
}
bool RIG_IC7100::check ()

View file

@ -296,20 +296,25 @@ void RIG_IC7300::swapAB()
void RIG_IC7300::set_xcvr_auto_on()
{
cmd.clear();
int fes[] = { 2, 2, 2, 3, 7, 13, 25, 50, 75, 150, 150, 150 };
if (progStatus.comm_baudrate >= 0 && progStatus.comm_baudrate <= 11) {
cmd.append( fes[progStatus.comm_baudrate], '\xFE');
}
cmd.append(pre_to);
cmd += '\x18'; cmd += '\x01';
cmd.append(post);
waitFB("Power ON", 200);
cmd = pre_to;
cmd += '\x19'; cmd += '\x00';
cmd.append(post);
waitFOR(8, "get ID", 10000);
if (waitFOR(8, "get ID", 100) == false) {
cmd.clear();
int fes[] = { 2, 2, 2, 3, 7, 13, 25, 50, 75, 150, 150, 150 };
if (progStatus.comm_baudrate >= 0 && progStatus.comm_baudrate <= 11) {
cmd.append( fes[progStatus.comm_baudrate], '\xFE');
}
cmd.append(pre_to);
cmd += '\x18'; cmd += '\x01';
cmd.append(post);
waitFB("Power ON", 200);
for (int i = 0; i < 5000; i += 100) {
MilliSleep(100);
update_progress(100 * i / 5000);
Fl::awake();
}
}
}
void RIG_IC7300::set_xcvr_auto_off()

View file

@ -316,20 +316,25 @@ void RIG_IC7610::swapAB()
void RIG_IC7610::set_xcvr_auto_on()
{
cmd.clear();
int fes[] = { 2, 2, 2, 3, 7, 13, 25, 50, 75, 150, 150, 150 };
if (progStatus.comm_baudrate >= 0 && progStatus.comm_baudrate <= 11) {
cmd.append( fes[progStatus.comm_baudrate], '\xFE');
}
cmd.append(pre_to);
cmd += '\x18'; cmd += '\x01';
cmd.append(post);
waitFB("Power ON", 200);
cmd = pre_to;
cmd += '\x19'; cmd += '\x00';
cmd.append(post);
waitFOR(8, "get ID", 10000);
if (waitFOR(8, "get ID", 100) == false) {
cmd.clear();
int fes[] = { 2, 2, 2, 3, 7, 13, 25, 50, 75, 150, 150, 150 };
if (progStatus.comm_baudrate >= 0 && progStatus.comm_baudrate <= 11) {
cmd.append( fes[progStatus.comm_baudrate], '\xFE');
}
cmd.append(pre_to);
cmd += '\x18'; cmd += '\x01';
cmd.append(post);
waitFB("Power ON", 200);
for (int i = 0; i < 5000; i += 100) {
MilliSleep(100);
update_progress(100 * i / 5000);
Fl::awake();
}
}
}
void RIG_IC7610::set_xcvr_auto_off()

View file

@ -222,20 +222,25 @@ void RIG_IC7851::selectB()
void RIG_IC7851::set_xcvr_auto_on()
{
cmd.clear();
int fes[] = { 2, 2, 2, 3, 7, 13, 25, 50, 75, 150, 150, 150 };
if (progStatus.comm_baudrate >= 0 && progStatus.comm_baudrate <= 11) {
cmd.append( fes[progStatus.comm_baudrate], '\xFE');
}
cmd.append(pre_to);
cmd += '\x18'; cmd += '\x01';
cmd.append(post);
waitFB("Power ON", 200);
cmd = pre_to;
cmd += '\x19'; cmd += '\x00';
cmd.append(post);
waitFOR(8, "get ID", 10000);
if (waitFOR(8, "get ID", 100) == false) {
cmd.clear();
int fes[] = { 2, 2, 2, 3, 7, 13, 25, 50, 75, 150, 150, 150 };
if (progStatus.comm_baudrate >= 0 && progStatus.comm_baudrate <= 11) {
cmd.append( fes[progStatus.comm_baudrate], '\xFE');
}
cmd.append(pre_to);
cmd += '\x18'; cmd += '\x01';
cmd.append(post);
waitFB("Power ON", 200);
for (int i = 0; i < 5000; i += 100) {
MilliSleep(100);
update_progress(100 * i / 5000);
Fl::awake();
}
}
}
void RIG_IC7851::set_xcvr_auto_off()

View file

@ -264,21 +264,25 @@ void RIG_IC9700::selectB()
void RIG_IC9700::set_xcvr_auto_on()
{
cmd.clear();
cmd.append(
(progStatus.comm_baudrate == 6 ? 25 :
progStatus.comm_baudrate == 5 ? 13 :
progStatus.comm_baudrate == 4 ? 7 :
progStatus.comm_baudrate == 3 ? 3 : 2), '\xFE');
cmd.append(pre_to);
cmd += '\x18'; cmd += '\x01';
cmd.append(post);
waitFB("Power ON", 200);
cmd = pre_to;
cmd += '\x19'; cmd += '\x00';
cmd.append(post);
waitFOR(8, "get ID", 10000);
if (waitFOR(8, "get ID", 100) == false) {
cmd.clear();
int fes[] = { 2, 2, 2, 3, 7, 13, 25, 50, 75, 150, 150, 150 };
if (progStatus.comm_baudrate >= 0 && progStatus.comm_baudrate <= 11) {
cmd.append( fes[progStatus.comm_baudrate], '\xFE');
}
cmd.append(pre_to);
cmd += '\x18'; cmd += '\x01';
cmd.append(post);
waitFB("Power ON", 200);
for (int i = 0; i < 5000; i += 100) {
MilliSleep(100);
update_progress(100 * i / 5000);
Fl::awake();
}
}
}
void RIG_IC9700::set_xcvr_auto_off()

View file

@ -106,6 +106,7 @@ bool RIG_ICOM::waitFB(const char *sz, int timeout)
guard_lock cmd_lock(&command_mutex);
guard_lock reply_lock(&mutex_replystr);
//std::cout << ztime() << " waitFB( " << sz << ", " << timeout << " ): " << str2hex(cmd.c_str(), cmd.length()) << std::endl;
char sztemp[100];
string returned = "";
@ -142,6 +143,7 @@ bool RIG_ICOM::waitFB(const char *sz, int timeout)
unsigned long int waited = zmsec() - msec_start;
snprintf(sztemp, sizeof(sztemp), "%s ans in %ld ms, OK", sz, waited);
showresp(DEBUG, HEX, sztemp, tosend, returned);
//std::cout << ztime() << " Response: " << str2hex(returned.c_str(), returned.length()) << std::endl;
return true;
}
if (returned.find(bad) != string::npos) {
@ -149,6 +151,7 @@ bool RIG_ICOM::waitFB(const char *sz, int timeout)
unsigned long int waited = zmsec() - msec_start;
snprintf(sztemp, sizeof(sztemp), "%s ans in %ld ms, FAILED", sz, waited);
showresp(ERR, HEX, sztemp, tosend, returned);
//std::cout << ztime() << " ERROR: " << str2hex(returned.c_str(), returned.length()) << std::endl;
return false;
}
readResponse();
@ -159,6 +162,7 @@ bool RIG_ICOM::waitFB(const char *sz, int timeout)
replystr = returned;
snprintf(sztemp, sizeof(sztemp), "%s TIMED OUT : %d ms", sz, diff);
showresp(ERR, HEX, sztemp, tosend, returned);
//std::cout << ztime() << " TIMED OUT: " << str2hex(returned.c_str(), returned.length()) << std::endl;
return false;
}
@ -169,6 +173,8 @@ bool RIG_ICOM::waitFOR(size_t n, const char *sz, int timeout)
guard_lock reply_lock(&mutex_replystr);
//std::cout << ztime() << " waitFOR( " << n << ", " << sz << ", " << timeout << " ): " << str2hex(cmd.c_str(), cmd.length()) << std::endl;
char sztemp[100];
string returned = "";
string tosend = cmd;
@ -178,7 +184,6 @@ bool RIG_ICOM::waitFOR(size_t n, const char *sz, int timeout)
unsigned long int msec_start;
unsigned long int repeat_start;
unsigned long int loop_start;
int delay = progStatus.use_tcpip ? progStatus.tcpip_ping_delay : 0;
delay += 100;
@ -193,33 +198,33 @@ bool RIG_ICOM::waitFOR(size_t n, const char *sz, int timeout)
repeat_start = zmsec();
respstr.clear();
sendCommand(tosend, 0);
returned = respstr;
while (int(zmsec() - repeat_start) < timeout) {
sendCommand(tosend, 0);
returned = respstr;//""; // sendCommand captures xcvr response in respstr
loop_start = zmsec();
diff = zmsec() - loop_start;
while ( diff < delay + 10 ) {
if (returned.find(bad) != string::npos) {
snprintf(sztemp, sizeof(sztemp), "%s : %d ms", sz, int(zmsec() - msec_start));
showresp(ERR, HEX, sztemp, tosend, returned);
return false;
}
if (returned.length() >= num) {
replystr = returned;
snprintf(sztemp, sizeof(sztemp), "%s : %d ms", sz, int(zmsec() - msec_start));
showresp(DEBUG, HEX, sztemp, tosend, returned);
return true;
}
if (readResponse())
returned.append(respstr);
diff = zmsec() - loop_start;
if (returned.find(bad) != string::npos) {
snprintf(sztemp, sizeof(sztemp), "%s : %d ms", sz, int(zmsec() - msec_start));
showresp(ERR, HEX, sztemp, tosend, returned);
//std::cout << ztime() << " ERROR: " << str2hex(returned.c_str(), returned.length()) << std::endl;
return false;
}
if (returned.length() >= num) {
replystr = returned;
snprintf(sztemp, sizeof(sztemp), "%s : %d ms", sz, int(zmsec() - msec_start));
showresp(DEBUG, HEX, sztemp, tosend, returned);
//std::cout << ztime() << " Response: " << str2hex(returned.c_str(), returned.length()) << std::endl;
return true;
}
if (readResponse())
returned.append(respstr);
}
diff = zmsec() - msec_start;
replystr = returned;
snprintf(sztemp, sizeof(sztemp), "%s TIMED OUT : %d ms", sz, diff);
showresp(ERR, HEX, sztemp, tosend, returned);
//std::cout << ztime() << " " << sztemp << " " << str2hex(returned.c_str(), returned.length()) << std::endl;
return false;
}

View file

@ -1518,9 +1518,15 @@ void RIG_Xiegu_G90::set_xcvr_auto_on()
cmd.append(pre_to);
cmd += '\x18'; cmd += '\x01';
cmd.append(post);
waitFB("Power ON", 2000);
waitFB("Power ON", 200);
isett("Power ON");
for (int i = 0; i < 5000; i += 100) {
MilliSleep(100);
update_progress(100 * i / 5000);
Fl::awake();
}
cmd = pre_to;
cmd += '\x19'; cmd += '\x00';
cmd.append(post);

View file

@ -56,8 +56,6 @@ using namespace XmlRpc;
// The server
XmlRpcServer rig_server;
extern bool xcvr_initialized;
//------------------------------------------------------------------------------
// Request for program version
//------------------------------------------------------------------------------
@ -81,7 +79,7 @@ public:
rig_get_xcvr(XmlRpcServer* s) : XmlRpcServerMethod("rig.get_xcvr", s) {}
void execute(XmlRpcValue& params, XmlRpcValue& result) {
if (!xcvr_initialized)
if (!xcvr_online)
result = "";
else
result = selrig->name_;
@ -201,7 +199,7 @@ public:
void execute(XmlRpcValue& params, XmlRpcValue& result) {
string info = "";
if (!xcvr_initialized) {
if (!xcvr_online) {
result = info;
return;
}
@ -233,7 +231,7 @@ public:
string info; info.clear();
string temp; temp.clear();
if (!xcvr_initialized) {
if (!xcvr_online) {
result = info;
return;
}
@ -325,7 +323,7 @@ public:
rig_get_vfo(XmlRpcServer* s) : XmlRpcServerMethod("rig.get_vfo", s) {}
void execute(XmlRpcValue& params, XmlRpcValue& result) {
if (!xcvr_initialized) {
if (!xcvr_online) {
result = "14070000";
return;
}
@ -364,7 +362,7 @@ public:
rig_get_vfoA(XmlRpcServer* s) : XmlRpcServerMethod("rig.get_vfoA", s) {}
void execute(XmlRpcValue& params, XmlRpcValue& result) {
if (!xcvr_initialized) {
if (!xcvr_online) {
result = "14070000";
return;
}
@ -394,7 +392,7 @@ public:
rig_get_vfoB(XmlRpcServer* s) : XmlRpcServerMethod("rig.get_vfoB", s) {}
void execute(XmlRpcValue& params, XmlRpcValue& result) {
if (!xcvr_initialized) {
if (!xcvr_online) {
result = "14070000";
return;
}
@ -425,7 +423,7 @@ public:
rig_get_AB(XmlRpcServer* s) : XmlRpcServerMethod("rig.get_AB", s) {}
void execute(XmlRpcValue& params, XmlRpcValue& result) {
if (!xcvr_initialized) {
if (!xcvr_online) {
result = "A";
return;
}
@ -450,7 +448,7 @@ public:
rig_get_notch(XmlRpcServer* s) : XmlRpcServerMethod("rig.get_notch", s) {}
void execute(XmlRpcValue& params, XmlRpcValue& result) {
if (!xcvr_initialized) {
if (!xcvr_online) {
result = 0;
return;
}
@ -473,7 +471,7 @@ public:
rig_set_notch(XmlRpcServer* s) : XmlRpcServerMethod("rig.set_notch", s) {}
void execute(XmlRpcValue& params, XmlRpcValue& result) {
if (!xcvr_initialized) {
if (!xcvr_online) {
result = 0;
return;
}
@ -505,7 +503,7 @@ public:
rig_get_rfgain(XmlRpcServer* s) : XmlRpcServerMethod("rig.get_rfgain", s) {}
void execute(XmlRpcValue& params, XmlRpcValue& result) {
if (!xcvr_initialized) {
if (!xcvr_online) {
result = 0;
return;
}
@ -528,7 +526,7 @@ public:
rig_set_rfgain(XmlRpcServer* s) : XmlRpcServerMethod("rig.set_rfgain", s) {}
void execute(XmlRpcValue& params, XmlRpcValue& result) {
if (!xcvr_initialized) {
if (!xcvr_online) {
result = 0;
return;
}
@ -556,7 +554,7 @@ public:
rig_get_micgain(XmlRpcServer* s) : XmlRpcServerMethod("rig.get_micgain", s) {}
void execute(XmlRpcValue& params, XmlRpcValue& result) {
if (!xcvr_initialized) {
if (!xcvr_online) {
result = 0;
return;
}
@ -579,7 +577,7 @@ public:
rig_set_micgain(XmlRpcServer* s) : XmlRpcServerMethod("rig.set_micgain", s) {}
void execute(XmlRpcValue& params, XmlRpcValue& result) {
if (!xcvr_initialized) {
if (!xcvr_online) {
result = 0;
return;
}
@ -607,7 +605,7 @@ public:
rig_get_volume(XmlRpcServer* s) : XmlRpcServerMethod("rig.get_volume", s) {}
void execute(XmlRpcValue& params, XmlRpcValue& result) {
if (!xcvr_initialized) {
if (!xcvr_online) {
result = 0;
return;
}
@ -630,7 +628,7 @@ public:
rig_set_volume(XmlRpcServer* s) : XmlRpcServerMethod("rig.set_volume", s) {}
void execute(XmlRpcValue& params, XmlRpcValue& result) {
if (!xcvr_initialized) {
if (!xcvr_online) {
result = 0;
return;
}
@ -659,7 +657,7 @@ public :
void execute(XmlRpcValue& params, XmlRpcValue& result) {
XmlRpcValue modes;
if (!xcvr_initialized || !selrig->modes_) {
if (!xcvr_online || !selrig->modes_) {
modes[0] = "CW";
modes[1] = "LSB";
modes[2] = "USB";
@ -692,7 +690,7 @@ public:
void execute(XmlRpcValue& params, XmlRpcValue& result) {
if (!xcvr_initialized) {
if (!xcvr_online) {
result = "U";
return;
}
@ -723,7 +721,7 @@ public:
rig_get_mode(XmlRpcServer* s) : XmlRpcServerMethod("rig.get_mode", s) {}
void execute(XmlRpcValue& params, XmlRpcValue& result) {
if (!xcvr_initialized) {
if (!xcvr_online) {
result = "USB";
return;
}
@ -754,7 +752,7 @@ public:
rig_get_modeA(XmlRpcServer* s) : XmlRpcServerMethod("rig.get_modeA", s) {}
void execute(XmlRpcValue& params, XmlRpcValue& result) {
if (!xcvr_initialized) {
if (!xcvr_online) {
result = "USB";
return;
}
@ -785,7 +783,7 @@ public:
rig_get_modeB(XmlRpcServer* s) : XmlRpcServerMethod("rig.get_modeB", s) {}
void execute(XmlRpcValue& params, XmlRpcValue& result) {
if (!xcvr_initialized) {
if (!xcvr_online) {
result = "USB";
return;
}
@ -817,7 +815,7 @@ public :
void execute(XmlRpcValue& params, XmlRpcValue& result) {
if (!xcvr_initialized || !selrig->bandwidths_) {
if (!xcvr_online || !selrig->bandwidths_) {
XmlRpcValue bws;
bws[0][0] = "Bandwidth";
bws[0][1] = "NONE";
@ -886,7 +884,7 @@ public:
result[0] = "NONE";
result[1] = "";
if (!xcvr_initialized) return;
if (!xcvr_online) return;
wait();
guard_lock service_lock(&mutex_srvc_reqs, "xml rig_get_bw");
@ -945,7 +943,7 @@ public:
result[0] = "NONE";
result[1] = "";
if (!xcvr_initialized) return;
if (!xcvr_online) return;
wait();
guard_lock service_lock(&mutex_srvc_reqs, "xml rig_get_bwA");
@ -1005,7 +1003,7 @@ public:
result[0] = "NONE";
result[1] = "";
if (!xcvr_initialized) return;
if (!xcvr_online) return;
wait();
guard_lock service_lock(&mutex_srvc_reqs, "xml rig_get_bwA");
@ -1056,7 +1054,7 @@ public:
rig_get_smeter(XmlRpcServer* s) : XmlRpcServerMethod("rig.get_smeter", s) {}
void execute(XmlRpcValue& params, XmlRpcValue& result) {
if (!xcvr_initialized || !selrig->has_smeter)
if (!xcvr_online || !selrig->has_smeter)
result = (int)(0);
else
result = (int)(mval);
@ -1068,7 +1066,7 @@ public:
rig_get_pwrmeter_scale(XmlRpcServer* s) : XmlRpcServerMethod("rig.get_pwrmeter_scale", s) {}
void execute(XmlRpcValue& params, XmlRpcValue& result) {
if (!xcvr_initialized || !selrig->has_power_out)
if (!xcvr_online || !selrig->has_power_out)
result = (int)(0);
else
result = (int)(selrig->power_scale());
@ -1080,7 +1078,7 @@ public:
rig_get_pwrmeter(XmlRpcServer* s) : XmlRpcServerMethod("rig.get_pwrmeter", s) {}
void execute(XmlRpcValue& params, XmlRpcValue& result) {
if (!xcvr_initialized || !selrig->has_power_out)
if (!xcvr_online || !selrig->has_power_out)
result = (int)(0);
else
result = (int)(pwrval);
@ -1092,7 +1090,7 @@ public:
rig_get_swrmeter(XmlRpcServer* s) : XmlRpcServerMethod("rig.get_swrmeter", s) {}
void execute(XmlRpcValue& params, XmlRpcValue& result) {
if (!xcvr_initialized || !selrig->has_swr_control)
if (!xcvr_online || !selrig->has_swr_control)
result = (int)(0);
else
result = (int)(swrval);
@ -1183,7 +1181,7 @@ public:
rig_set_power(XmlRpcServer* s) : XmlRpcServerMethod("rig.set_power", s) {}
void execute(XmlRpcValue& params, XmlRpcValue& result) {
if (!xcvr_initialized) {
if (!xcvr_online) {
result = 0;
return;
}
@ -1203,7 +1201,7 @@ public:
rig_set_ptt(XmlRpcServer* s) : XmlRpcServerMethod("rig.set_ptt", s) {}
void execute(XmlRpcValue& params, XmlRpcValue& result) {
if (!xcvr_initialized) {
if (!xcvr_online) {
result = 0;
return;
}
@ -1235,7 +1233,7 @@ public:
rig_swap(XmlRpcServer* s) : XmlRpcServerMethod("rig.swap", s) {}
void execute(XmlRpcValue& params, XmlRpcValue& result) {
if (!xcvr_initialized) {
if (!xcvr_online) {
result = 0;
return;
}
@ -1257,7 +1255,7 @@ public:
rig_set_swap(XmlRpcServer* s) : XmlRpcServerMethod("rig.set_swap", s) {}
void execute(XmlRpcValue& params, XmlRpcValue& result) {
if (!xcvr_initialized) {
if (!xcvr_online) {
result = 0;
return;
}
@ -1283,7 +1281,7 @@ public:
rig_set_split(XmlRpcServer* s) : XmlRpcServerMethod("rig.set_split", s) {}
void execute(XmlRpcValue& params, XmlRpcValue& result) {
if (!xcvr_initialized) {
if (!xcvr_online) {
result = 0;
return;
}
@ -1323,7 +1321,7 @@ public:
rig_set_AB(XmlRpcServer* s) : XmlRpcServerMethod("rig.set_AB", s) {}
void execute(XmlRpcValue& params, XmlRpcValue& result) {
if (!xcvr_initialized) {
if (!xcvr_online) {
result = 0;
return;
}
@ -1360,7 +1358,7 @@ public:
rig_set_vfoA(XmlRpcServer* s) : XmlRpcServerMethod("rig.set_vfoA", s) {}
void execute(XmlRpcValue& params, XmlRpcValue& result) {
if (!xcvr_initialized) {
if (!xcvr_online) {
result = 0;
return;
}
@ -1385,7 +1383,7 @@ public:
rig_set_vfoB(XmlRpcServer* s) : XmlRpcServerMethod("rig.set_vfoB", s) {}
void execute(XmlRpcValue& params, XmlRpcValue& result) {
if (!xcvr_initialized) {
if (!xcvr_online) {
result = 0;
return;
}
@ -1410,7 +1408,7 @@ public:
rig_set_vfo(XmlRpcServer* s) : XmlRpcServerMethod("rig.set_vfo", s) {}
void execute(XmlRpcValue& params, XmlRpcValue& result) {
if (!xcvr_initialized) {
if (!xcvr_online) {
result = 0;
return;
}
@ -1443,7 +1441,7 @@ public:
main_set_frequency(XmlRpcServer* s) : XmlRpcServerMethod("main.set_frequency", s) {}
void execute(XmlRpcValue& params, XmlRpcValue& result) {
if (!xcvr_initialized) {
if (!xcvr_online) {
result = 0;
return;
}
@ -1475,7 +1473,7 @@ public:
rig_set_frequency(XmlRpcServer* s) : XmlRpcServerMethod("rig.set_frequency", s) {}
void execute(XmlRpcValue& params, XmlRpcValue& result) {
if (!xcvr_initialized) {
if (!xcvr_online) {
result = 0;
return;
}
@ -1511,7 +1509,7 @@ public:
rig_set_mode(XmlRpcServer* s) : XmlRpcServerMethod("rig.set_mode", s) {}
void execute(XmlRpcValue& params, XmlRpcValue &result) {
if (!xcvr_initialized) {
if (!xcvr_online) {
result = 0;
return;
}
@ -1565,7 +1563,7 @@ public:
rig_set_modeA(XmlRpcServer* s) : XmlRpcServerMethod("rig.set_modeA", s) {}
void execute(XmlRpcValue& params, XmlRpcValue &result) {
if (!xcvr_initialized) {
if (!xcvr_online) {
result = 0;
return;
}
@ -1624,7 +1622,7 @@ public:
rig_set_modeB(XmlRpcServer* s) : XmlRpcServerMethod("rig.set_modeB", s) {}
void execute(XmlRpcValue& params, XmlRpcValue &result) {
if (!xcvr_initialized) {
if (!xcvr_online) {
result = 0;
return;
}
@ -1683,7 +1681,7 @@ public:
rig_set_bandwidth(XmlRpcServer* s) : XmlRpcServerMethod("rig.set_bandwidth", s) {}
void execute(XmlRpcValue& params, XmlRpcValue& result) {
if (!xcvr_initialized) {
if (!xcvr_online) {
result = 0;
return;
}
@ -1722,7 +1720,7 @@ public:
rig_set_bw(XmlRpcServer* s) : XmlRpcServerMethod("rig.set_bw", s) {}
void execute(XmlRpcValue& params, XmlRpcValue& result) {
if (!xcvr_initialized) {
if (!xcvr_online) {
result = 0;
return;
}
@ -1756,7 +1754,7 @@ public:
rig_set_BW(XmlRpcServer* s) : XmlRpcServerMethod("rig.set_BW", s) {}
void execute(XmlRpcValue& params, XmlRpcValue& result) {
if (!xcvr_initialized) {
if (!xcvr_online) {
result = 0;
return;
}
@ -1797,7 +1795,7 @@ public:
void execute(XmlRpcValue& params, XmlRpcValue& result) {
result = 0;
if (!xcvr_initialized) {
if (!xcvr_online) {
return;
}
std::string command = std::string(params[0]);
@ -1847,7 +1845,7 @@ public:
void execute(XmlRpcValue& params, XmlRpcValue& result) {
result = 0;
if (!xcvr_initialized) {
if (!xcvr_online) {
return;
}
std::string command = std::string(params[0]);
@ -1972,7 +1970,7 @@ public:
rig_shutdown(XmlRpcServer* s) : XmlRpcServerMethod("rig.shutdown", s) {}
void execute(XmlRpcValue& params, XmlRpcValue& result) {
if (!xcvr_initialized) {
if (!xcvr_online) {
result = 0;
return;
}

View file

@ -107,7 +107,7 @@ bool using_buttons = false;
enum { SWR_IMAGE, ALC_IMAGE };
int meter_image = SWR_IMAGE;
bool xcvr_initialized = false;
bool xcvr_online = false;
//======================================================================
// slider change processing
@ -3388,10 +3388,11 @@ void close_UI()
void closeRig()
{
trace(1, "closeRig()");
if (xcvr_initialized) {
if (xcvr_online) {
restore_rig_vals();
selrig->shutdown();
}
xcvr_online = false;
}
void cbExit()
@ -5727,7 +5728,7 @@ void init_K3_KX3_special()
void initRig()
{
xcvr_initialized = false;
xcvr_online = false;
if (tabs_dialog && tabs_dialog->visible()) tabs_dialog->hide();
main_group->hide();
@ -5862,11 +5863,11 @@ void initRig()
Fl::flush();
// Fl::check();
xcvr_initialized = true;
xcvr_online = true;
return;
failed:
xcvr_initialized = false;
xcvr_online = false;
adjust_control_positions();
grpInitializing->hide();
main_group->show();