mirror of
https://git.code.sf.net/p/fldigi/flrig
synced 2026-08-13 17:28:24 -04:00
PTT polling
* add PTT to polling controls
- disable PTT polling by setting control to zero
This commit is contained in:
parent
bf1889eae5
commit
63b1e96d32
5 changed files with 47 additions and 16 deletions
|
|
@ -68,6 +68,11 @@ Fl_Group *tabPTT = (Fl_Group *)0;
|
|||
Fl_Check_Button *btnSepDTRptt = (Fl_Check_Button *)0;
|
||||
Fl_Check_Button *btnSepDTRplus = (Fl_Check_Button *)0;
|
||||
|
||||
Fl_Group *tabGPIO = (Fl_Group *)0;
|
||||
Fl_Check_Button *btn_enable_gpio[17];
|
||||
Fl_Check_Button *btn_gpio_on[17];
|
||||
Fl_Counter *cnt_gpio_pulse_width;
|
||||
|
||||
Fl_Group *tabAUX = (Fl_Group *)0;
|
||||
Fl_ComboBox *selectAuxPort = (Fl_ComboBox *)0;
|
||||
Fl_Check_Button *btnAux_SCU_17 = (Fl_Check_Button *)0;
|
||||
|
|
@ -98,6 +103,7 @@ Fl_Group *tabPOLLING = (Fl_Group *)0;
|
|||
Fl_Value_Input *poll_nr = (Fl_Value_Input *)0;
|
||||
Fl_Value_Input *poll_compression = (Fl_Value_Input *)0;
|
||||
Fl_Value_Input *poll_tuner = (Fl_Value_Input *)0;
|
||||
Fl_Value_Input *poll_ptt = (Fl_Value_Input *)0;
|
||||
Fl_Button *btnClearAddControls = (Fl_Button *)0;
|
||||
|
||||
Fl_Value_Input *poll_meters = (Fl_Value_Input *)0;
|
||||
|
|
@ -586,6 +592,10 @@ static void cb_poll_meters(Fl_Value_Input* o, void*) {
|
|||
progStatus.poll_meters = o->value();
|
||||
}
|
||||
|
||||
static void cb_poll_ptt(Fl_Value_Input* o, void*) {
|
||||
progStatus.poll_ptt = o->value();
|
||||
}
|
||||
|
||||
static void cb_btnSetMeters(Fl_Button*, void*) {
|
||||
poll_smeter->value(progStatus.poll_meters);
|
||||
poll_pout->value(progStatus.poll_meters);
|
||||
|
|
@ -631,6 +641,7 @@ static void cb_btnSetAdd(Fl_Button*, void*) {
|
|||
poll_nr->value(progStatus.poll_all);
|
||||
poll_compression->value(progStatus.poll_all);
|
||||
poll_tuner->value(progStatus.poll_all);
|
||||
poll_ptt->value(progStatus.poll_all);
|
||||
|
||||
progStatus.poll_volume = progStatus.poll_all;
|
||||
progStatus.poll_micgain = progStatus.poll_all;
|
||||
|
|
@ -646,6 +657,7 @@ static void cb_btnSetAdd(Fl_Button*, void*) {
|
|||
progStatus.poll_nr = progStatus.poll_all;
|
||||
progStatus.poll_compression = progStatus.poll_all;
|
||||
progStatus.poll_tuner = progStatus.poll_all;
|
||||
progStatus.poll_ptt = progStatus.poll_all;
|
||||
}
|
||||
|
||||
static void cb_btn_send_command(Fl_Button *o, void*) {
|
||||
|
|
@ -1567,6 +1579,14 @@ Fl_Group *createPOLLING(int X, int Y, int W, int H, const char *label)
|
|||
poll_power_control->align(Fl_Align(FL_ALIGN_RIGHT));
|
||||
poll_power_control->value(progStatus.poll_power_control);
|
||||
|
||||
poll_ptt = new Fl_Value_Input(X + 370, Y + 115, 30, 20, _("PTT"));
|
||||
poll_ptt->tooltip(_("Push to talk"));
|
||||
poll_ptt->maximum(10);
|
||||
poll_ptt->step(1);
|
||||
poll_ptt->callback((Fl_Callback*)cb_poll_ptt);
|
||||
poll_ptt->align(Fl_Align(FL_ALIGN_RIGHT));
|
||||
poll_ptt->value(progStatus.poll_ptt);
|
||||
|
||||
poll_ifshift = new Fl_Value_Input(X + 10, Y + 140, 30, 20, _("IF"));
|
||||
poll_ifshift->tooltip(_("IF shift"));
|
||||
poll_ifshift->maximum(10);
|
||||
|
|
@ -2003,6 +2023,8 @@ Fl_Group *createRestore(int X, int Y, int W, int H, const char *label)
|
|||
return tabRESTORE;
|
||||
}
|
||||
|
||||
#include "gpio.cxx"
|
||||
|
||||
#include <vector>
|
||||
|
||||
struct CONFIG_PAGE {
|
||||
|
|
@ -2034,6 +2056,7 @@ void cleartabs()
|
|||
tabTCPIP->hide();
|
||||
tabPTT->hide();
|
||||
tabAUX->hide();
|
||||
tabGPIO->hide();
|
||||
tabPOLLING->hide();
|
||||
tabSNDCMD->hide();
|
||||
tabCOMMANDS->hide();
|
||||
|
|
@ -2110,6 +2133,9 @@ Fl_Double_Window* XcvrDialog() {
|
|||
tabPTT = createPTT(xtabs, ytree, wtabs, htree, _("PTT"));
|
||||
add_tree_item(tabPTT);
|
||||
|
||||
tabGPIO = createGPIO(xtabs, ytree, wtabs, htree, _("GPIO"));
|
||||
add_tree_item(tabGPIO);
|
||||
|
||||
tabAUX = createAUX(xtabs, ytree, wtabs, htree, _("Auxiliary"));
|
||||
add_tree_item(tabAUX);
|
||||
|
||||
|
|
|
|||
|
|
@ -502,6 +502,7 @@ extern Fl_Value_Input *poll_split;
|
|||
extern Fl_Value_Input *poll_noise;
|
||||
extern Fl_Value_Input *poll_nr;
|
||||
extern Fl_Value_Input *poll_compression;
|
||||
extern Fl_Value_Input *poll_ptt;
|
||||
extern Fl_Button *btnClearAddControls;
|
||||
extern Fl_Value_Input *poll_all;
|
||||
extern Fl_Button *btnSetAllAdd;
|
||||
|
|
|
|||
|
|
@ -97,6 +97,7 @@ struct status {
|
|||
int poll_ops;
|
||||
int poll_compression;
|
||||
int poll_tuner;
|
||||
int poll_ptt;
|
||||
int poll_all;
|
||||
|
||||
int iBW_A;
|
||||
|
|
|
|||
|
|
@ -108,6 +108,7 @@ status progStatus = {
|
|||
1, // poll_ops;
|
||||
1, // poll_compression;
|
||||
1, // poll_tuner;
|
||||
1, // poll_ptt;
|
||||
4, // int poll_all;
|
||||
|
||||
-1, // int iBW_A;
|
||||
|
|
@ -512,6 +513,7 @@ void status::saveLastState()
|
|||
spref.set("poll_nr", poll_nr);
|
||||
spref.set("poll_compression", poll_compression);
|
||||
spref.set("poll_tuner", poll_tuner);
|
||||
spref.set("poll_ptt", poll_ptt);
|
||||
spref.set("poll_all", poll_all);
|
||||
|
||||
spref.set("bw_A", iBW_A);
|
||||
|
|
@ -986,6 +988,7 @@ bool status::loadXcvrState(string xcvr)
|
|||
spref.get("poll_nr", poll_nr, poll_nr);
|
||||
spref.get("poll_compression", poll_compression, poll_compression);
|
||||
spref.get("poll_tuner", poll_tuner, poll_tuner);
|
||||
spref.get("poll_ptt", poll_ptt, poll_ptt);
|
||||
spref.get("poll_all", poll_all, poll_all);
|
||||
|
||||
spref.get("bw_A", iBW_A, iBW_A);
|
||||
|
|
@ -996,7 +999,6 @@ bool status::loadXcvrState(string xcvr)
|
|||
spref.get("freq_A_u", freq_A_upper, freq_A_upper);
|
||||
spref.get("freq_A_l", freq_A_lower, freq_A_lower);
|
||||
freq_A = (unsigned long int)freq_A_upper * 1000000000 + freq_A_lower;
|
||||
std::cout << "freq A: " << freq_A << std::endl;
|
||||
|
||||
spref.get("bw_B", iBW_B, iBW_B);
|
||||
spref.get("mode_B", imode_B, imode_B);
|
||||
|
|
@ -1006,7 +1008,6 @@ std::cout << "freq A: " << freq_A << std::endl;
|
|||
spref.get("freq_B_u", freq_B_upper, freq_B_upper);
|
||||
spref.get("freq_B_l", freq_B_lower, freq_B_lower);
|
||||
freq_B = (unsigned long int)freq_B_upper * 1000000000 + freq_B_lower;
|
||||
std::cout << "freq B: " << freq_B << std::endl;
|
||||
|
||||
spref.get("filters", defbuffer, "", 499);
|
||||
filters = defbuffer;
|
||||
|
|
@ -1639,6 +1640,7 @@ string status::info()
|
|||
info << "poll_split : " << poll_split << "\n";
|
||||
info << "poll_noise : " << poll_noise << "\n";
|
||||
info << "poll_nr : " << poll_nr << "\n";
|
||||
info << "poll_ptt : " << poll_ptt << "\n";
|
||||
info << "poll_all : " << poll_all << "\n";
|
||||
info << "\n";
|
||||
info << "freq_A : " << freq_A << "\n";
|
||||
|
|
|
|||
|
|
@ -1053,6 +1053,17 @@ void read_squelch()
|
|||
}
|
||||
}
|
||||
|
||||
void set_ptt(void *);
|
||||
|
||||
void check_ptt()
|
||||
{
|
||||
int check = selrig->get_PTT();
|
||||
if (check != PTT) {
|
||||
PTT = check;
|
||||
Fl::awake(set_ptt, (void *)PTT);
|
||||
}
|
||||
}
|
||||
|
||||
struct POLL_PAIR {
|
||||
int *poll;
|
||||
void (*pollfunc)();
|
||||
|
|
@ -1078,6 +1089,7 @@ POLL_PAIR RX_poll_pairs[] = {
|
|||
{&progStatus.poll_nr, read_nr},
|
||||
{&progStatus.poll_noise, read_noise},
|
||||
{&progStatus.poll_compression, read_compression},
|
||||
{&progStatus.poll_ptt, check_ptt},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
|
|
@ -1086,6 +1098,7 @@ POLL_PAIR TX_poll_pairs[] = {
|
|||
{&progStatus.poll_swr, read_swr},
|
||||
{&progStatus.poll_alc, read_alc},
|
||||
{&progStatus.poll_split, read_split},
|
||||
{&progStatus.poll_ptt, check_ptt},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
|
|
@ -1442,16 +1455,6 @@ void set_ptt(void *d)
|
|||
}
|
||||
}
|
||||
|
||||
void check_ptt()
|
||||
{
|
||||
guard_lock serial(&mutex_serial);
|
||||
int check = selrig->get_PTT();
|
||||
if (check != PTT) {
|
||||
PTT = check;
|
||||
Fl::awake(set_ptt, (void *)PTT);
|
||||
}
|
||||
}
|
||||
|
||||
bool close_rig = false;
|
||||
|
||||
void * serial_thread_loop(void *d)
|
||||
|
|
@ -1474,10 +1477,6 @@ void * serial_thread_loop(void *d)
|
|||
}
|
||||
|
||||
//send any freq/mode/bw changes in the queu
|
||||
|
||||
// test for PTT change made at transceiver
|
||||
if (progStatus.poll_frequency) check_ptt();
|
||||
|
||||
if (!srvc_reqs.empty())
|
||||
serviceQUE();
|
||||
|
||||
|
|
@ -1517,6 +1516,7 @@ void * serial_thread_loop(void *d)
|
|||
MilliSleep(1);
|
||||
|
||||
if (!srvc_reqs.empty()) goto serial_bypass_loop;//break;
|
||||
|
||||
if (PTT) {
|
||||
trace(1, "PTT detected");
|
||||
goto serial_bypass_loop;//break;
|
||||
|
|
@ -1548,6 +1548,7 @@ void * serial_thread_loop(void *d)
|
|||
while (poll_parameters->poll) {
|
||||
MilliSleep(1);
|
||||
if (!srvc_reqs.empty()) goto serial_bypass_loop;
|
||||
|
||||
if (!PTT) {
|
||||
trace(1, "!PTT detected");
|
||||
goto serial_bypass_loop;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue