Upstream version 1.37exp

pull/2/head
Stelios Bounanos 2007-08-14 02:09:43 +01:00
rodzic 81f00f6652
commit df27a23765
10 zmienionych plików z 1076 dodań i 1281 usunięć

Plik diff jest za duży Load Diff

Wyświetl plik

@ -1,170 +0,0 @@
// This code is part of Fl_Text_Display::resize from fltk 1.1.7, modified
// to not hide the horizontal scrollbar when word wrapping is enabled.
#define TOP_MARGIN 1
#define BOTTOM_MARGIN 1
#define LEFT_MARGIN 3
#define RIGHT_MARGIN 3
#ifdef DEBUG
printf("Fl_Text_Display::resize(X=%d, Y=%d, W=%d, H=%d)\n", X, Y, W, H);
#endif // DEBUG
const int oldWidth = w();
#ifdef DEBUG
printf(" oldWidth=%d, mContinuousWrap=%d, mWrapMargin=%d\n", oldWidth,
mContinuousWrap, mWrapMargin);
#endif // DEBUG
Fl_Widget::resize(X,Y,W,H);
if (!buffer()) return;
X += Fl::box_dx(box());
Y += Fl::box_dy(box());
W -= Fl::box_dw(box());
H -= Fl::box_dh(box());
text_area.x = X+LEFT_MARGIN;
text_area.y = Y+BOTTOM_MARGIN;
text_area.w = W-LEFT_MARGIN-RIGHT_MARGIN;
text_area.h = H-TOP_MARGIN-BOTTOM_MARGIN;
int i;
/* Find the new maximum font height for this text display */
for (i = 0, mMaxsize = fl_height(textfont(), textsize()); i < mNStyles; i++)
mMaxsize = max(mMaxsize, fl_height(mStyleTable[i].font, mStyleTable[i].size));
// did we have scrollbars initially?
int hscrollbarvisible = mHScrollBar->visible();
int vscrollbarvisible = mVScrollBar->visible();
// try without scrollbars first
mVScrollBar->clear_visible();
mHScrollBar->clear_visible();
int again_ = 1;
for (int again = 1; again;) {
again = 0;
/* In continuous wrap mode, a change in width affects the total number of
lines in the buffer, and can leave the top line number incorrect, and
the top character no longer pointing at a valid line start */
if (mContinuousWrap && !mWrapMargin && W!=oldWidth) {
int oldFirstChar = mFirstChar;
mNBufferLines = count_lines(0, buffer()->length(), true);
mFirstChar = line_start(mFirstChar);
mTopLineNum = count_lines(0, mFirstChar, true)+1;
absolute_top_line_number(oldFirstChar);
#ifdef DEBUG
printf(" mNBufferLines=%d\n", mNBufferLines);
#endif // DEBUG
}
/* reallocate and update the line starts array, which may have changed
size and / or contents. */
int nvlines = (text_area.h + mMaxsize - 1) / mMaxsize;
if (nvlines < 1) nvlines = 1;
if (mNVisibleLines != nvlines) {
mNVisibleLines = nvlines;
if (mLineStarts) delete[] mLineStarts;
mLineStarts = new int [mNVisibleLines];
}
calc_line_starts(0, mNVisibleLines);
calc_last_char();
// figure the scrollbars
if (scrollbar_width()) {
/* Decide if the vertical scroll bar needs to be visible */
if (scrollbar_align() & (FL_ALIGN_LEFT|FL_ALIGN_RIGHT) &&
mNBufferLines >= mNVisibleLines - 1)
{
mVScrollBar->set_visible();
if (scrollbar_align() & FL_ALIGN_LEFT) {
text_area.x = X+scrollbar_width()+LEFT_MARGIN;
text_area.w = W-scrollbar_width()-LEFT_MARGIN-RIGHT_MARGIN;
mVScrollBar->resize(X, text_area.y-TOP_MARGIN, scrollbar_width(),
text_area.h+TOP_MARGIN+BOTTOM_MARGIN);
} else {
text_area.x = X+LEFT_MARGIN;
text_area.w = W-scrollbar_width()-LEFT_MARGIN-RIGHT_MARGIN;
mVScrollBar->resize(X+W-scrollbar_width(), text_area.y-TOP_MARGIN,
scrollbar_width(), text_area.h+TOP_MARGIN+BOTTOM_MARGIN);
}
}
/*
Decide if the horizontal scroll bar needs to be visible. If there
is a vertical scrollbar, a horizontal is always created too. This
is because the alternatives are unatractive:
* Dynamically creating a horizontal scrollbar based on the currently
visible lines is what the original nedit does, but it always wastes
space for the scrollbar even when it's not used. Since the FLTK
widget dynamically allocates the space for the scrollbar and
rearranges the widget to make room for it, this would create a very
visually displeasing "bounce" effect when the vertical scrollbar is
dragged. Trust me, I tried it and it looks really bad.
* The other alternative would be to keep track of what the longest
line in the entire buffer is and base the scrollbar on that. I
didn't do this because I didn't see any easy way to do that using
the nedit code and this could involve a lengthy calculation for
large buffers. If an efficient and non-costly way of doing this
can be found, this might be a way to go.
*/
/* WAS: Suggestion: Try turning the horizontal scrollbar on when
you first see a line that is too wide in the window, but then
don't turn it off (ie mix both of your solutions). */
if (!mContinuousWrap && scrollbar_align() & (FL_ALIGN_TOP|FL_ALIGN_BOTTOM) &&
(mVScrollBar->visible() || longest_vline() > text_area.w))
{
if (!mHScrollBar->visible()) {
mHScrollBar->set_visible();
again = 1; // loop again to see if we now need vert. & recalc sizes
}
if (scrollbar_align() & FL_ALIGN_TOP) {
text_area.y = Y + scrollbar_width()+TOP_MARGIN;
text_area.h = H - scrollbar_width()-TOP_MARGIN-BOTTOM_MARGIN;
mHScrollBar->resize(text_area.x-LEFT_MARGIN, Y,
text_area.w+LEFT_MARGIN+RIGHT_MARGIN, scrollbar_width());
} else {
text_area.y = Y+TOP_MARGIN;
text_area.h = H - scrollbar_width()-TOP_MARGIN-BOTTOM_MARGIN;
mHScrollBar->resize(text_area.x-LEFT_MARGIN, Y+H-scrollbar_width(),
text_area.w+LEFT_MARGIN+RIGHT_MARGIN, scrollbar_width());
}
} else if (again_ == 1) { // loop once more
again_ = 0;
again = 1;
}
}
}
// user request to change viewport
if (mTopLineNumHint != mTopLineNum || mHorizOffsetHint != mHorizOffset)
scroll_(mTopLineNumHint, mHorizOffsetHint);
// everything will fit in the viewport
if (mNBufferLines < mNVisibleLines || mBuffer == NULL || mBuffer->length() == 0)
scroll_(1, mHorizOffset);
/* if empty lines become visible, there may be an opportunity to
display more text by scrolling down */
else while (mLineStarts[mNVisibleLines-2] == -1)
scroll_(mTopLineNum-1, mHorizOffset);
// user request to display insert position
if (display_insert_position_hint)
display_insert();
// in case horizontal offset is now greater than longest line
int maxhoffset = max(0, longest_vline()-text_area.w);
if (mHorizOffset > maxhoffset)
scroll_(mTopLineNumHint, maxhoffset);
mTopLineNumHint = mTopLineNum;
mHorizOffsetHint = mHorizOffset;
display_insert_position_hint = 0;
if (mContinuousWrap ||
hscrollbarvisible != mHScrollBar->visible() ||
vscrollbarvisible != mVScrollBar->visible())
redraw();
update_v_scrollbar();
update_h_scrollbar();

Wyświetl plik

@ -62,7 +62,6 @@
#include "globals.h"
#include "misc.h"
//#include "help.h"
#include "TextView.h"
#include "Config.h"
#include "configuration.h"
@ -146,10 +145,10 @@ void startup_modem(modem *m)
if (m == feld_modem ||
m == feld_FMmodem ||
m == feld_FM105modem ) {
ReceiveText->hide();
ReceiveText->Hide();
FHdisp->show();
} else {
ReceiveText->show();
ReceiveText->Show();
FHdisp->hide();
}
Fl::unlock();
@ -1067,6 +1066,15 @@ void activate_rig_menu_item(bool b)
mnu->redraw();
}
void activate_test_menu_item(bool b)
{
if (b)
menu_[60].show();
else
menu_[60].hide();
mnu->redraw();
}
void create_fl_digi_main() {
int Y = 0;
fl_digi_main = new Fl_Double_Window(WNOM, HNOM, "fldigi");
@ -1139,6 +1147,7 @@ void create_fl_digi_main() {
int sw = 15;
Fl_Group *MixerFrame = new Fl_Group(0,Y,sw, Hrcvtxt + Hxmttxt);
// valRcvMixer = new Fl_Slider(0, Y, sw, (Hrcvtxt + Hxmttxt)/2 - 15, "R");
valRcvMixer = new Fl_Slider(0, Y, sw, (Htext)/2, "");
valRcvMixer->type(FL_VERT_NICE_SLIDER);
valRcvMixer->color(fl_rgb_color(0,110,30));
@ -1146,6 +1155,7 @@ void create_fl_digi_main() {
valRcvMixer->selection_color(fl_rgb_color(255,255,0));
valRcvMixer->range(1.0,0.0);
valRcvMixer->callback( (Fl_Callback *)cb_RcvMixer);
// valXmtMixer = new Fl_Slider(0, Y + (Hrcvtxt + Hxmttxt)/2, sw, (Hrcvtxt + Hxmttxt)/2 - 15, "T");
valXmtMixer = new Fl_Slider(0, Y + (Htext)/2, sw, (Htext)/2, "");
valXmtMixer->type(FL_VERT_NICE_SLIDER);
valXmtMixer->color(fl_rgb_color(110,0,30));
@ -1341,29 +1351,24 @@ void set_video(double *data, int len)
void put_rx_char(unsigned int data)
{
static unsigned int last = 0;
static bool nulinepending = false;
const char **asc = ascii;
rxmsgid = msgget( (key_t) 9876, 0666);
if (mailclient || mailserver || rxmsgid != -1)
asc = ascii2;
switch (data) {
case '\n':
if (last == '\r')
break;
// or fall through to insert \n
case '\r':
ReceiveText->add('\n', TextBase::RCV);
break;
default:
if (asc == ascii2 && iscntrl(data & 0x7F))
ReceiveText->add(data & 0x7F, TextBase::CTRL);
else
ReceiveText->add(asc[data & 0x7F], TextBase::RCV);
if (data == '\r') {
ReceiveText->add(asc['\n' & 0x7F],1);
nulinepending = true;
} else if (nulinepending && data == '\r') {
ReceiveText->add(asc['\n' & 0x7F],1);
} else if (nulinepending && data == '\n') {
nulinepending = false;
} else if (nulinepending && data != '\n') {
ReceiveText->add(asc[data & 0x7F], 1);
nulinepending = false;
} else {
ReceiveText->add(asc[data & 0x7F],1);
}
last = data;
if ( rxmsgid != -1) {
rxmsgst.msg_type = 1;
rxmsgst.c = data & 0x7F;
@ -1372,6 +1377,7 @@ void put_rx_char(unsigned int data)
if (Maillogfile)
Maillogfile->log_to_file(cLogfile::LOG_RX, asc[data & 0x7F]);
if (logging)
logfile->log_to_file(cLogfile::LOG_RX, asc[data & 0x7F]);
}
@ -1511,20 +1517,17 @@ char get_tx_char(void)
void put_echo_char(unsigned int data)
{
static unsigned int last = 0;
static bool nulinepending = false;
const char **asc = ascii;
if (mailclient || mailserver || arqmode)
asc = ascii2;
if (data == '\r' && last == '\r') // reject multiple CRs
if (data == '\r' && nulinepending) // reject multiple CRs
return;
if (asc == ascii2 && iscntrl(data & 0x7F))
ReceiveText->add(data & 0x7F, TextBase::CTRL);
else
ReceiveText->add(asc[data & 0x7F], TextBase::XMT);
last = data;
if (data == '\r') nulinepending = true;
if (nulinepending && data == '\n') {
nulinepending = false;
}
ReceiveText->add(asc[data & 0x7F],4);
if (Maillogfile)
Maillogfile->log_to_file(cLogfile::LOG_TX, asc[data & 0x7F]);
if (logging)

Wyświetl plik

@ -5,9 +5,6 @@
// Copyright (C) 2006
// Dave Freese, W1HKJ
//
// Copyright (C) 2007
// Stelios Bounanos, 2E0DLX
//
// This file is part of fldigi.
//
// fldigi is free software; you can redistribute it and/or modify
@ -17,180 +14,154 @@
//
// fldigi 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
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with fldigi; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// ----------------------------------------------------------------------------
#ifndef _TextView_H
#define _TextView_H
#include "threads.h"
#include <stdlib.h>
#include <stdio.h>
#include <iostream>
#include <fstream>
#include <string>
/* fltk includes */
#include <FL/Fl.H>
#include <FL/fl_draw.H>
#include <FL/Fl_Widget.H>
#include <FL/Fl_Scrollbar.H>
#include <FL/Enumerations.H>
#include <FL/Fl_Menu_Button.H>
#include <FL/Fl_Menu_Item.H>
#include <FL/Fl_Text_Display.H>
#include <FL/Fl_Text_Editor.H>
using namespace std;
///
/// The text widgets base class.
/// This class implements a basic text editing widget based on Fl_Text_Editor.
///
class TextBase : public Fl_Text_Editor
class textview : public Fl_Widget
{
public:
///
/// Text styles used for highlighting
///
enum text_attr_e {
DEFAULT = 'A', ///< Default text style
RCV, ///< Received text style
XMT, ///< Transmitted text style
SKIP, ///< Skipped text style
CTRL, ///< Control character style
NSTYLES = 5
};
typedef enum text_attr_e text_attr_t;
friend void processinput(void *);
public:
TextBase(int x, int y, int w, int h, const char *l = 0);
virtual ~TextBase() { delete tbuf; delete sbuf; }
virtual int handle(int event) { return Fl_Text_Editor::handle(event); };
virtual void add(const char *s, text_attr_t attr = DEFAULT) { insert(s); }
void clear(void) { tbuf->text(""); sbuf->text(""); }
void setFont(Fl_Font f, text_attr_t attr = NSTYLES);
void setFontSize(int s, text_attr_t attr = NSTYLES);
void setFontColor(Fl_Color c, text_attr_t attr = NSTYLES);
void cursorON(void) { show_cursor(); }
virtual void resize(int X, int Y, int W, int H);
enum TV_ATTR {RCV, XMT};
enum CURSOR_TYPE {CARET_CURSOR, NORMAL_CURSOR, HEAVY_CURSOR, DIM_CURSOR, BLOCK_CURSOR, NONE};
protected:
void set_style(text_attr_t attr, Fl_Font f, int s, Fl_Color c,
int set = SET_FONT | SET_SIZE | SET_COLOR);
void readFile(void);
void saveFile(void);
char *get_word(int x, int y);
void show_context_menu(void);
virtual void menu_cb(int val) { }
int reset_wrap_col(void);
private:
TextBase();
TextBase(const TextBase &t);
protected:
enum set_style_op_e { SET_FONT = 1 << 0, SET_SIZE = 1 << 1, SET_COLOR = 1 << 2 };
enum { RESIZING = 1 << 0 };
Fl_Text_Buffer *tbuf; ///< text buffer
Fl_Text_Buffer *sbuf; ///< style buffer
Fl_Text_Display::Style_Table_Entry styles[NSTYLES];
Fl_Menu_Item *context_menu;
int popx, popy;
bool wrap;
int wrap_col;
int max_lines;
};
///
/// A TextBase subclass to display received & transmitted text
///
class TextView : public TextBase
{
string buff;
string attr;
string inbuff;
string inattr;
int nlines;
int wrappos;
int charwidth;
int maxcharwidth;
int charheight;
int cursorX;
int cursorY;
size_t laststartpos;
size_t lastendpos;
int startidx;
int popx;
int popy;
bool cursorON;
bool wordwrap;
bool inprocess;
bool timerstarted;
CURSOR_TYPE cursorStyle;
Fl_Font TextFont;
Fl_Color TextColor[16];
int TextSize;
public:
TextView(int x, int y, int w, int h, const char *l = 0);
virtual int handle(int event);
virtual void add(char c, text_attr_t attr = DEFAULT);
virtual void add(const char *s, text_attr_t attr = DEFAULT);
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 drawbs();
void Show();
void Hide();
virtual void add( char *text, int attr = 1 );
virtual void add( char c, int attr = 1);
virtual void clear();
virtual string findtext();
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:
enum { RX_MENU_QRZ_THIS, RX_MENU_CALL, RX_MENU_NAME, RX_MENU_QTH,
RX_MENU_LOC, RX_MENU_RST_IN, RX_MENU_DIV, RX_MENU_CLEAR,
RX_MENU_COPY, RX_MENU_SAVE, RX_MENU_WRAP };
Fl_Scrollbar *scrollbar;
Fl_Menu_Button *mpopup;
virtual void menu_cb(int val);
static void changed_cb(int pos, int nins, int ndel, int nsty,
const char *dtext, void *arg);
void change_keybindings(void);
void scrollbarCB();
inline static void _scrollbarCB( Fl_Widget* w, void* arg )
{
((textview*)arg)->scrollbarCB();
}
int lineCount();
size_t linePosition(int linenbr);
private:
TextView();
TextView(const TextView &t);
protected:
static Fl_Menu_Item view_menu[];
void _backspace();
void setScrollbar();
void rebuildsoft(int w);
};
///
/// A TextBase subclass to display and edit text to be transmitted
///
class TextEdit : public TextBase
{
class TextView : public textview {
public:
TextEdit(int x, int y, int w, int h, const char *l = 0);
virtual int handle(int event);
virtual void add(const char *s, text_attr_t attr = DEFAULT);
virtual void add(char c, text_attr_t attr = DEFAULT);
void clear(void);
int nextChar(void);
TextView( int x, int y, int w, int h, const char *label = 0 );
virtual void add( char *text, int attr = 1 ) {textview::add(text, attr);};
virtual void add( const char *text, int attr = 1) {textview::add((char*)text);};
virtual void add( char c, int attr = 1) {textview::add(c, attr);};
virtual void clear() {textview::clear();};
virtual void setFont(Fl_Font fnt) { textview::setFont(fnt); }
virtual void setFontSize(int siz) { textview::setFontSize(siz); }
virtual void setFontColor(Fl_Color clr) { textview::setFontColor(clr); }
protected:
enum { TX_MENU_TX, TX_MENU_RX, TX_MENU_MFSK16_IMG, TX_MENU_CLEAR,
TX_MENU_CUT, TX_MENU_COPY, TX_MENU_PASTE, TX_MENU_READ,
TX_MENU_WRAP
};
int handle_key(int key);
int handle_key_macro(int key);
int handle_key_ascii(int key);
virtual void menu_cb(int val);
static void changed_cb(int pos, int nins, int ndel, int nsty,
const char *dtext, void *arg);
void change_keybindings(void);
static int kf_default(int c, Fl_Text_Editor* e);
static int kf_enter(int c, Fl_Text_Editor* e);
static int kf_delete(int c, Fl_Text_Editor* e);
static int kf_cut(int c, Fl_Text_Editor* e);
static int kf_paste(int c, Fl_Text_Editor* e);
private:
TextEdit();
TextEdit(const TextEdit &t);
protected:
static Fl_Menu_Item edit_menu[];
bool PauseBreak;
int txpos;
static int *ptxpos;
int bkspaces;
static Fl_Menu_Item viewmenu[];
int handle (int event);
void menu_cb(int val);
void saveFile();
};
///
/// A lock class meant to be instantiated on the stack to acquire a lock which
/// is released when the object goes out of scope.
/// The no-arg ctor calls Fl::lock(), and the Fl_Mutex ctor locks that mutex.
///
class autolock
{
class TextEdit : public textview {
public:
autolock() : m(0) { Fl::lock(); }
autolock(Fl_Mutex *m_) : m(m_) { fl_lock(m); }
~autolock() { if (m) fl_unlock(m); else Fl::unlock(); }
TextEdit( int x, int y, int w, int h, const char *label = 0 );
virtual void add( char *text, int attr = 1 ) {textview::add(text);};
virtual void add( const char *text, int attr = 1) {textview::add((char*)text);};
virtual void add( char c, int attr = 1) {textview::add(c);};
virtual void clear();
int nextChar();
void readFile();
virtual void setFont(Fl_Font fnt) { textview::setFont(fnt); }
virtual void setFontSize(int siz) { textview::setFontSize(siz); }
virtual void setFontColor(Fl_Color clr) { textview::setFontColor(clr); }
void cursorON();
protected:
int handle_fnckey(int key);
int handle_key();
int handle (int event);
void menu_cb(int val);
private:
autolock(const autolock &a); // no copying
Fl_Mutex *m;
unsigned int chrptr;
int bkspaces;
bool PauseBreak;
};
#endif

Wyświetl plik

@ -3,8 +3,8 @@
#define FIRLEN 64
extern double fir1c[FIRLEN];
extern double fir2c[FIRLEN];
extern double gmfir1c[FIRLEN];
extern double gmfir2c[FIRLEN];
extern double syncfilt[16];
extern void raisedcosfilt(double *);

Wyświetl plik

@ -1,6 +1,6 @@
#ifndef _VERSION_H
#define _VERSION_H
#define FLDIGI_VERSION "1.36e"
#define FLDIGI_VERSION "1.37-exp"
#endif

Wyświetl plik

@ -249,6 +249,8 @@ private:
void drawgrayWF();
void drawspectrum();
void drawsignal();
friend
void evaluate(void *);
protected:
public:
bool wantcursor;

Wyświetl plik

@ -164,10 +164,14 @@ psk::psk(trx_mode pskmode) : modem()
// raisedcosfilt(fir1c); // creates fir1c
wsincfilt(fir1c, 1.0 / symbollen); // creates fir1c matched sin(x)/x filter
wsincfilt(fir2c, 1.0 / 16.0); // creates fir2c matched sin(x)/x filter
// wsincfilt(fir1c, 1.0 / symbollen); // creates fir1c matched sin(x)/x filter
// wsincfilt(fir2c, 1.0 / 16.0); // creates fir2c matched sin(x)/x filter
// or following uses the original gmfsk matched filters
for (int i = 0; i < 64; i++) {
fir1c[i] = gmfir1c[i];
fir2c[i] = gmfir2c[i];
}
fir1 = new C_FIR_filter();
fir1->init(FIRLEN, symbollen / 16, fir1c, fir1c);
@ -190,7 +194,7 @@ psk::psk(trx_mode pskmode) : modem()
bandwidth = samplerate / symbollen;
wfid = new id(this);
pipeptr = 0;
// pipeptr = 0;
if (mailserver && progdefaults.PSKmailSweetSpot)
sigsearch = 3;
else
@ -330,9 +334,9 @@ void psk::afc()
error -= 2 * M_PI;
error *= ((samplerate / (symbollen * 2 * M_PI)/16));
if (fabs(error) < (bandwidth / 2.0)) {
// freqerr = decayavg( freqerr, error, 4);//32);
// frequency -= freqerr;
frequency -= error;
freqerr = decayavg( freqerr, error, 32);
frequency -= freqerr;
// frequency -= error;
set_freq (frequency);
}
if (mailserver && progdefaults.PSKmailSweetSpot)
@ -379,12 +383,7 @@ void psk::rx_symbol(complex symbol)
else dcd = false;
}
if (squelchon == false)
set_phase(phase, true);
else if (metric > squelch)
set_phase(phase, true);
else
set_phase(M_PI, false);
set_phase(phase, dcd);
if (dcd == true || squelchon == false) {
if (_qpsk)
@ -430,7 +429,7 @@ void psk::update_syncscope()
}
char bitstatus[100];
int psk::rx_process(double *buf, int len)
{
@ -455,28 +454,25 @@ int psk::rx_process(double *buf, int len)
// final filter
fir2->run( z, z ); // fir3 returns value on every sample
// Now the sync correction routine...
// save amplitude value for the sync scope
int idx = (int) bitclk;
double sum = 0.0;
// scope_pipe[pipeptr % PipeLen] = syncbuf[idx] = z.mag();
scope_pipe[pipeptr] = syncbuf[idx] = z.mag();
syncbuf[idx] = 0.8 * syncbuf[idx] + 0.2 * z.mag();
// syncbuf[idx] = z.mag();
for (int i = 0; i < 8; i++)
sum += (syncbuf[i] - syncbuf[i+8]);
bitclk -= sum / 5.0;
bitclk += 1;
if (bitclk < 0) bitclk += 16;
if (bitclk >= 16) {
bitclk -= 16;
if (bitclk < 0) bitclk += 16.0;
if (bitclk >= 16.0) {
bitclk -= 16.0;
rx_symbol(z);
update_syncscope();
if (dcd && afcon)
afc();
}
pipeptr = (pipeptr + 1) % PipeLen;
}
if (!dcd && afcon)
findsignal();

Wyświetl plik

@ -10,12 +10,12 @@
#include <math.h>
/* 64-tap raised-cosine FIR*/
// 64-tap raised-cosine FIR
// implements
// u[n] = (1.0 - cos(2PI * n / 64))/128.0
// used in gmfsk, twpsk etc.
/*
double fir1c[64] = {
double gmfir1c[64] = {
0.000000, //0
0.000038, //1
0.000150, //2
@ -86,7 +86,7 @@ double fir1c[64] = {
// Designed by G3PLX
//
double fir2c[64] = {
double gmfir2c[64] = {
0.000625000,
0.000820912,
0.001374651,
@ -152,9 +152,11 @@ double fir2c[64] = {
0.001374651,
0.000820912
};
*/
// sync filter
// weighting for sync samples
// sum of all weights = 1.0
double syncfilt[16] = {
-0.097545161,

Wyświetl plik

@ -375,11 +375,50 @@ void WFdisp::redrawCursor()
cursormoved = true;
}
bool evaluating = false;
void evaluate(void *who)
{
WFdisp *me = (WFdisp *)who;
if (evaluating) return;
evaluating = true;
static char szFrequency[14];
if (me->mode == me->SCOPE)
me->process_analog(me->circbuff, FFT_LEN * 2);
me->processFFT();
Fl::lock();
if (me->usebands)
me->rfc = (long long)(atof(cboBand->value()) * 1000.0);
if (me->rfc) {
if (me->usb)
me->dfreq = me->rfc + active_modem->get_txfreq();
else
me->dfreq = me->rfc - active_modem->get_txfreq();
sprintf(szFrequency, "%-.3f", me->dfreq / 1000.0);
} else {
me->dfreq = active_modem->get_txfreq();
sprintf(szFrequency, "%-.0f", me->dfreq);
}
inpFreq->value(szFrequency);
inpFreq->redraw();
Fl::unlock();
put_WARNstatus(me->overload);
Fl::awake();
evaluating = false;
}
void WFdisp::sig_data( double *sig, int len ) {
int movedbls = (FFT_LEN * 2) - len; //SCBLOCKSIZE;
int movesize = movedbls * sizeof(double);
double *pcircbuff1 = &circbuff[len];
static char szFrequency[14];
//if sound card sampling rate changed reset the waterfall buffer
if (srate != active_modem->get_samplerate()) {
@ -388,39 +427,14 @@ void WFdisp::sig_data( double *sig, int len ) {
}
else
memmove(circbuff, pcircbuff1, movesize);
overload = false;
int i, j;
for (i = movedbls, j = 0; j < len; i++, j++)
if (fabs(circbuff[i] = sig[j]) > 0.9)
overload = true;
if (mode == SCOPE)
process_analog(circbuff, FFT_LEN * 2);
processFFT();
Fl::lock();
if (usebands)
rfc = (long long)(atof(cboBand->value()) * 1000.0);
if (rfc) {
if (usb)
dfreq = rfc + active_modem->get_txfreq();
else
dfreq = rfc - active_modem->get_txfreq();
sprintf(szFrequency, "%-.3f", dfreq / 1000.0);
} else {
dfreq = active_modem->get_txfreq();
sprintf(szFrequency, "%-.0f", dfreq);
}
inpFreq->value(szFrequency);
inpFreq->redraw();
Fl::unlock();
put_WARNstatus(overload);
Fl::awake();
Fl::add_timeout(0.05, evaluate, this);
return;
}