Serial i/o Stopbits

Added stopbits configuration for hamlib and rigcat serial i/o
pull/2/head
David Freese 2009-09-14 14:31:27 -05:00
rodzic 765c6d91b2
commit f9423b45b4
9 zmienionych plików z 1060 dodań i 982 usunięć

Wyświetl plik

@ -1445,6 +1445,13 @@ btnInitRIGCAT->redraw_label();
progdefaults.changed = true; progdefaults.changed = true;
} }
Fl_Value_Slider *valRigCatStopbits=(Fl_Value_Slider *)0;
static void cb_valRigCatStopbits(Fl_Value_Slider* o, void*) {
progdefaults.RigCatStopbits = (int)o->value();
progdefaults.changed = true;
}
Fl_Group *tabHamlib=(Fl_Group *)0; Fl_Group *tabHamlib=(Fl_Group *)0;
Fl_Check_Button *chkUSEHAMLIB=(Fl_Check_Button *)0; Fl_Check_Button *chkUSEHAMLIB=(Fl_Check_Button *)0;
@ -1609,6 +1616,13 @@ btnInitHAMLIB->labelcolor(FL_RED);
btnInitHAMLIB->redraw_label(); btnInitHAMLIB->redraw_label();
} }
Fl_Value_Slider *valHamRigStopbits=(Fl_Value_Slider *)0;
static void cb_valHamRigStopbits(Fl_Value_Slider* o, void*) {
progdefaults.HamRigStopbits = (int)o->value();
progdefaults.changed = true;
}
Fl_Group *grpMemmap=(Fl_Group *)0; Fl_Group *grpMemmap=(Fl_Group *)0;
Fl_Check_Button *chkUSEMEMMAP=(Fl_Check_Button *)0; Fl_Check_Button *chkUSEMEMMAP=(Fl_Check_Button *)0;
@ -2227,6 +2241,7 @@ static const char szBaudRates[] = "300|600|1200|2400|4800|9600|19200|38400|57600
{ tabOperator = new Fl_Group(0, 25, 500, 345, _("Operator")); { tabOperator = new Fl_Group(0, 25, 500, 345, _("Operator"));
tabOperator->callback((Fl_Callback*)cb_tabOperator); tabOperator->callback((Fl_Callback*)cb_tabOperator);
tabOperator->when(FL_WHEN_CHANGED); tabOperator->when(FL_WHEN_CHANGED);
tabOperator->hide();
{ Fl_Group* o = new Fl_Group(5, 35, 490, 165, _("Station")); { Fl_Group* o = new Fl_Group(5, 35, 490, 165, _("Station"));
o->box(FL_ENGRAVED_FRAME); o->box(FL_ENGRAVED_FRAME);
o->align(FL_ALIGN_TOP_LEFT|FL_ALIGN_INSIDE); o->align(FL_ALIGN_TOP_LEFT|FL_ALIGN_INSIDE);
@ -3665,7 +3680,6 @@ an merging"));
tabModems->end(); tabModems->end();
} // Fl_Group* tabModems } // Fl_Group* tabModems
{ tabRig = new Fl_Group(0, 25, 500, 345, _("Rig")); { tabRig = new Fl_Group(0, 25, 500, 345, _("Rig"));
tabRig->hide();
{ tabsRig = new Fl_Tabs(0, 25, 500, 345); { tabsRig = new Fl_Tabs(0, 25, 500, 345);
tabsRig->selection_color(FL_LIGHT1); tabsRig->selection_color(FL_LIGHT1);
{ Fl_Group* o = new Fl_Group(0, 50, 500, 320, _("Hardware PTT")); { Fl_Group* o = new Fl_Group(0, 50, 500, 320, _("Hardware PTT"));
@ -3731,6 +3745,7 @@ an merging"));
} // Fl_Group* o } // Fl_Group* o
{ Fl_Group* o = new Fl_Group(0, 50, 500, 320, _("RigCAT")); { Fl_Group* o = new Fl_Group(0, 50, 500, 320, _("RigCAT"));
o->tooltip(_("Rig Control using xml spec file")); o->tooltip(_("Rig Control using xml spec file"));
o->hide();
{ chkUSERIGCAT = new Fl_Check_Button(195, 60, 110, 20, _("Use RigCAT")); { chkUSERIGCAT = new Fl_Check_Button(195, 60, 110, 20, _("Use RigCAT"));
chkUSERIGCAT->tooltip(_("RigCAT used for rig control")); chkUSERIGCAT->tooltip(_("RigCAT used for rig control"));
chkUSERIGCAT->down_box(FL_DOWN_BOX); chkUSERIGCAT->down_box(FL_DOWN_BOX);
@ -3770,7 +3785,7 @@ an merging"));
cntRigCatWait->align(FL_ALIGN_TOP_LEFT); cntRigCatWait->align(FL_ALIGN_TOP_LEFT);
o->value(progdefaults.RigCatWait); o->value(progdefaults.RigCatWait);
} // Fl_Value_Input* cntRigCatWait } // Fl_Value_Input* cntRigCatWait
{ Fl_Choice* o = mnuXmlRigBaudrate = new Fl_Choice(386, 154, 99, 22, _("Baud rate:")); { Fl_Choice* o = mnuXmlRigBaudrate = new Fl_Choice(386, 150, 99, 22, _("Baud rate:"));
mnuXmlRigBaudrate->tooltip(_("Pick baud rate from list")); mnuXmlRigBaudrate->tooltip(_("Pick baud rate from list"));
mnuXmlRigBaudrate->down_box(FL_BORDER_BOX); mnuXmlRigBaudrate->down_box(FL_BORDER_BOX);
mnuXmlRigBaudrate->callback((Fl_Callback*)cb_mnuXmlRigBaudrate); mnuXmlRigBaudrate->callback((Fl_Callback*)cb_mnuXmlRigBaudrate);
@ -3824,12 +3839,24 @@ an merging"));
chkRigCatRTSCTSflow->callback((Fl_Callback*)cb_chkRigCatRTSCTSflow); chkRigCatRTSCTSflow->callback((Fl_Callback*)cb_chkRigCatRTSCTSflow);
o->value(progdefaults.RigCatRTSCTSflow); o->value(progdefaults.RigCatRTSCTSflow);
} // Fl_Check_Button* chkRigCatRTSCTSflow } // Fl_Check_Button* chkRigCatRTSCTSflow
{ Fl_Value_Slider* o = valRigCatStopbits = new Fl_Value_Slider(425, 190, 60, 22, _("Stopbits"));
valRigCatStopbits->type(1);
valRigCatStopbits->color(FL_BACKGROUND2_COLOR);
valRigCatStopbits->selection_color((Fl_Color)40);
valRigCatStopbits->minimum(1);
valRigCatStopbits->maximum(2);
valRigCatStopbits->step(1);
valRigCatStopbits->value(2);
valRigCatStopbits->textsize(14);
valRigCatStopbits->callback((Fl_Callback*)cb_valRigCatStopbits);
valRigCatStopbits->align(FL_ALIGN_LEFT);
o->value(progdefaults.RigCatStopbits);
} // Fl_Value_Slider* valRigCatStopbits
grpRigCAT->end(); grpRigCAT->end();
} // Fl_Group* grpRigCAT } // Fl_Group* grpRigCAT
o->end(); o->end();
} // Fl_Group* o } // Fl_Group* o
{ tabHamlib = new Fl_Group(0, 50, 500, 320, _("Hamlib")); { tabHamlib = new Fl_Group(0, 50, 500, 320, _("Hamlib"));
tabHamlib->hide();
{ chkUSEHAMLIB = new Fl_Check_Button(195, 60, 100, 20, _("Use Hamlib")); { chkUSEHAMLIB = new Fl_Check_Button(195, 60, 100, 20, _("Use Hamlib"));
chkUSEHAMLIB->tooltip(_("Hamlib used for rig control")); chkUSEHAMLIB->tooltip(_("Hamlib used for rig control"));
chkUSEHAMLIB->down_box(FL_DOWN_BOX); chkUSEHAMLIB->down_box(FL_DOWN_BOX);
@ -3857,35 +3884,34 @@ an merging"));
inpRIGdev->callback((Fl_Callback*)cb_inpRIGdev); inpRIGdev->callback((Fl_Callback*)cb_inpRIGdev);
o->value(progdefaults.HamRigDevice.c_str()); o->value(progdefaults.HamRigDevice.c_str());
} // Fl_Input_Choice* inpRIGdev } // Fl_Input_Choice* inpRIGdev
{ Fl_Value_Input* o = cntHamlibRetries = new Fl_Value_Input(30, 137, 70, 24, _("Retries")); { Fl_Value_Input* o = cntHamlibRetries = new Fl_Value_Input(30, 133, 70, 24, _("Retries"));
cntHamlibRetries->tooltip(_("# times to resend command before giving up")); cntHamlibRetries->tooltip(_("# times to resend command before giving up"));
cntHamlibRetries->callback((Fl_Callback*)cb_cntHamlibRetries); cntHamlibRetries->callback((Fl_Callback*)cb_cntHamlibRetries);
cntHamlibRetries->align(FL_ALIGN_TOP_LEFT); cntHamlibRetries->align(FL_ALIGN_TOP_LEFT);
o->value(progdefaults.HamlibRetries); o->value(progdefaults.HamlibRetries);
} // Fl_Value_Input* cntHamlibRetries } // Fl_Value_Input* cntHamlibRetries
{ Fl_Value_Input* o = cntHamlibTimeout = new Fl_Value_Input(155, 137, 70, 24, _("Retry Interval (ms)")); { Fl_Value_Input* o = cntHamlibTimeout = new Fl_Value_Input(155, 133, 70, 24, _("Retry Interval (ms)"));
cntHamlibTimeout->tooltip(_("Msec\'s between retries")); cntHamlibTimeout->tooltip(_("Msec\'s between retries"));
cntHamlibTimeout->callback((Fl_Callback*)cb_cntHamlibTimeout); cntHamlibTimeout->callback((Fl_Callback*)cb_cntHamlibTimeout);
cntHamlibTimeout->align(FL_ALIGN_TOP_LEFT); cntHamlibTimeout->align(FL_ALIGN_TOP_LEFT);
o->value(progdefaults.HamlibTimeout); o->value(progdefaults.HamlibTimeout);
} // Fl_Value_Input* cntHamlibTimeout } // Fl_Value_Input* cntHamlibTimeout
{ Fl_Value_Input* o = cntHamlibWriteDelay = new Fl_Value_Input(30, 183, 70, 24, _("Write delay (ms)")); { Fl_Value_Input* o = cntHamlibWriteDelay = new Fl_Value_Input(30, 176, 70, 24, _("Write delay (ms)"));
cntHamlibWriteDelay->tooltip(_("Msec\'s between sequential commands")); cntHamlibWriteDelay->tooltip(_("Msec\'s between sequential commands"));
cntHamlibWriteDelay->callback((Fl_Callback*)cb_cntHamlibWriteDelay); cntHamlibWriteDelay->callback((Fl_Callback*)cb_cntHamlibWriteDelay);
cntHamlibWriteDelay->align(FL_ALIGN_TOP_LEFT); cntHamlibWriteDelay->align(FL_ALIGN_TOP_LEFT);
o->value(progdefaults.HamlibWriteDelay); o->value(progdefaults.HamlibWriteDelay);
} // Fl_Value_Input* cntHamlibWriteDelay } // Fl_Value_Input* cntHamlibWriteDelay
{ Fl_Value_Input* o = cntHamlibWait = new Fl_Value_Input(156, 182, 70, 24, _("Post write delay (ms)")); { Fl_Value_Input* o = cntHamlibWait = new Fl_Value_Input(156, 176, 70, 24, _("Post write delay (ms)"));
cntHamlibWait->tooltip(_("Wait interval (msecs) before reading response")); cntHamlibWait->tooltip(_("Wait interval (msecs) before reading response"));
cntHamlibWait->callback((Fl_Callback*)cb_cntHamlibWait); cntHamlibWait->callback((Fl_Callback*)cb_cntHamlibWait);
cntHamlibWait->align(FL_ALIGN_TOP_LEFT); cntHamlibWait->align(FL_ALIGN_TOP_LEFT);
o->value(progdefaults.HamlibWait); o->value(progdefaults.HamlibWait);
} // Fl_Value_Input* cntHamlibWait } // Fl_Value_Input* cntHamlibWait
{ Fl_Choice* o = mnuBaudRate = new Fl_Choice(385, 138, 99, 22, _("Baud rate:")); { Fl_Choice* o = mnuBaudRate = new Fl_Choice(385, 127, 99, 22, _("Baud rate:"));
mnuBaudRate->tooltip(_("Serial port baud rate")); mnuBaudRate->tooltip(_("Serial port baud rate"));
mnuBaudRate->down_box(FL_BORDER_BOX); mnuBaudRate->down_box(FL_BORDER_BOX);
mnuBaudRate->callback((Fl_Callback*)cb_mnuBaudRate); mnuBaudRate->callback((Fl_Callback*)cb_mnuBaudRate);
mnuBaudRate->align(FL_ALIGN_TOP_LEFT);
o->add(szBaudRates); o->add(szBaudRates);
o->value(progdefaults.HamRigBaudrate); o->value(progdefaults.HamRigBaudrate);
} // Fl_Choice* mnuBaudRate } // Fl_Choice* mnuBaudRate
@ -3957,6 +3983,19 @@ an merging"));
chkHamlibXONXOFFflow->callback((Fl_Callback*)cb_chkHamlibXONXOFFflow); chkHamlibXONXOFFflow->callback((Fl_Callback*)cb_chkHamlibXONXOFFflow);
o->value(progdefaults.HamlibXONXOFFflow); o->value(progdefaults.HamlibXONXOFFflow);
} // Fl_Check_Button* chkHamlibXONXOFFflow } // Fl_Check_Button* chkHamlibXONXOFFflow
{ Fl_Value_Slider* o = valHamRigStopbits = new Fl_Value_Slider(424, 162, 60, 22, _("Stopbits"));
valHamRigStopbits->type(1);
valHamRigStopbits->color(FL_BACKGROUND2_COLOR);
valHamRigStopbits->selection_color((Fl_Color)40);
valHamRigStopbits->minimum(1);
valHamRigStopbits->maximum(2);
valHamRigStopbits->step(1);
valHamRigStopbits->value(2);
valHamRigStopbits->textsize(14);
valHamRigStopbits->callback((Fl_Callback*)cb_valHamRigStopbits);
valHamRigStopbits->align(FL_ALIGN_LEFT);
o->value(progdefaults.HamRigStopbits);
} // Fl_Value_Slider* valHamRigStopbits
grpHamlib->end(); grpHamlib->end();
} // Fl_Group* grpHamlib } // Fl_Group* grpHamlib
tabHamlib->end(); tabHamlib->end();

Wyświetl plik

@ -89,8 +89,8 @@ static const char szBaudRates[] = "300|600|1200|2400|4800|9600|19200|38400|57600
} { } {
Fl_Group tabOperator { Fl_Group tabOperator {
label Operator label Operator
callback {progdefaults.changed = true;} open selected callback {progdefaults.changed = true;} open
xywh {0 25 500 345} when 1 xywh {0 25 500 345} when 1 hide
} { } {
Fl_Group {} { Fl_Group {} {
label Station open label Station open
@ -1508,7 +1508,7 @@ progdefaults.changed = true;}
} }
Fl_Group tabRig { Fl_Group tabRig {
label Rig open label Rig open
xywh {0 25 500 345} hide xywh {0 25 500 345}
} { } {
Fl_Tabs tabsRig {open Fl_Tabs tabsRig {open
xywh {0 25 500 345} selection_color 50 xywh {0 25 500 345} selection_color 50
@ -1620,7 +1620,7 @@ progdefaults.changed = true;}
} }
Fl_Group {} { Fl_Group {} {
label RigCAT open label RigCAT open
tooltip {Rig Control using xml spec file} xywh {0 50 500 320} tooltip {Rig Control using xml spec file} xywh {0 50 500 320} hide
} { } {
Fl_Check_Button chkUSERIGCAT { Fl_Check_Button chkUSERIGCAT {
label {Use RigCAT} label {Use RigCAT}
@ -1697,7 +1697,7 @@ progdefaults.changed = true;}
btnInitRIGCAT->labelcolor(FL_RED); btnInitRIGCAT->labelcolor(FL_RED);
btnInitRIGCAT->redraw_label(); btnInitRIGCAT->redraw_label();
progdefaults.changed = true;} open progdefaults.changed = true;} open
tooltip {Pick baud rate from list} xywh {386 154 99 22} down_box BORDER_BOX tooltip {Pick baud rate from list} xywh {386 150 99 22} down_box BORDER_BOX
code0 {o->add(szBaudRates);} code0 {o->add(szBaudRates);}
code1 {o->value(progdefaults.XmlRigBaudrate);} code1 {o->value(progdefaults.XmlRigBaudrate);}
} {} } {}
@ -1792,11 +1792,18 @@ progdefaults.changed = true;}
tooltip {Rig uses RTS/CTS handshake} xywh {50 320 170 20} down_box DOWN_BOX tooltip {Rig uses RTS/CTS handshake} xywh {50 320 170 20} down_box DOWN_BOX
code0 {o->value(progdefaults.RigCatRTSCTSflow);} code0 {o->value(progdefaults.RigCatRTSCTSflow);}
} }
Fl_Value_Slider valRigCatStopbits {
label Stopbits
callback {progdefaults.RigCatStopbits = (int)o->value();
progdefaults.changed = true;}
xywh {425 190 60 22} type Horizontal color 7 selection_color 40 align 4 minimum 1 maximum 2 step 1 value 2 textsize 14
code0 {o->value(progdefaults.RigCatStopbits);}
}
} }
} }
Fl_Group tabHamlib { Fl_Group tabHamlib {
label Hamlib open label Hamlib open
xywh {0 50 500 320} hide xywh {0 50 500 320}
} { } {
Fl_Check_Button chkUSEHAMLIB { Fl_Check_Button chkUSEHAMLIB {
label {Use Hamlib} label {Use Hamlib}
@ -1843,7 +1850,7 @@ btnInitHAMLIB->redraw_label();} open
callback {progdefaults.HamlibRetries = (int)o->value(); callback {progdefaults.HamlibRetries = (int)o->value();
btnInitHAMLIB->labelcolor(FL_RED); btnInitHAMLIB->labelcolor(FL_RED);
btnInitHAMLIB->redraw_label();} btnInitHAMLIB->redraw_label();}
tooltip {\# times to resend command before giving up} xywh {30 137 70 24} align 5 tooltip {\# times to resend command before giving up} xywh {30 133 70 24} align 5
code0 {o->value(progdefaults.HamlibRetries);} code0 {o->value(progdefaults.HamlibRetries);}
} }
Fl_Value_Input cntHamlibTimeout { Fl_Value_Input cntHamlibTimeout {
@ -1851,7 +1858,7 @@ btnInitHAMLIB->redraw_label();}
callback {progdefaults.HamlibTimeout = (int)o->value(); callback {progdefaults.HamlibTimeout = (int)o->value();
btnInitHAMLIB->labelcolor(FL_RED); btnInitHAMLIB->labelcolor(FL_RED);
btnInitHAMLIB->redraw_label();} btnInitHAMLIB->redraw_label();}
tooltip {Msec's between retries} xywh {155 137 70 24} align 5 tooltip {Msec's between retries} xywh {155 133 70 24} align 5
code0 {o->value(progdefaults.HamlibTimeout);} code0 {o->value(progdefaults.HamlibTimeout);}
} }
Fl_Value_Input cntHamlibWriteDelay { Fl_Value_Input cntHamlibWriteDelay {
@ -1859,7 +1866,7 @@ btnInitHAMLIB->redraw_label();}
callback {progdefaults.HamlibWriteDelay = (int)o->value(); callback {progdefaults.HamlibWriteDelay = (int)o->value();
btnInitHAMLIB->labelcolor(FL_RED); btnInitHAMLIB->labelcolor(FL_RED);
btnInitHAMLIB->redraw_label();} btnInitHAMLIB->redraw_label();}
tooltip {Msec's between sequential commands} xywh {30 183 70 24} align 5 tooltip {Msec's between sequential commands} xywh {30 176 70 24} align 5
code0 {o->value(progdefaults.HamlibWriteDelay);} code0 {o->value(progdefaults.HamlibWriteDelay);}
} }
Fl_Value_Input cntHamlibWait { Fl_Value_Input cntHamlibWait {
@ -1867,7 +1874,7 @@ btnInitHAMLIB->redraw_label();}
callback {progdefaults.HamlibWait = (int)o->value(); callback {progdefaults.HamlibWait = (int)o->value();
btnInitHAMLIB->labelcolor(FL_RED); btnInitHAMLIB->labelcolor(FL_RED);
btnInitHAMLIB->redraw_label();} btnInitHAMLIB->redraw_label();}
tooltip {Wait interval (msecs) before reading response} xywh {156 182 70 24} align 5 tooltip {Wait interval (msecs) before reading response} xywh {156 176 70 24} align 5
code0 {o->value(progdefaults.HamlibWait);} code0 {o->value(progdefaults.HamlibWait);}
} }
Fl_Choice mnuBaudRate { Fl_Choice mnuBaudRate {
@ -1875,7 +1882,7 @@ btnInitHAMLIB->redraw_label();}
callback {progdefaults.HamRigBaudrate = o->value(); callback {progdefaults.HamRigBaudrate = o->value();
btnInitHAMLIB->labelcolor(FL_RED); btnInitHAMLIB->labelcolor(FL_RED);
btnInitHAMLIB->redraw_label();} open btnInitHAMLIB->redraw_label();} open
tooltip {Serial port baud rate} xywh {385 138 99 22} down_box BORDER_BOX align 5 tooltip {Serial port baud rate} xywh {385 127 99 22} down_box BORDER_BOX
code0 {o->add(szBaudRates);} code0 {o->add(szBaudRates);}
code1 {o->value(progdefaults.HamRigBaudrate);} code1 {o->value(progdefaults.HamRigBaudrate);}
} {} } {}
@ -1965,6 +1972,13 @@ btnInitHAMLIB->redraw_label();}
tooltip {Rig requires Xon/Xoff flow control} xywh {269 281 185 20} down_box DOWN_BOX tooltip {Rig requires Xon/Xoff flow control} xywh {269 281 185 20} down_box DOWN_BOX
code0 {o->value(progdefaults.HamlibXONXOFFflow);} code0 {o->value(progdefaults.HamlibXONXOFFflow);}
} }
Fl_Value_Slider valHamRigStopbits {
label Stopbits
callback {progdefaults.HamRigStopbits = (int)o->value();
progdefaults.changed = true;} selected
xywh {424 162 60 22} type Horizontal color 7 selection_color 40 align 4 minimum 1 maximum 2 step 1 value 2 textsize 14
code0 {o->value(progdefaults.HamRigStopbits);}
}
} }
} }
Fl_Group {} { Fl_Group {} {

Wyświetl plik

@ -220,6 +220,7 @@ extern Fl_Round_Button *btnRigCatDTRptt;
extern Fl_Check_Button *btnRigCatRTSplus; extern Fl_Check_Button *btnRigCatRTSplus;
extern Fl_Check_Button *btnRigCatDTRplus; extern Fl_Check_Button *btnRigCatDTRplus;
extern Fl_Check_Button *chkRigCatRTSCTSflow; extern Fl_Check_Button *chkRigCatRTSCTSflow;
extern Fl_Value_Slider *valRigCatStopbits;
extern Fl_Group *tabHamlib; extern Fl_Group *tabHamlib;
extern Fl_Check_Button *chkUSEHAMLIB; extern Fl_Check_Button *chkUSEHAMLIB;
extern Fl_Group *grpHamlib; extern Fl_Group *grpHamlib;
@ -239,6 +240,7 @@ extern Fl_Check_Button *btnHamlibDTRplus;
extern Fl_Check_Button *chkHamlibRTSplus; extern Fl_Check_Button *chkHamlibRTSplus;
extern Fl_Check_Button *chkHamlibRTSCTSflow; extern Fl_Check_Button *chkHamlibRTSCTSflow;
extern Fl_Check_Button *chkHamlibXONXOFFflow; extern Fl_Check_Button *chkHamlibXONXOFFflow;
extern Fl_Value_Slider *valHamRigStopbits;
extern Fl_Group *grpMemmap; extern Fl_Group *grpMemmap;
extern Fl_Check_Button *chkUSEMEMMAP; extern Fl_Check_Button *chkUSEMEMMAP;
extern Fl_Round_Button *btnMEMMAPptt; extern Fl_Round_Button *btnMEMMAPptt;

Wyświetl plik

@ -539,6 +539,9 @@
" 0: 300; 1: 600; 2: 1200; 3: 2400; 4: 4800; 5: 9600; 6: 19200;\n" \ " 0: 300; 1: 600; 2: 1200; 3: 2400; 4: 4800; 5: 9600; 6: 19200;\n" \
" 7: 38400; 8: 57600; 9: 115200; 10: 230400; 11: 460800.", \ " 7: 38400; 8: 57600; 9: 115200; 10: 230400; 11: 460800.", \
1) /* 600 baud */ \ 1) /* 600 baud */ \
ELEM_(int, HamRigStopbits, "HAMRIGSTOPBITS", \
"Hamlib stopbits <1/2>.", \
2) /* 600 baud */ \
ELEM_(std::string, XmlRigFilename, "XMLRIGFILENAME", \ ELEM_(std::string, XmlRigFilename, "XMLRIGFILENAME", \
"RigCAT XML file name", \ "RigCAT XML file name", \
"") \ "") \
@ -548,6 +551,9 @@
ELEM_(int, XmlRigBaudrate, "XMLRIGBAUDRATE", \ ELEM_(int, XmlRigBaudrate, "XMLRIGBAUDRATE", \
"RigCAT rig baud rate. See HAMRIGBAUDRATE.", \ "RigCAT rig baud rate. See HAMRIGBAUDRATE.", \
1) /* 600 baud */ \ 1) /* 600 baud */ \
ELEM_(int, RigCatStopbits, "RIGCATSTOPBITS", \
"RigCAT stopbits. <1/2>", \
2) /* 600 baud */ \
ELEM_(bool, TTYptt, "TTYPTT", \ ELEM_(bool, TTYptt, "TTYPTT", \
"Use separate device for PTT", \ "Use separate device for PTT", \
false) \ false) \

Wyświetl plik

@ -20,43 +20,46 @@ public:
//Methods //Methods
bool OpenPort(); bool OpenPort();
bool IsOpen() { return fd < 0 ? 0 : 1; }; bool IsOpen() { return fd < 0 ? 0 : 1; };
void ClosePort(); void ClosePort();
void Device (std::string dev) { device = dev;}; void Device (std::string dev) { device = dev;};
std::string Device() { return device;}; std::string Device() { return device;};
void Baud(int b) { baud = b;}; void Baud(int b) { baud = b;};
int Baud() { return baud;}; int Baud() { return baud;};
void Timeout(int tm) { timeout = tm;} void Timeout(int tm) { timeout = tm;}
int Timeout() { return timeout; } int Timeout() { return timeout; }
void Retries(int r) { retries = r;} void Retries(int r) { retries = r;}
int Retries() { return retries;} int Retries() { return retries;}
void RTS(bool r){rts = r;} void RTS(bool r){rts = r;}
bool RTS(){return rts;} bool RTS(){return rts;}
void RTSptt(bool b){rtsptt = b;} void RTSptt(bool b){rtsptt = b;}
bool RTSptt(){return rtsptt;} bool RTSptt(){return rtsptt;}
void DTR(bool d){dtr = d;} void DTR(bool d){dtr = d;}
bool DTR(){return dtr;} bool DTR(){return dtr;}
void DTRptt(bool b){dtrptt = b;} void DTRptt(bool b){dtrptt = b;}
bool DTRptt(){return dtrptt;} bool DTRptt(){return dtrptt;}
void RTSCTS(bool b){rtscts = b;} void RTSCTS(bool b){rtscts = b;}
bool RTSCTS(){return rtscts;} bool RTSCTS(){return rtscts;}
void SetPTT(bool b); void SetPTT(bool b);
void Stopbits(int n) {stopbits = (n == 1 ? 1 : 2);}
int Stopbits() { return stopbits;}
int ReadBuffer (unsigned char *b, int nbr); int ReadBuffer (unsigned char *b, int nbr);
int WriteBuffer(unsigned char *str, int nbr); int WriteBuffer(unsigned char *str, int nbr);
void FlushBuffer(); void FlushBuffer();
private: private:
//Members //Members
std::string device; std::string device;
@ -72,6 +75,7 @@ private:
bool rts; bool rts;
bool rtsptt; bool rtsptt;
bool rtscts; bool rtscts;
int stopbits;
char bfr[2048]; char bfr[2048];
//Methods //Methods
bool IOselect(); bool IOselect();
@ -88,6 +92,7 @@ public:
rtsptt = dtrptt = false; rtsptt = dtrptt = false;
rtscts = false; rtscts = false;
baud = CBR_9600; baud = CBR_9600;
stopbits = 2;
}; };
Cserial( std::string portname) { Cserial( std::string portname) {
device = portname; device = portname;
@ -125,29 +130,32 @@ public:
void Device (std::string dev) { device = dev;}; void Device (std::string dev) { device = dev;};
std::string Device() { return device;}; std::string Device() { return device;};
void Baud(int b) { baud = b;}; void Baud(int b) { baud = b;};
int Baud() { return baud;}; int Baud() { return baud;};
void Retries(int r) { retries = r;} void Retries(int r) { retries = r;}
int Retries() { return retries;} int Retries() { return retries;}
void RTS(bool r){rts = r;} void RTS(bool r){rts = r;}
bool RTS(){return rts;} bool RTS(){return rts;}
void RTSptt(bool b){rtsptt = b;} void RTSptt(bool b){rtsptt = b;}
bool RTSptt(){return rtsptt;} bool RTSptt(){return rtsptt;}
void DTR(bool d){dtr = d;} void DTR(bool d){dtr = d;}
bool DTR(){return dtr;} bool DTR(){return dtr;}
void DTRptt(bool b){dtrptt = b;} void DTRptt(bool b){dtrptt = b;}
bool DTRptt(){return dtrptt;} bool DTRptt(){return dtrptt;}
void RTSCTS(bool b){rtscts = b;} void RTSCTS(bool b){rtscts = b;}
bool RTSCTS(){return rtscts;} bool RTSCTS(){return rtscts;}
void SetPTT(bool b); void SetPTT(bool b);
void Stopbits(int n) {stopbits = (n == 1 ? 1 : 2);}
int Stopbits() { return stopbits;}
//Members //Members
private: private:
std::string device; std::string device;
@ -161,7 +169,7 @@ private:
//Is the Port Ready? //Is the Port Ready?
BOOL bPortReady; BOOL bPortReady;
//Number of Bytes Written to port //Number of Bytes Written to port
DWORD nBytesWritten; DWORD nBytesWritten;
@ -176,13 +184,13 @@ private:
int baud; int baud;
int retries; int retries;
bool dtr; bool dtr;
bool dtrptt; bool dtrptt;
bool rts; bool rts;
bool rtsptt; bool rtsptt;
bool rtscts; bool rtscts;
int stopbits;
}; };
#endif // __MINGW32__ #endif // __MINGW32__

Wyświetl plik

@ -69,60 +69,65 @@ void show_error(const char* msg1, const char* msg2 = 0)
void hamlib_get_defaults() void hamlib_get_defaults()
{ {
char szParam[40]; char szParam[40];
progdefaults.HamRigModel = hamlib_get_rig_model(cboHamlibRig->index()); progdefaults.HamRigModel = hamlib_get_rig_model(cboHamlibRig->index());
xcvr->init(progdefaults.HamRigModel);
if (xcvr->getCaps()->port_type != RIG_PORT_SERIAL) {
xcvr->close();
return;
}
xcvr->getConf("serial_speed", szParam);
progdefaults.HamRigBaudrate = progdefaults.nBaudRate(szParam);
mnuBaudRate->value(progdefaults.HamRigBaudrate);
xcvr->getConf("post_write_delay", szParam); xcvr->init(progdefaults.HamRigModel);
sscanf(szParam, "%d", &progdefaults.HamlibWait);
cntHamlibWait->value(progdefaults.HamlibWait);
xcvr->getConf("write_delay", szParam);
sscanf(szParam, "%d", &progdefaults.HamlibWriteDelay);
cntHamlibWriteDelay->value(progdefaults.HamlibWriteDelay);
xcvr->getConf("timeout", szParam);
sscanf(szParam, "%d", &progdefaults.HamlibTimeout);
cntHamlibTimeout->value(progdefaults.HamlibTimeout);
xcvr->getConf("retry", szParam);
sscanf(szParam, "%d", &progdefaults.HamlibRetries);
cntHamlibRetries->value(progdefaults.HamlibRetries);
xcvr->getConf("rts_state", szParam); if (xcvr->getCaps()->port_type != RIG_PORT_SERIAL) {
if (strcmp(szParam, "ON") == 0) xcvr->close();
progdefaults.HamlibRTSplus = true; return;
else }
progdefaults.HamlibRTSplus = false;
chkHamlibRTSplus->value(progdefaults.HamlibRTSplus);
xcvr->getConf("dtr_state", szParam); xcvr->getConf("serial_speed", szParam);
if (strcmp(szParam, "ON") == 0) progdefaults.HamRigBaudrate = progdefaults.nBaudRate(szParam);
progdefaults.HamlibDTRplus = true; mnuBaudRate->value(progdefaults.HamRigBaudrate);
else
progdefaults.HamlibDTRplus = false;
btnHamlibDTRplus->value(progdefaults.HamlibDTRplus);
progdefaults.HamlibRTSCTSflow = false;
progdefaults.HamlibXONXOFFflow = false;
xcvr->getConf("serial_handshake", szParam);
if (strcmp(szParam, "Hardware") == 0) progdefaults.HamlibRTSCTSflow = true;
if (strcmp(szParam, "XONXOFF") == 0) progdefaults.HamlibXONXOFFflow = true;
chkHamlibRTSCTSflow->value(progdefaults.HamlibRTSCTSflow);
chkHamlibXONXOFFflow->value(progdefaults.HamlibXONXOFFflow);
xcvr->close(); xcvr->getConf("post_write_delay", szParam);
sscanf(szParam, "%d", &progdefaults.HamlibWait);
cntHamlibWait->value(progdefaults.HamlibWait);
xcvr->getConf("write_delay", szParam);
sscanf(szParam, "%d", &progdefaults.HamlibWriteDelay);
cntHamlibWriteDelay->value(progdefaults.HamlibWriteDelay);
xcvr->getConf("timeout", szParam);
sscanf(szParam, "%d", &progdefaults.HamlibTimeout);
cntHamlibTimeout->value(progdefaults.HamlibTimeout);
xcvr->getConf("retry", szParam);
sscanf(szParam, "%d", &progdefaults.HamlibRetries);
cntHamlibRetries->value(progdefaults.HamlibRetries);
xcvr->getConf("rts_state", szParam);
if (strcmp(szParam, "ON") == 0)
progdefaults.HamlibRTSplus = true;
else
progdefaults.HamlibRTSplus = false;
chkHamlibRTSplus->value(progdefaults.HamlibRTSplus);
xcvr->getConf("dtr_state", szParam);
if (strcmp(szParam, "ON") == 0)
progdefaults.HamlibDTRplus = true;
else
progdefaults.HamlibDTRplus = false;
btnHamlibDTRplus->value(progdefaults.HamlibDTRplus);
progdefaults.HamlibRTSCTSflow = false;
progdefaults.HamlibXONXOFFflow = false;
xcvr->getConf("serial_handshake", szParam);
if (strcmp(szParam, "Hardware") == 0) progdefaults.HamlibRTSCTSflow = true;
if (strcmp(szParam, "XONXOFF") == 0) progdefaults.HamlibXONXOFFflow = true;
chkHamlibRTSCTSflow->value(progdefaults.HamlibRTSCTSflow);
chkHamlibXONXOFFflow->value(progdefaults.HamlibXONXOFFflow);
xcvr->getConf("stop_bits", szParam);
progdefaults.HamRigStopbits = 2;
if (strcmp(szParam, "1") == 0) progdefaults.HamRigStopbits = 1;
valHamRigStopbits->value(progdefaults.HamRigStopbits);
xcvr->close();
} }
bool hamlib_init(bool bPtt) bool hamlib_init(bool bPtt)
@ -171,13 +176,13 @@ bool hamlib_init(bool bPtt)
if (progdefaults.HamlibRTSplus) if (progdefaults.HamlibRTSplus)
xcvr->setConf("rts_state", "ON"); xcvr->setConf("rts_state", "ON");
else else
xcvr->setConf("rts_state", "OFF"); xcvr->setConf("rts_state", "OFF");
if (progdefaults.HamlibDTRplus) if (progdefaults.HamlibDTRplus)
xcvr->setConf("dtr_state", "ON"); xcvr->setConf("dtr_state", "ON");
else else
xcvr->setConf("dtr_state", "OFF"); xcvr->setConf("dtr_state", "OFF");
if (progdefaults.HamlibRTSCTSflow) if (progdefaults.HamlibRTSCTSflow)
xcvr->setConf("serial_handshake", "Hardware"); xcvr->setConf("serial_handshake", "Hardware");
@ -186,6 +191,7 @@ bool hamlib_init(bool bPtt)
else else
xcvr->setConf("serial_handshake", "None"); xcvr->setConf("serial_handshake", "None");
} }
xcvr->setConf("stop_bits", progdefaults.HamRigStopbits == 1 ? "1" : "2");
string::size_type c = progdefaults.HamConfig.find('#'); string::size_type c = progdefaults.HamConfig.find('#');
if (c != string::npos) if (c != string::npos)
@ -200,7 +206,6 @@ bool hamlib_init(bool bPtt)
conf += end; conf += end;
} }
} }
xcvr->open(); xcvr->open();
} }
catch (const RigException& Ex) { catch (const RigException& Ex) {
@ -211,7 +216,7 @@ bool hamlib_init(bool bPtt)
MilliSleep(500); MilliSleep(500);
LOG_INFO("trying frequency request"); LOG_INFO("trying frequency request");
try { try {
need_freq = true; need_freq = true;
freq = xcvr->getFreq(); freq = xcvr->getFreq();
@ -234,12 +239,12 @@ bool hamlib_init(bool bPtt)
show_error("Get Mode", Ex.what()); show_error("Get Mode", Ex.what());
need_mode = false; need_mode = false;
} }
try { try {
if (hamlib_ptt == true) { if (hamlib_ptt == true) {
LOG_INFO("trying PTT"); LOG_INFO("trying PTT");
xcvr->setPTT(RIG_PTT_OFF); xcvr->setPTT(RIG_PTT_OFF);
} }
} }
catch (const RigException& Ex) { catch (const RigException& Ex) {
show_error("Set Ptt", Ex.what()); show_error("Set Ptt", Ex.what());
@ -257,15 +262,15 @@ bool hamlib_init(bool bPtt)
hamlib_exit = false; hamlib_exit = false;
hamlib_bypass = false; hamlib_bypass = false;
if (pthread_create(&hamlib_thread, NULL, hamlib_loop, NULL) < 0) { if (pthread_create(&hamlib_thread, NULL, hamlib_loop, NULL) < 0) {
show_error(__func__, "pthread_create failed"); show_error(__func__, "pthread_create failed");
xcvr->close(); xcvr->close();
return false; return false;
} }
init_Hamlib_RigDialog(); init_Hamlib_RigDialog();
hamlib_closed = false; hamlib_closed = false;
return true; return true;
} }
@ -302,7 +307,7 @@ bool hamlib_active(void)
void hamlib_set_ptt(int ptt) void hamlib_set_ptt(int ptt)
{ {
if (xcvr->isOnLine() == false) if (xcvr->isOnLine() == false)
return; return;
if (!hamlib_ptt) if (!hamlib_ptt)
return; return;
@ -320,7 +325,7 @@ void hamlib_set_ptt(int ptt)
void hamlib_set_qsy(long long f, long long fmid) void hamlib_set_qsy(long long f, long long fmid)
{ {
if (xcvr->isOnLine() == false) if (xcvr->isOnLine() == false)
return; return;
pthread_mutex_lock(&hamlib_mutex); pthread_mutex_lock(&hamlib_mutex);
double fdbl = f; double fdbl = f;
@ -416,7 +421,7 @@ static void *hamlib_loop(void *args)
long int freq = 0L; long int freq = 0L;
rmode_t numode = RIG_MODE_NONE; rmode_t numode = RIG_MODE_NONE;
bool freqok = false, modeok = false; bool freqok = false, modeok = false;
for (;;) { for (;;) {
MilliSleep(100); MilliSleep(100);
if (hamlib_exit) if (hamlib_exit)
@ -425,7 +430,7 @@ static void *hamlib_loop(void *args)
continue; continue;
// hamlib locked while accessing hamlib serial i/o // hamlib locked while accessing hamlib serial i/o
pthread_mutex_lock(&hamlib_mutex); pthread_mutex_lock(&hamlib_mutex);
if (need_freq) { if (need_freq) {
freq_t f; freq_t f;
try { try {
@ -444,7 +449,7 @@ static void *hamlib_loop(void *args)
} }
if (hamlib_exit) if (hamlib_exit)
break; break;
if (need_mode && hamlib_rmode == numode) { if (need_mode && hamlib_rmode == numode) {
try { try {
numode = xcvr->getMode(hamlib_pbwidth); numode = xcvr->getMode(hamlib_pbwidth);
@ -467,7 +472,7 @@ static void *hamlib_loop(void *args)
show_frequency(hamlib_freq); show_frequency(hamlib_freq);
wf->rfcarrier(hamlib_freq); wf->rfcarrier(hamlib_freq);
} }
if (modeok && (hamlib_rmode != numode)) { if (modeok && (hamlib_rmode != numode)) {
hamlib_rmode = numode; hamlib_rmode = numode;
show_mode(modeString(hamlib_rmode)); show_mode(modeString(hamlib_rmode));
@ -480,7 +485,7 @@ static void *hamlib_loop(void *args)
hamlib_rmode == RIG_MODE_ECSSLSB || hamlib_rmode == RIG_MODE_ECSSLSB ||
hamlib_rmode == RIG_MODE_RTTY)); hamlib_rmode == RIG_MODE_RTTY));
} }
if (hamlib_exit) if (hamlib_exit)
break; break;
} }

Wyświetl plik

@ -50,8 +50,8 @@ const struct rig_caps* Rig::getCaps(void)
void Rig::open(void) void Rig::open(void)
{ {
int err; int err = rig_open(rig);
if ((err = rig_open(rig)) != RIG_OK) if (err != RIG_OK)
throw RigException(err); throw RigException(err);
} }

Plik diff jest za duży Load Diff

Wyświetl plik

@ -38,6 +38,7 @@ Cserial::Cserial() {
rtsptt = dtrptt = false; rtsptt = dtrptt = false;
rtscts = false; rtscts = false;
status = 0; status = 0;
stopbits = 2;
fd = -1; fd = -1;
} }
@ -69,7 +70,7 @@ bool Cserial::OpenPort() {
newtio.c_cflag &= ~PARENB; newtio.c_cflag &= ~PARENB;
if (0) if (stopbits == 1)
newtio.c_cflag &= ~CSTOPB; // 1 stop bit newtio.c_cflag &= ~CSTOPB; // 1 stop bit
else else
newtio.c_cflag |= CSTOPB; // 2 stop bit newtio.c_cflag |= CSTOPB; // 2 stop bit
@ -284,7 +285,7 @@ BOOL Cserial::OpenPort()
if(hComm == INVALID_HANDLE_VALUE) if(hComm == INVALID_HANDLE_VALUE)
return FALSE; return FALSE;
ConfigurePort( baud, 8, FALSE, NOPARITY, ONESTOPBIT); ConfigurePort( baud, 8, FALSE, NOPARITY, stopbits);
FlushBuffer(); FlushBuffer();