mirror of
https://git.code.sf.net/p/fldigi/flrig
synced 2026-08-13 17:28:24 -04:00
Check PTT
* add check for NON CAT ptt configuration
This commit is contained in:
parent
d727697f6f
commit
e59e9b7282
5 changed files with 84 additions and 28 deletions
|
|
@ -30,5 +30,6 @@ extern void unexport_gpio(int bcm);
|
|||
extern void open_gpio(void);
|
||||
extern void close_gpio(void);
|
||||
extern void set_gpio(bool ptt);
|
||||
extern int get_gpio();
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -62,18 +62,20 @@ public:
|
|||
void setRTS(bool r);
|
||||
|
||||
void RTSptt(bool b){rtsptt = b;}
|
||||
bool RTSptt(){return rtsptt;}
|
||||
bool RTSptt();
|
||||
|
||||
void DTR(bool d){dtr = d;}
|
||||
void DTR(bool d){ dtr = d; }
|
||||
bool DTR(){return dtr;}
|
||||
void setDTR(bool d);
|
||||
|
||||
void DTRptt(bool b){dtrptt = b;}
|
||||
bool DTRptt(){return dtrptt;}
|
||||
bool DTRptt();
|
||||
|
||||
void RTSCTS(bool b){rtscts = b;}
|
||||
bool RTSCTS(){return rtscts;}
|
||||
|
||||
void SetPTT(bool b);
|
||||
bool getPTT();
|
||||
|
||||
void Stopbits(int n) {stopbits = (n == 1 ? 1 : 2);}
|
||||
int Stopbits() { return stopbits;}
|
||||
|
|
@ -99,6 +101,7 @@ private:
|
|||
bool rts;
|
||||
bool rtsptt;
|
||||
bool rtscts;
|
||||
bool serptt;
|
||||
int stopbits;
|
||||
char bfr[2048];
|
||||
//Methods
|
||||
|
|
@ -162,18 +165,19 @@ public:
|
|||
void setRTS(bool b);
|
||||
|
||||
void RTSptt(bool b){rtsptt = b;}
|
||||
bool RTSptt(){return rtsptt;}
|
||||
bool RTSptt();
|
||||
|
||||
void DTR(bool d){dtr = d;}
|
||||
bool DTR(){return dtr;}
|
||||
void setDTR(bool b);
|
||||
|
||||
void DTRptt(bool b){dtrptt = b;}
|
||||
bool DTRptt(){return dtrptt;}
|
||||
bool DTRptt();
|
||||
|
||||
void RTSCTS(bool b){rtscts = b;}
|
||||
bool RTSCTS(){return rtscts;}
|
||||
void SetPTT(bool b);
|
||||
bool getPTT();
|
||||
|
||||
void Stopbits(int n) {stopbits = (n == 1 ? 1 : 2);}
|
||||
int Stopbits() { return stopbits;}
|
||||
|
|
@ -212,6 +216,7 @@ private:
|
|||
bool rts;
|
||||
bool rtsptt;
|
||||
bool rtscts;
|
||||
bool serptt;
|
||||
int stopbits;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -112,6 +112,12 @@ void close_gpio(void)
|
|||
}
|
||||
}
|
||||
|
||||
static int enabled = 0;
|
||||
int get_gpio()
|
||||
{
|
||||
return enabled;
|
||||
}
|
||||
|
||||
void set_gpio(bool ptt)
|
||||
{
|
||||
#define VALUE_MAX 30
|
||||
|
|
@ -119,7 +125,7 @@ void set_gpio(bool ptt)
|
|||
|
||||
string portname = "/sys/class/gpio/gpio";
|
||||
string ctrlport;
|
||||
bool enabled = false;
|
||||
enabled = false;
|
||||
int val = 0;
|
||||
int fd;
|
||||
|
||||
|
|
|
|||
|
|
@ -50,9 +50,12 @@ Cserial::Cserial() {
|
|||
baud = 1200;
|
||||
timeout = 50; //msec
|
||||
retries = 5;
|
||||
rts = dtr = false;
|
||||
rtsptt = dtrptt = false;
|
||||
rtscts = false;
|
||||
rts =
|
||||
dtr =
|
||||
rtsptt =
|
||||
dtrptt =
|
||||
rtscts =
|
||||
serptt = false;
|
||||
status = 0;
|
||||
stopbits = 2;
|
||||
fd = -1;
|
||||
|
|
@ -187,6 +190,19 @@ bool Cserial::OpenPort() {
|
|||
// Function name : Cserial::setPTT
|
||||
// Return type : void
|
||||
///////////////////////////////////////////////////////
|
||||
|
||||
bool Cserial::RTSptt(){
|
||||
return rtsptt;
|
||||
}
|
||||
|
||||
bool Cserial::DTRptt(){
|
||||
return dtrptt;
|
||||
}
|
||||
|
||||
bool Cserial::getPTT() {
|
||||
return serptt;
|
||||
}
|
||||
|
||||
void Cserial::SetPTT(bool ON)
|
||||
{
|
||||
if (fd < 0) {
|
||||
|
|
@ -221,6 +237,7 @@ void Cserial::SetPTT(bool ON)
|
|||
#endif
|
||||
ioctl(fd, TIOCMSET, &status);
|
||||
}
|
||||
serptt = ON;
|
||||
// LOG_DEBUG("No ptt specified");
|
||||
}
|
||||
|
||||
|
|
@ -867,6 +884,18 @@ if (bPortReady == 0) {
|
|||
// Function name : Cserial::setPTT
|
||||
// Return type : void
|
||||
///////////////////////////////////////////////////////
|
||||
bool Cserial::RTSptt(){
|
||||
return rtsptt;
|
||||
}
|
||||
|
||||
bool Cserial::DTRptt(){
|
||||
return dtrptt;
|
||||
}
|
||||
|
||||
bool Cserial::getPTT() {
|
||||
return serptt;
|
||||
}
|
||||
|
||||
void Cserial::SetPTT(bool ON)
|
||||
{
|
||||
if (hComm == INVALID_HANDLE_VALUE) {
|
||||
|
|
@ -914,7 +943,7 @@ PTT %d, DTRptt %d, DTR %d, RTSptt %d, RTS %d, RTSCTS %d, DtrControl %2x, RtsCont
|
|||
static_cast<unsigned int>(dcb.fDtrControl),
|
||||
static_cast<unsigned int>(dcb.fRtsControl) );
|
||||
#endif
|
||||
|
||||
serptt = ON;
|
||||
SetCommState(hComm, &dcb);
|
||||
}
|
||||
|
||||
|
|
@ -939,9 +968,12 @@ void Cserial::setRTS(bool b)
|
|||
}
|
||||
|
||||
Cserial::Cserial() {
|
||||
rts = dtr = false;
|
||||
rtsptt = dtrptt = false;
|
||||
rtscts = false;
|
||||
rts =
|
||||
dtr =
|
||||
rtsptt =
|
||||
dtrptt =
|
||||
rtscts =
|
||||
serptt = false;
|
||||
baud = CBR_9600;
|
||||
stopbits = 2;
|
||||
hComm = 0;
|
||||
|
|
|
|||
|
|
@ -53,6 +53,7 @@
|
|||
#include "trace.h"
|
||||
#include "cwio.h"
|
||||
#include "xml_server.h"
|
||||
#include "gpio_ptt.h"
|
||||
|
||||
void initTabs();
|
||||
|
||||
|
|
@ -463,9 +464,7 @@ void read_bandwidth()
|
|||
stringstream s;
|
||||
s << "Bandwidth A change. nu_BW=" << nu_BW << ", vfoA.iBW=" << vfoA.iBW << ", vfo->iBW=" << vfo->iBW;
|
||||
trace(1, s.str().c_str());
|
||||
|
||||
vfoA.iBW = vfo->iBW = nu_BW;
|
||||
// Fl::awake(setBWControl);
|
||||
}
|
||||
} else {
|
||||
trace(2, "vfoB active", "get_bwB()");
|
||||
|
|
@ -474,9 +473,7 @@ void read_bandwidth()
|
|||
stringstream s;
|
||||
s << "Bandwidth B change. nu_BW=" << nu_BW << ", vfoB.iBW=" << vfoB.iBW << ", vfo->iBW=" << vfo->iBW;
|
||||
trace(1, s.str().c_str());
|
||||
|
||||
vfoB.iBW = vfo->iBW = nu_BW;
|
||||
// Fl::awake(setBWControl);
|
||||
}
|
||||
}
|
||||
Fl::awake(setBWControl);
|
||||
|
|
@ -1061,11 +1058,26 @@ void set_ptt(void *);
|
|||
|
||||
void check_ptt()
|
||||
{
|
||||
int check = selrig->get_PTT();
|
||||
if (check != PTT) {
|
||||
PTT = check;
|
||||
Fl::awake(set_ptt, (void *)PTT);
|
||||
int check = 0;
|
||||
|
||||
if (progStatus.comm_catptt) {
|
||||
check = selrig->get_PTT();
|
||||
} else if (progStatus.comm_dtrptt) {
|
||||
check = RigSerial->getPTT();
|
||||
} else if (progStatus.comm_rtsptt) {
|
||||
check = RigSerial->getPTT();
|
||||
} else if (SepSerial->IsOpen() && progStatus.sep_dtrptt) {
|
||||
check = SepSerial->getPTT();
|
||||
} else if (SepSerial->IsOpen() && progStatus.sep_rtsptt) {
|
||||
check = SepSerial->getPTT();
|
||||
} else if (progStatus.gpio_ptt) {
|
||||
check = get_gpio();
|
||||
}
|
||||
|
||||
if (check != PTT)
|
||||
PTT = check;
|
||||
|
||||
Fl::awake(set_ptt, (void *)PTT);
|
||||
}
|
||||
|
||||
void check_break_in()
|
||||
|
|
@ -1166,13 +1178,13 @@ void serviceQUE()
|
|||
if (nuvals.change == ON) trace(1,"ptt ON");
|
||||
else trace(1,"ptt OFF");
|
||||
rigPTT(PTT);
|
||||
int get = selrig->get_PTT();
|
||||
int cnt = 0;
|
||||
while ((get != PTT) && (cnt++ < 100)) {
|
||||
MilliSleep(10);
|
||||
get = selrig->get_PTT();
|
||||
}
|
||||
{
|
||||
if (progStatus.comm_catptt) {
|
||||
int get = selrig->get_PTT();
|
||||
int cnt = 0;
|
||||
while ((get != PTT) && (cnt++ < 100)) {
|
||||
MilliSleep(10);
|
||||
get = selrig->get_PTT();
|
||||
}
|
||||
stringstream s;
|
||||
s << "ptt returned " << get << " in " << cnt * 10 << " msec";
|
||||
trace(1, s.str().c_str());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue