Upstream version 3.0preP

pull/2/head
Stelios Bounanos 2008-07-06 10:12:27 +01:00
rodzic ea4bb7db24
commit a577acc3a3
33 zmienionych plików z 408 dodań i 272 usunięć

Wyświetl plik

@ -9,7 +9,7 @@ dnl major and minor must be integers; patch may
dnl contain other characters or be empty
m4_define(FLDIGI_MAJOR, [3])
m4_define(FLDIGI_MINOR, [0])
m4_define(FLDIGI_PATCH, [preO])
m4_define(FLDIGI_PATCH, [preP])
AC_INIT([fldigi], FLDIGI_MAJOR.FLDIGI_MINOR[FLDIGI_PATCH], [w1hkj AT w1hkj DOT com])

Wyświetl plik

@ -136,6 +136,7 @@ fldigi_SOURCES += \
filters/viterbi.cxx \
globals/globals.cxx \
include/htmlstrings.h \
include/afcind.h \
include/Combo_Box.h \
include/Combo_List.h \
include/confdialog.h \
@ -296,6 +297,7 @@ fldigi_SOURCES += \
waterfall/digiscope.cxx \
waterfall/raster.cxx \
waterfall/waterfall.cxx \
widgets/afcind.cxx \
widgets/FTextView.cxx \
widgets/Fl_Text_Display_mod.cxx \
widgets/Fl_Text_Editor_mod.cxx \

Wyświetl plik

@ -58,6 +58,7 @@ void cw::rx_init()
set_scope_mode(Digiscope::SCOPE);
put_MODEstatus(mode);
usedefaultWPM = false;
set_AFCind(0.0);
}
void cw::init()

Wyświetl plik

@ -60,6 +60,7 @@ void rtty::rx_init()
}
bitfilt->reset();
poserr = negerr = 0.0;
set_AFCrange(shift/10.0);
}
void rtty::init()
@ -519,7 +520,8 @@ int rtty::rx_process(const double *buf, int len)
if (progStatus.afconoff) {
if (metric > progStatus.sldrSquelchValue || !progStatus.sqlonoff || sigsearch) {
set_freq(frequency + freqerr);
}
set_AFCind(freqerr);
} else set_AFCind(0.0);
}
}
}

Wyświetl plik

@ -50,6 +50,7 @@
#include "waterfall.h"
#include "raster.h"
#include "progress.h"
#include "afcind.h"
#include "main.h"
#include "threads.h"
@ -149,6 +150,7 @@ Fl_Button *btnQRZ;
Fl_Group *MixerFrame;
Fl_Slider *valRcvMixer;
Fl_Slider *valXmtMixer;
AFCind *AFCindicator;
int altMacros = 0;
bool bSaveFreqList = false;
@ -195,7 +197,10 @@ Fl_Menu_Item quick_change_qpsk[] = {
Fl_Menu_Item quick_change_mfsk[] = {
{ mode_info[MODE_MFSK8].name, 0, cb_init_mode, (void *)MODE_MFSK8 },
{ mode_info[MODE_MFSK11].name, 0, cb_init_mode, (void *)MODE_MFSK11 },
{ mode_info[MODE_MFSK16].name, 0, cb_init_mode, (void *)MODE_MFSK16 },
{ mode_info[MODE_MFSK22].name, 0, cb_init_mode, (void *)MODE_MFSK22 },
{ mode_info[MODE_MFSK32].name, 0, cb_init_mode, (void *)MODE_MFSK32 },
{ 0 }
};
@ -438,7 +443,11 @@ void init_modem(trx_mode mode)
modem_config_tab = tabFeld;
break;
case MODE_MFSK8: case MODE_MFSK16:
case MODE_MFSK8:
case MODE_MFSK11:
case MODE_MFSK16:
case MODE_MFSK22:
case MODE_MFSK32:
startup_modem(*mode_info[mode].modem ? *mode_info[mode].modem :
*mode_info[mode].modem = new mfsk(mode));
quick_change = quick_change_mfsk;
@ -765,17 +774,12 @@ void cb_mnuBeginnersURL(Fl_Widget*, void*)
{
string deffname = HomeDir;
deffname.append("beginners.html");
ifstream f_in(deffname.c_str(), ios::in);
if (!f_in) {
ofstream f_out(deffname.c_str(), ios::out);
f_out << szBeginner;
f_out.close();
} else
f_in.close();
string htmlfilename = "file://";
htmlfilename.append(HomeDir);
htmlfilename.append("beginners.html");
cb_mnuVisitURL( NULL, (void *)htmlfilename.c_str());
ofstream f(deffname.c_str());
if (!f)
return;
f << szBeginner;
f.close();
cb_mnuVisitURL(NULL, (void *)deffname.insert(0, "file://").c_str());
}
void cb_mnuAboutURL(Fl_Widget*, void*)
@ -1189,7 +1193,10 @@ Fl_Menu_Item menu_[] = {
{"MFSK", 0, 0, 0, FL_SUBMENU, FL_NORMAL_LABEL, 0, 14, 0},
{ mode_info[MODE_MFSK8].name, 0, cb_init_mode, (void *)MODE_MFSK8, 0, FL_NORMAL_LABEL, 0, 14, 0},
{ mode_info[MODE_MFSK11].name, 0, cb_init_mode, (void *)MODE_MFSK11, 0, FL_NORMAL_LABEL, 0, 14, 0},
{ mode_info[MODE_MFSK16].name, 0, cb_init_mode, (void *)MODE_MFSK16, 0, FL_NORMAL_LABEL, 0, 14, 0},
{ mode_info[MODE_MFSK22].name, 0, cb_init_mode, (void *)MODE_MFSK22, 0, FL_NORMAL_LABEL, 0, 14, 0},
{ mode_info[MODE_MFSK32].name, 0, cb_init_mode, (void *)MODE_MFSK32, 0, FL_NORMAL_LABEL, 0, 14, 0},
{0,0,0,0,0,0,0,0,0},
{"MT63", 0, 0, 0, FL_SUBMENU, FL_NORMAL_LABEL, 0, 14, 0},
@ -1685,19 +1692,25 @@ void create_fl_digi_main() {
StatusBar = new Fl_Box(
rightof(Status2), Hmenu+Hrcvtxt+Hxmttxt+Hwfall,
WNOM - bwSqlOnOff - bwAfcOnOff - Wwarn - rightof(Status2), Hstatus, "");
WNOM - bwSqlOnOff - bwAfcOnOff - Wwarn - rightof(Status2) - 60,
Hstatus, "");
StatusBar->box(FL_DOWN_BOX);
StatusBar->color(FL_BACKGROUND2_COLOR);
StatusBar->align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
WARNstatus = new Fl_Box(
WNOM - bwSqlOnOff - bwAfcOnOff - Wwarn, Hmenu+Hrcvtxt+Hxmttxt+Hwfall,
rightof(StatusBar), Hmenu+Hrcvtxt+Hxmttxt+Hwfall,
Wwarn, Hstatus, "");
WARNstatus->box(FL_DIAMOND_DOWN_BOX);
WARNstatus->color(FL_BACKGROUND_COLOR);
WARNstatus->labelcolor(FL_RED);
WARNstatus->align(FL_ALIGN_CENTER | FL_ALIGN_INSIDE);
AFCindicator = new AFCind(
rightof(WARNstatus), Hmenu+Hrcvtxt+Hxmttxt+Hwfall,
60,
Hstatus, "");
if (useCheckButtons) {
btn_afconoff = new Fl_Check_Button(
WNOM - bwSqlOnOff - bwAfcOnOff,
@ -1732,11 +1745,9 @@ void create_fl_digi_main() {
fl_digi_main->end();
fl_digi_main->callback(cb_wMain);
#if defined(__APPLE__)
// FIXME: how do we set the window icon on OS X?
#elif defined (__CYGWIN__)
#if defined (__CYGWIN__)
fl_digi_main->icon((char*)LoadIcon(fl_display, MAKEINTRESOURCE(IDI_ICON)));
#else
#elif defined (__linux__)
make_pixmap(&fldigi_icon_pixmap, fldigi_icon_48_xpm);
fl_digi_main->icon((char *)fldigi_icon_pixmap);
#endif
@ -1748,7 +1759,7 @@ void create_fl_digi_main() {
scopeview->xclass(PACKAGE_NAME);
digiscope = new Digiscope (0, 0, 140, 140);
scopeview->resizable(digiscope);
scopeview->size_range(50, 50, 0, 0, 0, 0, 1);
scopeview->size_range(SCOPEWIN_MIN_WIDTH, SCOPEWIN_MIN_HEIGHT);
scopeview->end();
scopeview->hide();
@ -1800,8 +1811,11 @@ void put_cwRcvWPM(double wpm)
void set_scope_mode(Digiscope::scope_mode md)
{
if (digiscope)
if (digiscope) {
digiscope->mode(md);
REQ(&Fl_Window::size_range, scopeview, SCOPEWIN_MIN_WIDTH, SCOPEWIN_MIN_HEIGHT,
0, 0, 0, 0, (md == Digiscope::PHASE || md == Digiscope::XHAIRS));
}
if (wfscope)
wfscope->mode(md);
}
@ -2286,7 +2300,8 @@ void change_modem_param(int state)
}
else if (state & FL_SHIFT) {
val = sldrSquelch;
d = -d;
if (!twoscopes)
d = -d;
}
val->value(val->clamp(val->increment(val->value(), -d)));
@ -2316,3 +2331,15 @@ void start_tx()
wf->set_XmtRcvBtn(true);
}
void set_AFCind(double val)
{
REQ (&AFCind::value, AFCindicator, val );
}
void set_AFCrange(double val)
{
AFCindicator->range(val);
}

Wyświetl plik

@ -85,7 +85,7 @@ modulation systems, speeds and bandwidths suit different operating conditions.
<P>\
Other factors such as available band space, operating speed and convenience, noise level, signal level and \
available power also affect the choice of mode. While in many cases several different modes might be suitable, \
having a choice adds to the operating pleasure. It is diffcult to advise which mode is best for each particular \
having a choice adds to the operating pleasure. It is difficult to advise which mode is best for each particular \
occasion, and experience plays an important role. \
<P>\
You might consider purchasing '<I>Digital Modes for All Occasions</I>' \
@ -243,7 +243,7 @@ leave it in 'Waterfall' mode, as this is the easiest to tune with, and gives the
is analysed and displayed with lower frequencies to the left, higher to the right. Weak signals and background noise \
are dark while stronger signals show as brighter colours. As time passes (over a few seconds), the historic signals move downwards like a waterfall. \
<LI>'FFT' is a spectrum display, simply the mean signal strength versus frequency. Again frequency is displayed from left to right, \
but now the vertical direction shows signal strength and there is no brightness or historic onformation.</UL> \
but now the vertical direction shows signal strength and there is no brightness or historic information.</UL> \
<P>\
At the top of the pane is a scale of frequency in Hz, which corresponds to the frequency displayed immediately below it. This \
scale can be moved around and zoomed using buttons in the CONTROL group. \
@ -263,7 +263,7 @@ it will be decoded; as soon as you release the mouse, decoding will revert to th
<BLOCKQUOTE>\
Using this group of entry boxes, you can keep a log of your QSOs. At the left are two '<B>Frequency</B>' boxes. \
If you use CAT control to operate your transceiver, the dial frequency is recorded automatically in the lower box; \
otherwise you can type it manually or select (botton to the right) from a list of common frequencies. The audio frequency from the waterfall \
otherwise you can type it manually or select (button to the right) from a list of common frequencies. The audio frequency from the waterfall \
is added to this value and displayed in the upper box - assuming your rig is calibrated correctly, this is the true \
centre frequency of the station you are in QSO with. You can't type in the upper box. \
<P>\
@ -275,7 +275,7 @@ frequency is displayed and logged. \
The '<B>Time</B>' box can be typed in, or you can push the adjacent button to insert the current time. All times are in UTC, \
and the computer knows how to calculate this from the PC local civil time, time zone and summer-time setting. Clever stuff! \
<P>\
You can type the other station's callsign and name in the '<B>Call</B>' and '<B>Namel</B>' boxes, or right-click \
You can type the other station's callsign and name in the '<B>Call</B>' and '<B>Name</B>' boxes, or right-click \
on the appropriate word in the RECEIVE pane to insert them automatically. The same applies to the '<B>QTH</B>', \
'<B>LOC</B>' (locator) and received signal report '<B>RST In</B>'. The other entries must be added manually. \
If you have access to an appropriate Callbook on-line subscription or CD, pressing the '<B>QRZ</B>' button will fetch \
@ -293,7 +293,7 @@ Use &lt;<B>Esc</B>&gt; to quit from the menu with no change. \
These menu functions are: \
</BLOCKQUOTE>\
<DL><DT><B><U>F</U>iles</B></DT>\
<DD>Allows you to open or save Macros (we won't get into that here), turn on/off logging to file, record/play audio samples, and exit the program. You can also exit the program by clicking on the 'X' in the tope right corner of the window, in the usual manner.</DD> \
<DD>Allows you to open or save Macros (we won't get into that here), turn on/off logging to file, record/play audio samples, and exit the program. You can also exit the program by clicking on the 'X' in the top right corner of the window, in the usual manner.</DD> \
<DT><B>Op <U>M</U>ode</B></DT>\
<DD>This is where you select the operating modem used for transmission and reception. Some modes only have one option. Where more are \
offered, drag the mouse down the list and sideways following the arrow to a secondary list, before releasing it. When you start the \
@ -323,6 +323,15 @@ is a rather cool tool that allows you to monitor several PSK31 signals all at th
<DD>Brings up the <A HREF=\"http://www.w1hkj.com/FldigiHelp/index.html\">Online Documentation</A>, the FLDIGI \
<A HREF=\"http://www.w1hkj.com/Fldigi.html\">Home Page</A>, and various information about the program.</DD> \
</DL>\
The two non-menu functions are:\
<DL><DT><B>RSID ?</B></DT>\
<DD>This button turns on the receive RSID (automatic mode detection and tuning) feature. When in use, the button turns yellow and no text reception is possible until \
a signal is identified, or the feature is turned off again. If you plan to use the RSID feature on receive, \
you must leave the 'Start New Modem at Sweet Spot' item in the Menu Configure/Defaults/Mics tab unchecked.</DD>\
<DT><B>TUNE</B></DT>\
<DD>This button transmits a continuous tone at the current audio frequency. The tone level will be at the maximum signal level for any modem, \
which makes this function useful for adjusting your transceiver's output power.</DD>\
</DL>\
<H3><I>FUNCTIONS</I></H3>\
<BLOCKQUOTE>\
This line of buttons provides user-editable QSO features. For example, the first button on the left sends CQ for you. Both the \
@ -345,22 +354,21 @@ If you REALLY mess up the Macros and can't see how to fix them, just close the p
The line of buttons under the waterfall is used to control the program (as opposed to the QSO). If you hover the mouse over \
these buttons, you'll see a little yellow hint box appear which tells you what each button does. \
<P>\
The <B>Id?</B> button turns on the receive \
RSID (automatic mode detection and tuning) feature. When in use, the button turns yellow and no text reception is possible until \
a signal is identified, or the feature is turned off again. If you plan to use the RSID feature on receive, \
you must leave the 'Start New Modem at Sweet Spot' item in the Menu Configure/Defaults/Mics tab unchecked. \
The first button switches between Waterfall and FFT modes. The next two buttons adjust the signal level over which the waterfall works. \
The default range is from 0dB downwards 70dB (i.e. to -70dB). Both of these values can be adjusted to suit your sound card and receiver audio level.\
<P>\
The next three buttons control waterfall behaviour. The first switches between Waterfall and FFT modes; the next sets the scale \
zoom factor (visible display width, x1, x2 or x4); the third selects the waterfall speed. NORM or SLOW setting is best unless \
you have a very fast computer. \
The next button sets the scale zoom factor (visible display width, x1, x2 or x4), and the next three buttons move the visible waterfall \
area in relation to the bandwidth cursor.\
<P>\
The next three buttons move the waterfall left and right, followed by two (either side of a number, the audio frequency in Hz) \
which control the receiving frequency (they move the red cursor lines). \
The next button selects the waterfall speed. NORM or SLOW setting is best unless you have a very fast computer.\
<P>\
You can also adjust the signal level over which the waterfall works. The default range is from 0dB downwards 70dB (i.e. to -70dB). \
Both of these values can be adjusted to suit your sound card and receiver audio level. \
The next four buttons (two on either side of a number, the audio frequency in Hz) control the receiving frequency (they move the red cursor lines).\
<P>\
The <B>M</B> button allows you to store or recall the current frequency (see the <A HREF=\"http://www.w1hkj.com/FldigiHelp/index.html\">Online Documentation</A> for details). The <B>Lk</B> button locks the transmit frequency (fixes the red cursors), and the <B>Rv</B> button turns \
The <B>QSY</B> button moves the signal under the bandwidth cursor to a preset audio frequency (typically, the centre of the transceiver's passband). \
The <B>Store</B> button allows you to store or recall the current frequency and mode. See the \
<A HREF=\"http://www.w1hkj.com/FldigiHelp/OperatingControls.html\">Online Documentation</A> for details on these functions.\
<P>\
The <B>Lk</B> button locks the transmit frequency (fixes the red cursors), and the <B>Rv</B> button turns \
the signal decoding upside down (some modes are sideband sensitive, and if they are the wrong way up, can't be received \
correctly). Remember to turn this one off when you're done, or you won't receive anything! If every signal you hear is upside \
down, check your transceiver sideband setting. \
@ -370,13 +378,13 @@ losing whatever is in the buffer (what you have typed in the Transmit pane), or
<P>\
There are two further controls in the bottom right corner of the program, to the right of the Status line: \
</BLOCKQUOTE>\
<DL><DT><B>Afc</B> - The AFC control</DT>\
<DL><DT><B>AFC</B> - The AFC control</DT>\
<DD>When this button is pressed, an indicator on the button turns yellow, and the program will automatically retune to drifting signals. \
When the button is again pressed, AFC is off, and the tuning will stay where you leave it.</DD> \
<DT><B>Sql</B> - The Squelch control</DT> \
<DT><B>SQL</B> - The Squelch control</DT> \
<DD>When off (no coloured indicator on the button, the receiver displays all 'text' received, even if there is no signal present, \
and the receiver is simply attempting to decode noise. When activated by pressing the button, the indicator turns yellow. \
If the incoming signal strength exceeds that set by the adjacent slider control (above the <B>Sql</B> button), the indicator \
If the incoming signal strength exceeds that set by the adjacent slider control (above the <B>SQL</B> button), the indicator \
turns green and the incoming signal is decoded and printed. The signal strength is indicated on the green bar beside the \
Squelch level slider. If nothing seems to be printing, the first thing to do is check the Squelch!</DD> \
</DL>\

Wyświetl plik

@ -78,6 +78,7 @@ void dominoex::rx_init()
syncfilter->reset();
Mu_datashreg = 1;
set_AFCind(0.0);
}
void dominoex::reset_filters()
@ -488,7 +489,7 @@ void dominoex::eval_s2n()
}
noise /= (paths * numbins - 1);
s2n = decayavg( s2n, sig / noise, 8);
s2n = decayavg( s2n, sig / noise, 32);
metric = 3*(20*log10(s2n) - 9.0);

Wyświetl plik

@ -66,6 +66,7 @@ void feld::rx_init()
peakhold = 0.0;
minhold = 1.0;
agc = 0.0;
set_AFCind(0.0);
return;
}

Wyświetl plik

@ -27,10 +27,13 @@
#include <iosfwd>
#include <iomanip>
#include <sstream>
#include <string>
#include "globals.h"
#include "modem.h"
using namespace std;
const char *state_names[] = {
"PAUSED",
"RECEIVE",
@ -61,7 +64,10 @@ const struct mode_info_t mode_info[NUM_MODES] = {
{ MODE_HELL80, &feld_80modem, "HELL80", "Hell 80", "", "HELL80" },
{ MODE_MFSK8, &mfsk8_modem, "MFSK-8", "MFSK-8", "MFSK8", "MFSK8" },
{ MODE_MFSK11, &mfsk11_modem, "MFSK-11", "MFSK-11", "MFSK11", "MFSK11" },
{ MODE_MFSK16, &mfsk16_modem, "MFSK16", "MFSK-16", "MFSK16", "MFSK16" },
{ MODE_MFSK22, &mfsk22_modem, "MFSK-22", "MFSK-22", "MFSK22", "MFSK22" },
{ MODE_MFSK32, &mfsk32_modem, "MFSK-32", "MFSK-32", "MFSK32", "MFSK32" },
{ MODE_MT63_500, &mt63_500_modem, "MT63-500", "MT63-500", "MT63-500", "MT63" },
{ MODE_MT63_1000, &mt63_1000_modem, "MT63-1XX", "MT63-1000", "MT63-1XX", "MT63" },

Wyświetl plik

@ -25,169 +25,13 @@
#ifndef FTextView_H_
#define FTextView_H_
#include <iostream>
#include <fstream>
#include <string>
#include "threads.h"
/* fltk includes */
#include <FL/Fl.H>
#include <FL/Enumerations.H>
#include <FL/Fl_Menu_Button.H>
#include <FL/Fl_Menu_Item.H>
#include <FL/Fl_Tile.H>
/* Modifier includes */
#include "Fl_Text_Display_mod.H"
#include "Fl_Text_Editor_mod.H"
using namespace std;
// this interface is implemented by both rx,tx widgets
class ReceiveWidget : public Fl_Text_Editor_mod
{
public:
enum TEXT_ATTR { RECV, XMIT, CTRL, SKIP, ALTR, NATTR };
ReceiveWidget(int x, int y, int w, int h, const char *label)
: Fl_Text_Editor_mod(x, y, w, h, label) { }
virtual ~ReceiveWidget() { }
virtual void add(const char *text, int attr = RECV) = 0;
virtual void add(unsigned char c, int attr = RECV) = 0;
void addstr(const char *text, int attr = RECV) { add(text, attr); }
void addchr(unsigned char c, int attr = RECV) { add(c, attr); }
virtual void clear(void) = 0;
virtual void setFont(Fl_Font fnt) = 0;
virtual void setFontSize(int siz) = 0;
virtual void setFontColor(Fl_Color clr) = 0;
virtual void adjust_colours(void) = 0;
virtual void Show(void) = 0;
virtual void Hide(void) = 0;
};
// this is only implemented by the tx widget
class TransmitWidget : virtual public ReceiveWidget
{
public:
TransmitWidget(int x, int y, int w, int h, const char *label)
: ReceiveWidget(x, y, w, h, label) { }
virtual ~TransmitWidget() { }
virtual void clear_sent(void) = 0;
virtual int nextChar(void) = 0;
};
class textview : virtual public ReceiveWidget
{
friend void processinput(void *);
public:
enum CURSOR_TYPE {CARET_CURSOR, NORMAL_CURSOR, HEAVY_CURSOR, DIM_CURSOR, BLOCK_CURSOR, NONE};
protected:
string buff;
string attr;
string inbuff;
string inattr;
string selword;
int nlines;
int wrappos;
int charwidth;
int maxcharwidth;
int charheight;
int descent;
int cursorX;
int cursorY;
int X;
int Y;
int W;
int H;
int xpos;
int ypos;
size_t laststartidx;
size_t endidx;
size_t startidx;
size_t xmtidx;
size_t highlightstart;
size_t highlightend;
int popx;
int popy;
int cursorwidth;
bool cursorON;
bool wordwrap;
bool inprocess;
bool timerstarted;
CURSOR_TYPE cursorStyle;
Fl_Font TextFont;
Fl_Color TextColor[16];
int TextSize;
char cstr[1000];
bool adjusted_colours;
public:
textview( int x, int y, int w, int h, const char *label = 0 );
virtual ~textview() = 0;
virtual int handle(int event);
virtual void resize( int x, int y, int w, int h );
void draw_cursor();
void draw();
void drawall();
void drawchars();
void drawmodify(size_t modidx);
void drawbs();
void Show();
void Hide();
virtual void add( const char *text, int attr = RECV );
virtual void add( unsigned char c, int attr = RECV);
virtual void clear();
virtual void setFont(Fl_Font fnt);
virtual void setFontSize(int siz);
virtual void setFontColor(Fl_Color clr);
inline void setTextStyle(int n, Fl_Color c )
{ if (n < 0 || n > 15) return;
TextColor[n] = c;
}
protected:
Fl_Scrollbar scrollbar;
Fl_Menu_Button *mpopup;
void add_( unsigned char c, int attr );
void scrollbarCB();
inline static void _scrollbarCB( Fl_Widget* w, void* arg )
{
((textview*)arg)->scrollbarCB();
}
int lineCount();
size_t linePosition(int linenbr);
void _backspace();
void setScrollbar();
void rebuildsoft(int w);
size_t xy2bufidx();
string findtext();
void highlightword();
void highlight(bool b);
void adjust_colours(void);
struct modify_range {
size_t start, end;
modify_range() : start(0), end(0) { }
} draw_mod_range;
};
///
/// The text widgets base class.
/// This class implements a basic text editing widget based on Fl_Text_Editor_mod.
@ -330,9 +174,8 @@ protected:
int txpos;
static int *ptxpos;
int bkspaces;
char ascii_cnt;
unsigned ascii_chr;
char ascii_cnt;
unsigned ascii_chr;
};

Wyświetl plik

@ -0,0 +1,60 @@
//
// afcind.h
//
// AFC indicator widget routines.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
// License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Library General Public License for more details.
//
// You should have received a copy of the GNU Library General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
// USA.
//
#ifndef _AFCind_H_
# define _AFCind_H_
//
// Include necessary headers.
//
#include <FL/Fl_Widget.H>
//
// AFCind class...
//
class AFCind : public Fl_Widget
{
public:
enum PTYPE {HORIZONTAL, VERTICAL};
private:
double value_, range_;
PTYPE direction;
protected:
virtual void draw();
public:
AFCind(int x, int y, int w, int h, const char *l = 0);
void type(PTYPE direc) { direction = direc;}
void range(double v) { range_ = v; redraw(); }
double range() const { return (range_); }
void value(double v) { value_ = v; redraw(); }
};
#endif // !_AFCind_H_

Wyświetl plik

@ -128,6 +128,8 @@ extern void clear_StatusMessages();
extern void put_MODEstatus(trx_mode mode);
extern void put_Status1(const char *msg, double timeout = 0.0, status_timeout action = STATUS_CLEAR);
extern void put_Status2(const char *msg, double timeout = 0.0, status_timeout action = STATUS_CLEAR);
extern void set_AFCind( double val );
extern void set_AFCrange(double val);
extern void put_WARNstatus(double);

Wyświetl plik

@ -106,4 +106,7 @@ extern int WNOM;
#define Wstatus (WNOM - Wmode - Ws2n - Wimd - bwAfcOnOff - bwSqlOnOff - Wwarn)
#define SCOPEWIN_MIN_WIDTH 48
#define SCOPEWIN_MIN_HEIGHT 48
#endif // FLDIGI_CONFIG_H

Wyświetl plik

@ -67,7 +67,10 @@ enum {
MODE_HELL80,
MODE_MFSK8,
MODE_MFSK11,
MODE_MFSK16,
MODE_MFSK22,
MODE_MFSK32,
MODE_MT63_500,
MODE_MT63_1000,

Wyświetl plik

@ -156,8 +156,11 @@ protected:
double s2n;
double sig;
double noise;
double currfreq;
int synccounter;
int AFC_COUNT;
unsigned char symbolpair[2];
int symcounter;

Wyświetl plik

@ -173,7 +173,10 @@ public:
extern modem *cw_modem;
extern modem *mfsk8_modem;
extern modem *mfsk11_modem;
extern modem *mfsk16_modem;
extern modem *mfsk22_modem;
extern modem *mfsk32_modem;
extern modem *mt63_500_modem;
extern modem *mt63_1000_modem;
extern modem *mt63_2000_modem;

Wyświetl plik

@ -112,6 +112,7 @@ protected:
double sig;
double noise;
double s2n;
double avgsig;
int synccounter;

Wyświetl plik

@ -31,6 +31,8 @@
#include "mfsk.h"
#include "modem.h"
#include "afcind.h"
#include "configuration.h"
#include "status.h"
#include "trx.h"
@ -41,7 +43,7 @@
#include "qrunner.h"
#define AFC_COUNT 16
//#define AFC_COUNT 16
//32
using namespace std;
@ -76,6 +78,7 @@ void mfsk::rx_init()
memset(picheader, ' ', PICHEADER - 1);
picheader[PICHEADER -1] = 0;
put_MODEstatus(mode);
set_AFCrange(tonespacing / 10.0);
}
void mfsk::init()
@ -114,20 +117,46 @@ mfsk::mfsk(trx_mode mfsk_mode) : modem()
switch (mode) {
case MODE_MFSK8:
samplerate = 8000;
symlen = 1024;
symbits = 5;
basetone = 128; /* 1000 Hz */
AFC_COUNT = 16;
break;
case MODE_MFSK16:
default:
samplerate = 8000;
symlen = 512;
symbits = 4;
basetone = 64; /* 1000 Hz */
AFC_COUNT = 16;
break;
case MODE_MFSK32:
samplerate = 8000;
symlen = 256;
symbits = 4;
AFC_COUNT = 32;
break;
case MODE_MFSK11:
samplerate = 11025;
symlen = 1024;
symbits = 4;
AFC_COUNT = 16;
break;
case MODE_MFSK22:
samplerate = 11025;
symlen = 512;
symbits = 4;
AFC_COUNT = 32;
break;
default:
samplerate = 8000;
symlen = 512;
symbits = 4;
AFC_COUNT = 32;
break;
}
numtones = 1 << symbits;
tonespacing = (double) MFSKSampleRate / symlen;
tonespacing = (double) samplerate / symlen;
basetone = (int)floor(1000.0 * symlen / samplerate + 0.5);
binsfft = new sfft (symlen, basetone, basetone + numtones + 3);
hbfilt = new C_FIR_filter();
@ -156,15 +185,14 @@ mfsk::mfsk(trx_mode mfsk_mode) : modem()
bw = (numtones - 1) * tonespacing;
cf = 1000.0 + bw / 2.0;
flo = (cf - bw/2 - 2 * tonespacing) / MFSKSampleRate;
fhi = (cf + bw/2 + 2 * tonespacing) / MFSKSampleRate;
flo = (cf - bw/2 - 2 * tonespacing) / samplerate;
fhi = (cf + bw/2 + 2 * tonespacing) / samplerate;
bpfilt = new C_FIR_filter();
bpfilt->init_bandpass (127, 1, flo, fhi);
scopedata.alloc(symlen * 2);
samplerate = MFSKSampleRate;
fragmentsize = symlen;
bandwidth = (numtones - 1) * tonespacing;
@ -400,9 +428,9 @@ void mfsk::softdecode(complex *bins)
sum += tone;
}
// shift to range 0...260
// shift to range 0...260 ??? symbols are unsigned char
for (i = 0; i < symbits; i++)
symbols[i] = (unsigned char)clamp(128.0 + (b[i] / sum * 128.0), 0, 260);
symbols[i] = (unsigned char)clamp(128.0 + (b[i] / sum * 128.0), 0, 255);// 260);
rxinlv->symbols(symbols);
@ -462,7 +490,7 @@ void mfsk::update_syncscope()
set_scope(scopedata, SCOPESIZE);
scopedata.next(); // change buffers
snprintf(mfskmsg, sizeof(mfskmsg), "s/n %3.0f dB", 20.0 * log10(s2n) - 9.0 );
snprintf(mfskmsg, sizeof(mfskmsg), "s/n %3.0f dB", 20.0 * log10(s2n));
put_Status1(mfskmsg);
}
@ -504,32 +532,35 @@ void mfsk::afc()
{
complex z;
complex prevvector;
double f;
double f, f1, f2;
double ts = tonespacing / 8;
if (sigsearch) {
reset_afc();
sigsearch = 0;
}
if (prev1symbol != currsymbol)
return;
if (pipeptr == 0) {
prevvector = pipe[2*symlen - 1].vector[currsymbol];
} else {
prevvector = pipe[pipeptr - 1].vector[currsymbol];
}
z = prevvector % currvector;
f = z.arg() * samplerate / twopi;
f -= (1000 + tonespacing * currsymbol);
if (progStatus.afconoff && (metric > progStatus.sldrSquelchValue || progStatus.sqlonoff == false)) {
if (fabs(f) <= tonespacing / 2.0) {
freqerr = afcfilt->run(f / numtones);
set_freq(frequency + freqerr);
}
}
if (pipeptr == 0)
prevvector = pipe[2*symlen - 1].vector[currsymbol];
else
prevvector = pipe[pipeptr - 1].vector[currsymbol];
z = prevvector % currvector;
f = z.arg() * samplerate / twopi;
f1 = 1000 + tonespacing * currsymbol - f;
f1 /= numtones;
f2 = CLAMP ( f1, freqerr - ts, freqerr + ts);
freqerr = decayavg ( freqerr, f2, 64 );
set_freq(frequency - freqerr);
set_AFCind( freqerr );
} else set_AFCind(0.0);
}
void mfsk::eval_s2n()
@ -540,9 +571,9 @@ void mfsk::eval_s2n()
if (i != currsymbol)
noise += pipe[pipeptr].vector[i].mag();
}
noise /= (numtones - 1);
// noise /= (numtones - 1);
if (noise > 0)
s2n = decayavg ( s2n, sig / noise, 16 );
s2n = decayavg ( s2n, sig / noise, 64 );
}
int mfsk::rx_process(const double *buf, int len)
@ -609,6 +640,7 @@ int mfsk::rx_process(const double *buf, int len)
pipe[pipeptr].vector[i] = bins[i];
if (--synccounter <= 0) {
synccounter = symlen;
currsymbol = harddecode(bins);

Wyświetl plik

@ -51,6 +51,7 @@ void mt63::rx_init()
set_freq(500.0 + bandwidth / 2.0);
InpLevel->Preset(64.0, 0.75);
escape = 0;
set_AFCind(0.0);
}
double peak = 0.0;

Wyświetl plik

@ -135,6 +135,7 @@ void olivia::rx_init()
{
Rx->Reset();
escape = 0;
set_AFCind(0.0);
}
int olivia::unescape(int c)

Wyświetl plik

@ -86,6 +86,7 @@ void psk::rx_init()
put_MODEstatus(mode);
resetSN_IMD();
imdValid = false;
set_AFCrange(1.0);
}
void psk::restart()
@ -371,7 +372,8 @@ void psk::phaseafc()
freqerr = decayavg( freqerr, error, AFCDECAYSLOW);
frequency -= freqerr;
set_freq (frequency);
}
set_AFCind(freqerr);
} else set_AFCind(0.0);
if (acquire) acquire--;
}

Wyświetl plik

@ -70,8 +70,11 @@ RSIDs cRsId::rsid_ids[] = {
{ 55, NUM_MODES }, // CONTESTIA-4-250
{ 56, NUM_MODES }, // VOICE
{ 57, MODE_MFSK16 }, // MFSK16
{ 60, MODE_MFSK8 }, // MFSK8
{ 57, MODE_MFSK16 }, // MFSK16
{ 147, MODE_MFSK32 }, // MFSK32
{ 148, MODE_MFSK11 }, // MFSK11
{ 152, MODE_MFSK22 }, // MFSK22
{ 61, NUM_MODES }, // RTTYM-8-250
{ 62, NUM_MODES }, // RTTYM-16-500

Wyświetl plik

@ -374,7 +374,7 @@ int SoundOSS::Open(int md, int freq)
catch (...) {
throw;
}
return device_fd;
return 0;
}
void SoundOSS::Close(unsigned dir)
@ -790,6 +790,7 @@ int SoundPort::Open(int mode, int freq)
req_sample_rate = sample_frequency = freq;
// do we need to (re)initialise the streams?
int ret = 0;
int sr[2] = { progdefaults.in_sample_rate, progdefaults.out_sample_rate };
for (size_t i = 0; i < 2; i++) {
if ( !(stream_active(i) && (Pa_GetHostApiInfo((*sd[i].idev)->hostApi)->type == paJACK ||
@ -808,6 +809,7 @@ int SoundPort::Open(int mode, int freq)
}
start_stream(i);
ret = 1;
}
else {
pause_stream(i);
@ -816,7 +818,7 @@ int SoundPort::Open(int mode, int freq)
}
}
return 0;
return ret;
}
static int sem_timedwaitr(sem_t* sem, double rel_timeout)

Wyświetl plik

@ -343,7 +343,7 @@ void sound_update(unsigned idx)
Fl_Menu_* menus[2] = { menuInSampleRate, menuOutSampleRate };
for (size_t i = 0; i < 2; i++) {
char* label = strdup(menus[i]->text());
const vector<double>& srates = SoundPort::get_supported_rates(scDevice[0], i);
const vector<double>& srates = SoundPort::get_supported_rates(scDevice[i], i);
switch (srates.size()) {
case 0: // startup; no devices initialised yet

Wyświetl plik

@ -64,12 +64,14 @@ void thor::rx_init()
counter = 0;
phase[0] = 0.0;
currmag = prev1mag = prev2mag = 0.0;
avgsig = 1e-20;
for (int i = 0; i < THORMAXFFTS; i++)
phase[i+1] = 0.0;
put_MODEstatus(mode);
put_sec_char(0);
syncfilter->reset();
datashreg = 1;
set_AFCind(0.0);
}
void thor::reset_filters()
@ -311,7 +313,7 @@ void thor::decodePairs(unsigned char symbol)
void thor::decodesymbol()
{
int c;
double fdiff, avg, softmag;
double fdiff, softmag;
unsigned char symbols[4];
// Decode the IFK+ sequence, which results in a single nibble
@ -320,23 +322,26 @@ void thor::decodesymbol()
if (reverse) fdiff = -fdiff;
fdiff /= paths;
fdiff /= doublespaced;
c = (int)floor(fdiff + .5) - 2;
if (c < 0) c += THORNUMTONES;
if (avgsig < 1e-20) avgsig = 1e-20;
avgsig = decayavg( avgsig, currmag, 16);
softmag = clamp(255.0 * currmag / avgsig, 0.0, 255.0);
avg = (currmag + prev1mag + prev2mag) / 3.0;
if (avg == 0.0) avg = 1e-20;
softmag = currmag / avg;
for (int i = 0; i < 4; i++) {
// hard symbol decode
if (progdefaults.THOR_SOFT == false) {
if ((c & 1) == 1) symbols[3-i] = 255;
else symbols[3-i] = 1;
// soft symbol decode
} else
symbols[3-i] = (unsigned char)clamp(256.0 * (c & 1) * softmag, 1, 255);
c = c / 2;
if (progdefaults.THOR_SOFT == false) {
symbols[3] = (c & 1) == 1 ? 255 : 0; c /= 2;
symbols[2] = (c & 1) == 1 ? 255 : 0; c /= 2;
symbols[1] = (c & 1) == 1 ? 255 : 0; c /= 2;
symbols[0] = (c & 1) == 1 ? 255 : 0; c /= 2;
} else {
symbols[3] = (c & 1) == 1 ? softmag : 0; c /= 2;
symbols[2] = (c & 1) == 1 ? softmag : 0; c /= 2;
symbols[1] = (c & 1) == 1 ? softmag : 0; c /= 2;
symbols[0] = (c & 1) == 1 ? softmag : 0; c /= 2;
}
Rxinlv->symbols(symbols);
@ -437,13 +442,13 @@ void thor::eval_s2n()
noise /= (paths * numbins - 1);
if (noise)
s2n = decayavg( s2n, sig / noise, 8);
s2n = decayavg( s2n, sig / noise, 32);
metric = 3*(20*log10(s2n) - 9.0);
metric = 3.0 * (20*log10(s2n) - 9.0);
display_metric(metric);
snprintf(thormsg, sizeof(thormsg), "s/n %3.0f dB", metric / 3.0 - 2.0);
snprintf(thormsg, sizeof(thormsg), "s/n %3.0f dB", metric / 3.0);
put_Status1(thormsg);
}
}

Wyświetl plik

@ -57,6 +57,7 @@ void throb::rx_init()
shift = 0;
lastchar = '\0';
put_MODEstatus(mode);
set_AFCind(0.0);
}
void throb::init()

Wyświetl plik

@ -15,7 +15,10 @@
modem *cw_modem = 0;
modem *mfsk8_modem = 0;
modem *mfsk11_modem = 0;
modem *mfsk16_modem = 0;
modem *mfsk22_modem = 0;
modem *mfsk32_modem = 0;
modem *mt63_500_modem = 0;
modem *mt63_1000_modem = 0;
modem *mt63_2000_modem = 0;
@ -99,7 +102,7 @@ void modem::init()
void modem::set_freq(double freq)
{
frequency = freq;
freqerr = 0.0;
// freqerr = 0.0;
if (freqlock == false)
tx_frequency = frequency;
REQ(put_freq, frequency);

Wyświetl plik

@ -99,8 +99,8 @@ void trx_trx_receive_loop()
if (active_modem) {
try {
current_samplerate = active_modem->get_samplerate();
scard->Open(O_RDONLY, current_samplerate);
REQ_SYNC(sound_update, progdefaults.btnAudioIOis);
if (scard->Open(O_RDONLY, current_samplerate))
REQ(sound_update, progdefaults.btnAudioIOis);
}
catch (const SndException& e) {
put_status(e.what(), 5);
@ -247,7 +247,7 @@ void trx_trx_transmit_loop()
MilliSleep(10);
push2talk->set(false);
REQ_SYNC(&waterfall::set_XmtRcvBtn, wf, false);
REQ(&waterfall::set_XmtRcvBtn, wf, false);
if (progdefaults.useTimer == true) {
trx_start_macro_timer();
@ -279,7 +279,7 @@ void trx_tune_loop()
try {
while (trx_state == STATE_TUNE) {
if (_trx_tune == 0) {
REQ_SYNC(&waterfall::set_XmtRcvBtn, wf, true);
REQ(&waterfall::set_XmtRcvBtn, wf, true);
xmttune::keydown(active_modem->get_txfreq_woffset(), scard);
_trx_tune = 1;
} else
@ -301,7 +301,7 @@ void trx_tune_loop()
MilliSleep(10);
push2talk->set(false);
REQ_SYNC(&waterfall::set_XmtRcvBtn, wf, false);
REQ(&waterfall::set_XmtRcvBtn, wf, false);
}
//=============================================================================

Wyświetl plik

@ -30,6 +30,7 @@
#include <sstream>
#include <vector>
#include <algorithm>
#include "waterfall.h"
#include "threads.h"
#include "main.h"
@ -1022,9 +1023,9 @@ void xmtlock_cb(Fl_Widget *w, void *vi)
void waterfall::set_XmtRcvBtn(bool val)
{
FL_LOCK();
FL_LOCK_D();
xmtrcv->value(val);
FL_UNLOCK();
FL_UNLOCK_D();
}
void mode_cb(Fl_Widget *w, void *v) {
@ -1148,8 +1149,12 @@ void btnMem_cb(Fl_Widget *, void *menu_event)
m.rfcarrier = wf->rfcarrier();
m.carrier = active_modem->get_freq();
m.mode = active_modem->get_mode();
if (op == APPEND)
qrg_list.push_back(m);
if (op == APPEND) {
if (find(qrg_list.begin(), qrg_list.end(), m) == qrg_list.end())
qrg_list.push_back(m);
else
break;
}
else
qrg_list[elem] = m;
@ -1176,7 +1181,6 @@ void btnMem_cb(Fl_Widget *, void *menu_event)
wf->mbtnMem->add(o.str().c_str());
else
wf->mbtnMem->replace(elem, o.str().c_str());
}
break;
}
@ -1501,7 +1505,9 @@ int WFdisp::handle(int event)
}
// fall through
case FL_LEFT_MOUSE:
if (event != FL_DRAG && Fl::event_state() & FL_CTRL) {
if (Fl::event_state() & FL_CTRL) {
if (event == FL_DRAG)
break;
bHistory = true;
if (eb == FL_LEFT_MOUSE) {
restoreFocus();

Wyświetl plik

@ -527,8 +527,15 @@ void FTextView::menu_cb(int val)
break;
case RX_MENU_DIV:
add("\n <<================>>\n", RECV);
{
time_t t = time(NULL);
struct tm st;
localtime_r(&t, &st);
char s[64];
strftime(s, sizeof(s), "\n<<======= %Y-%m-%d %H:%M:%S %z ========>>\n", &st);
add(s, CTRL);
break;
}
case RX_MENU_CLEAR:
clear();
break;

Wyświetl plik

@ -0,0 +1,104 @@
//
// afcind.cxx
//
// AFC indicator widget routines.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
// License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Library General Public License for more details.
//
// You should have received a copy of the GNU Library General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
// USA.
//
//
// Include necessary header files...
//
#include <config.h>
#include <math.h>
#include <FL/Fl.H>
#include <FL/fl_draw.H>
#include "afcind.h"
//
// afcind is a center bar indicator widget that shows a center mark and
// two colored ratio members that slide to the left (below) or right (above)
// the center mark. Used in place of closing eye type of display for AFC.
// either horizontal or vertical format
//
// if direction == VERTICAL the indicator goes from lower to upper
// if direction == HORIZONTAL the indicator goes from left to right
void AFCind::draw()
{
double dVal;
int AFCval; // Size of AFCind bar...
int bx, by, bw, bh; // Box areas...
int tx, tw; // Temporary X + width
int ty, th; // Temporary Y + height
// Get the box borders...
bx = Fl::box_dx(box());
by = Fl::box_dy(box());
bw = Fl::box_dw(box());
bh = Fl::box_dh(box());
tx = x() + bx;
tw = w() - bw;
ty = y() + by;
th = h() - bh;
dVal = CLAMP( (value_ + range_) / (2.0 * range_), -1.0, 1.0);
AFCval = (int)((direction == HORIZONTAL ? tw : th) * dVal);
// draw the center marker either to the left or above the primary display
if (direction == HORIZONTAL) {
//clear the display && draw the scale
fl_clip (x(), y(), w(), h());
draw_box(box(), x(), y(), w(), h(), FL_BLACK);
fl_rectf(tx + tw / 2 - 1, ty, 2, 6, 238,238,238);
fl_rectf(tx, ty + 7, AFCval - 1, th - 7, 238,232,170);
fl_rectf(tx + AFCval + 1, ty + 7, tw - AFCval - 1, th - 7, 124,205,124);
fl_pop_clip();
} else {
fl_clip (x(), y(), w(), h());
draw_box(box(), x(), y(), w(), h(), FL_BLACK);
fl_rectf(tx, ty + th/2 - 1, 6, 2, 238,238,238);
fl_rectf(tx + 7, ty + th - (AFCval - 1), tw - 7, AFCval - 1, 238,232,170);
fl_rectf(tx + 7, ty, tw - 7, AFCval - 1, 124,205,124);
fl_pop_clip();
}
}
AFCind::AFCind(int X, int Y, int W, int H, const char* l)
: Fl_Widget(X, Y, W, H, l)
{
align(FL_ALIGN_INSIDE);
box(FL_DOWN_BOX);
range(1.0);
value(0.0);
direction = HORIZONTAL;
}
//
// End of "$Id: AFCind.cxx 4288 2005-04-16 00:13:17Z mike $".
//

Wyświetl plik

@ -40,6 +40,7 @@ void anal::rx_init()
{
phaseacc = 0;
put_MODEstatus(mode);
set_AFCrange(1.0);
}
void anal::init()
@ -165,6 +166,7 @@ int anal::rx_process(const double *buf, int len)
// reset the display counter & the pipe pointer
dspcnt = symbollen;
pipeptr = 0;
set_AFCind(fout_2);
}
}
}

Wyświetl plik

@ -54,6 +54,7 @@ void wwv::rx_init()
zoom = false;
set_scope_mode(Digiscope::WWV);
put_MODEstatus(mode);
set_AFCind(0.0);
}
void wwv::init()