hi - - here's a quick patch for rx320, version 0.4.2, for linux - i am NOT the client's author! so heed a standard disclaimer that if you use this patch, you do so at your own risk! (not that anything bad will happen - you DO back up your data, right?) :-) - this patch implements a few things: 1. you can tap the 'q' key to quit the application 2. tuning to the low- or high-end of the frequencies will now 'roll over'... for example, if you go to 30000MHz, you'll roll to 500kHz (i know, the rcvr is capable of lower freqs) 3. the app now does rudimentary scanning according to a 'sensitivity' provided by a new slider control... you can scan up or down... the incremental tuning will be done according to the 'step' you have selected... the recvr will stop when an average of five signal samplings on a particular frequency exceeds the 'selectivity' you have set by the 'Sens' slider control... the Sens slider allows any choice of sensitivity in any range from 1000 to 9000, with 1000 for weak signals and 9000 for very strong local signals... because i'm an idiot and don't know C++ that well, you will have to keep in mind that when you click the Scan up or down (forward or backward?) buttons, and choose a number higher than 2000 in a band with poor reception, you will have to wait until a strong signal is received before the app stops scanning... this can be avoided by using a lower Sens setting or a larger step in your scan.. (or just kill or ctrl+c the client) 4. apply the patch by first decompressing the original .tgz source file (a compressed tarball) for rx320-0.4.2: $ tar xvzf rx320-0.4.2.tgz 5. next, use the patch command to implement the changes: $ patch -p0 #include +#define SCAN #define RX320_USB 1 #define RX320_LSB 2 @@ -48,7 +49,6 @@ #define MSG_VERSION 3 #define MSG_ERROR 4 - struct SFilter { int bandwidth; int filter; @@ -80,10 +80,14 @@ int SetVolume(int output, int vol); int GetVolume(int output) const; - + +#ifdef SCAN + int SetSense(int sensitivity); +#endif + int SetAGC(int agc); int GetAGC() const { return _agc; } - + int SetBFO(int bfo); int GetBFO() const { return Cbfo; } diff -u ../rx320-0.4.2/OXDisplayPanel.cc rx320-0.4.2/OXDisplayPanel.cc --- ../rx320-0.4.2/OXDisplayPanel.cc Mon Aug 26 10:26:17 2002 +++ rx320-0.4.2/OXDisplayPanel.cc Sat Feb 1 23:05:09 2003 @@ -1,3 +1,4 @@ + /************************************************************************** This file is part of rx320, a control program for the Ten-Tec RX320 @@ -27,7 +28,6 @@ #include "muted.xpm" - //---------------------------------------------------------------------- OXDisplayPanel::OXDisplayPanel(const OXWindow *p) : @@ -73,7 +73,6 @@ _modeB->SetFont(_client->GetFont("Helvetica -8")); _modeB->SetTextAlignment(TEXT_LEFT); - _freqB = new OXLabel(hfB, new OString("00.000.000")); hfB->AddFrame(_freqB, new OLayoutHints(LHINTS_BOTTOMRIGHT)); @@ -98,6 +97,14 @@ _bw->SetTextColor(_client->GetColorByName("#00ffff")); _bw->SetFont(_client->GetFont("Helvetica -12")); vf->AddFrame(_bw, ll); + +#ifdef SCAN + _sens = new OXLabel(vf, new OString("Sens: ")); + _sens->SetTextColor(_client->GetColorByName("#00ffff")); + _sens->SetFont(_client->GetFont("Helvetica -12")); + vf->AddFrame(_sens, ll); +#endif + _pwr = new OXLabel(vf, new OString("")); _pwr->SetTextColor(_client->GetColorByName("red")); _pwr->SetFont(_client->GetFont("Helvetica -12 bold")); @@ -192,11 +199,36 @@ Layout(); } +#ifdef SCAN +void OXDisplayPanel::PowerOn(int msg) { + switch(msg) { + case 1: + _pwr->SetText(new OString("Power ON")); + if (!_t) _t = new OTimer(this, 3500); + Layout(); + break; + case 2: + _pwr->SetText(new OString("Scanning")); + if (!_t) _t = new OTimer(this, 2500); + Layout(); + break; + } +} + +void OXDisplayPanel::SetDisp(int sens) { + char str[100]; + + sprintf(str, "Sens: %d", abs(sens)); + _sens->SetText(new OString(str)); + Layout(); +} +#else void OXDisplayPanel::PowerOn() { _pwr->SetText(new OString("Power ON")); if (!_t) _t = new OTimer(this, 1500); Layout(); } +#endif void OXDisplayPanel::SetMuted(int onoff) { if (onoff) diff -u ../rx320-0.4.2/OXDisplayPanel.h rx320-0.4.2/OXDisplayPanel.h --- ../rx320-0.4.2/OXDisplayPanel.h Mon Aug 26 10:26:17 2002 +++ rx320-0.4.2/OXDisplayPanel.h Sat Feb 1 22:17:54 2003 @@ -30,10 +30,10 @@ #include "OXSMeter.h" - #define VFO_A 1 #define VFO_B 2 +#define SCAN class OXDisplayPanel : public OXCompositeFrame { public: @@ -48,7 +48,12 @@ void SetAGC(int agc); void SetPBT(int pbt); void SetBW(int bw); +#ifdef SCAN + void PowerOn(int msg); + void SetDisp(int sens); +#else void PowerOn(); +#endif void SetMuted(int onoff); OXSMeter *Smeter() const { return _Smeter; } @@ -58,6 +63,9 @@ OXLabel *_freqA, *_freqB, *_modeA, *_modeB; OXLabel *_agc, *_tstep, *_pbt, *_bw, *_pwr; OXIcon *_muted; +#ifdef SCAN + OXLabel *_sens; +#endif OXSMeter *_Smeter; OTimer *_t; }; diff -u ../rx320-0.4.2/main.cc rx320-0.4.2/main.cc --- ../rx320-0.4.2/main.cc Mon Aug 26 10:26:17 2002 +++ rx320-0.4.2/main.cc Sat Feb 1 23:37:47 2003 @@ -83,7 +83,6 @@ #define M_CONFIG 101 #define M_EXIT 102 - //--------------------------------------------------------------------- OXMain::OXMain(const OXWindow *p, int w, int h) : @@ -181,6 +180,22 @@ _mode[i]->Associate(this); } +#ifdef SCAN + _scan = new OXTextButton(vef, new OHotString("Scan>"), 701); + vef->AddFrame(_scan, new OLayoutHints(LHINTS_BOTTOM | LHINTS_EXPAND_X)); + _scan->SetFont(_client->GetFont("Lucida -10")); + _scan->TakeFocus(False); + _scan->Associate(this); + vef->Resize(ww + 10, vef->GetDefaultHeight()); + + _scan = new OXTextButton(vef, new OHotString("AddFrame(_scan, new OLayoutHints(LHINTS_BOTTOM | LHINTS_EXPAND_X)); + _scan->SetFont(_client->GetFont("Lucida -10")); + _scan->TakeFocus(False); + _scan->Associate(this); + vef->Resize(ww + 10, vef->GetDefaultHeight()); +#endif + _mute = new OXTextButton(vef, new OHotString("Mu&te"), 901); vef->AddFrame(_mute, new OLayoutHints(LHINTS_BOTTOM | LHINTS_EXPAND_X)); _mute->SetFont(_client->GetFont("Lucida -10")); @@ -292,6 +307,19 @@ vef->AddFrame(_al, lh1); hf->AddFrame(vef, ls); +#ifdef SCAN + vef = new OXVerticalFrame(hf, 10, 10); + _al = new OXLabel(vef, new OString("Sens")); + _al->SetFont(_client->GetFont("Helvetica -12 bold")); + _al->Set3DStyle(LABEL_SUNKEN); + _sensitivity = new OXVSlider(vef, 100, SLIDER_2 | SCALE_NONE, 305); + _sensitivity->Associate(this); + _sensitivity->SetRange(+10, +90); + _sensitivity->SetPosition(0); + vef->AddFrame(_sensitivity, lh1); + vef->AddFrame(_al, lh1); + hf->AddFrame(vef, ls); +#endif //----------------- other controls... // _reset = new OXTextButton(this, new OHotString("&Reset"), 100); @@ -367,8 +395,11 @@ SetClassHints("XCLASS", "RX320"); _dpanel->SetMuted(False); +#ifdef SCAN + _dpanel->PowerOn(1); +#else _dpanel->PowerOn(); - +#endif #if 0 XGrabButton(GetDisplay(), Button4, AnyModifier, _id, False, ButtonPressMask | ButtonReleaseMask, @@ -627,7 +658,15 @@ case 404: TuneDown(10); break; +#ifdef SCAN + case 701: + Scan(1); + break; + case 702: + Scan(-1); + break; +#endif case 801: case 802: case 803: @@ -715,6 +754,20 @@ _rx->SetBFO(100 * slmsg->pos); _dpanel->SetPBT(_rx->GetBFO()); break; +#ifdef SCAN + case 305: + int sensitivity = 0 ; + char sense[256]; + + sensitivity = _rx->SetSense(100 * slmsg->pos); +#if 0 + printf("slider: %d\n",sensitivity); +#endif + sprintf(sense, "%d", sensitivity); + _vfoA.sensitivity = atol(sense); + _dpanel->SetDisp(_vfoA.sensitivity); +#endif + break; } break; } @@ -732,7 +785,11 @@ break; case MSG_POWERON: +#ifdef SCAN + _dpanel->PowerOn(1); +#else _dpanel->PowerOn(); +#endif break; default: @@ -765,6 +822,38 @@ UpdateSliders(); } +#ifdef SCAN +void OXMain::Scan(int updown) { + _dpanel->PowerOn(2); + _vfoA.freq = _rx->GetFrequency(); + switch (updown) { + case 1: TuneUp(1,1); _dpanel->SetFreq(1,_vfoA.freq); Layout(); break; + case -1: TuneDown(1,1); _dpanel->SetFreq(1,_vfoA.freq); Layout(); break; + } + if (_vfoA.freq > 30000000) _vfoA.freq = 60000; + if (_vfoA.freq < 60000) _vfoA.freq = 30000000; +// usleep(250000); + int tmp1, tmp2, tmp3, tmp4, tmp5, tmp6 = 0; + tmp1 = _rx->GetSignal(); + tmp2 = _rx->GetSignal(); + tmp3 = _rx->GetSignal(); + tmp4 = _rx->GetSignal(); + tmp5 = _rx->GetSignal(); +#if 0 + printf("%d: %d %d %d %d %d\n",(_vfoA.freq = _rx->GetFrequency()),tmp1,tmp2, tmp3, tmp4, tmp5, tmp6); + printf("sens: %d\n",_vfoA.sensitivity); +#endif + tmp6 = (tmp1+tmp2+tmp3+tmp4+tmp5) / 5; +#if 0 + printf("avg: %d\n", tmp6); +#endif + if (tmp6 == 0) return; + if (tmp6 > _vfoA.sensitivity) { + return; + } else { Scan(updown); } +} +#endif + void OXMain::CopyVFO() { _vfoB = _vfoA; UpdateDisplay(); @@ -795,7 +884,11 @@ void OXMain::TuneUp(int steps, int move_knob) { _vfoA.freq = _rx->GetFrequency() + steps * _vfoA.step; +#ifdef SCAN + if (_vfoA.freq > 30000000) _vfoA.freq = 50000; +#else if (_vfoA.freq > 30000000) _vfoA.freq = 30000000; +#endif _rx->SetFrequency(_vfoA.freq); _dpanel->SetFreq(VFO_A, _vfoA.freq); if (move_knob) _knob->StepKnob(1); @@ -803,7 +896,11 @@ void OXMain::TuneDown(int steps, int move_knob) { _vfoA.freq = _rx->GetFrequency() - steps * _vfoA.step; - if (_vfoA.freq < 50000) _vfoA.freq = 50000; +#ifdef SCAN + if (_vfoA.freq < 50000) _vfoA.freq = 30000000; +#else + if (_vfoA.freq > 50000) _vfoA.freq = 50000; +#endif _rx->SetFrequency(_vfoA.freq); _dpanel->SetFreq(VFO_A, _vfoA.freq); if (move_knob) _knob->StepKnob(-1); @@ -889,7 +986,14 @@ tmp[n] = 0; switch (keysym) { - case XK_Delete: + +#ifdef SCAN + case XK_q: + CloseWindow(); + break; +#endif + + case XK_Delete: case XK_BackSpace: break; diff -u ../rx320-0.4.2/main.h rx320-0.4.2/main.h --- ../rx320-0.4.2/main.h Mon Aug 26 10:26:17 2002 +++ rx320-0.4.2/main.h Sat Feb 1 22:52:18 2003 @@ -22,6 +22,8 @@ #ifndef __MAIN_H #define __MAIN_H +#define SCAN + #include #include #include @@ -30,11 +32,17 @@ #include #include - +#ifdef SCAN +struct Svfo { + long freq, step; + int mode, agc, filter, cwbfo, pbt, sensitivity; +}; +#else struct Svfo { long freq, step; int mode, agc, filter, cwbfo, pbt; }; +#endif class ORX320; class OFreqRecord; @@ -42,7 +50,6 @@ class OXDisplayPanel; class OXTuningKnob; - //--------------------------------------------------------------------- class OXMain : public OXMainFrame { @@ -65,6 +72,9 @@ void TuneDown(int steps, int move_knob = True); void VolumeUp(int steps, int channel); void VolumeDown(int steps, int channel); +#ifdef SCAN + void Scan(int updown); +#endif void UpdateDisplay(); void UpdateSliders(); @@ -81,6 +91,10 @@ OXTextButton *_reset, *_mute; OXPictureButton *_up, *_up2, *_down, *_down2; OXTextButton *_agc[3], *_mode[4], *_vfo[2], *_step[6]; +#ifdef SCAN + OXTextButton *_scan; + OXVSlider *_sensitivity; +#endif OXVSlider *_spkvol, *_linevol, *_bw, *_bfo; OXTuningKnob *_knob;