This commit is contained in:
Kurt Moraw 2020-12-20 15:16:04 +01:00
parent 63fb166ac6
commit 0f84850ff5
35 changed files with 58 additions and 54 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,7 +1 @@
 hsmodem.cpp  hsmodem.vcxproj -> E:\funk\hsmodem\hsmodem\..\WinRelease\hsmodem.exe
Code wird generiert.
1 of 599 functions ( 0.2%) were compiled, the rest were copied from previous compilation.
0 functions were new in current compilation
1 functions had inline decision re-evaluated but remain unchanged
Codegenerierung ist abgeschlossen.
hsmodem.vcxproj -> E:\funk\hsmodem\hsmodem\..\WinRelease\hsmodem.exe

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -135,7 +135,7 @@ uint16_t *make_waterfall(float fre, int *retlen)
{ {
if (sig == 1) if (sig == 1)
{ {
//printf("===>>> level detected, reset modem\n"); printf("===>>> level detected, reset modem\n");
trigger_resetmodem = 1; trigger_resetmodem = 1;
} }
} }

View File

@ -249,8 +249,8 @@ int main(int argc, char* argv[])
} }
// demodulate incoming audio data stream // demodulate incoming audio data stream
static int old_tm = 0; static uint64_t old_tm = 0;
int tm = getms(); uint64_t tm = getms();
if (tm >= (old_tm + 1000)) if (tm >= (old_tm + 1000))
{ {
// read Audio device list every 1s // read Audio device list every 1s
@ -351,8 +351,8 @@ void io_setAudioDevices(uint8_t pbvol, uint8_t capvol, uint8_t announce, uint8_t
// called from UDP RX thread for Broadcast-search from App // called from UDP RX thread for Broadcast-search from App
void bc_rxdata(uint8_t* pdata, int len, struct sockaddr_in* rxsock) void bc_rxdata(uint8_t* pdata, int len, struct sockaddr_in* rxsock)
{ {
static int lastms = 0; // time of last received BC message static uint64_t lastms = 0; // time of last received BC message
int actms = getms(); uint64_t actms = getms();
if (len > 0 && pdata[0] == 0x3c) if (len > 0 && pdata[0] == 0x3c)
{ {
@ -383,7 +383,7 @@ void bc_rxdata(uint8_t* pdata, int len, struct sockaddr_in* rxsock)
{ {
// there was an appIP already // there was an appIP already
// before accepting this new one, wait 3 seconds // before accepting this new one, wait 3 seconds
int ts = actms - lastms; int ts = (int)(actms - lastms);
printf("new app IP: %s since %d, restarting modems\n", rxip,ts); printf("new app IP: %s since %d, restarting modems\n", rxip,ts);
if (ts < 3000) if (ts < 3000)
return; return;
@ -633,8 +633,8 @@ void toGR_sendData(uint8_t* data, int type, int status, int repeat)
// called by liquid demodulator for received data // called by liquid demodulator for received data
void GRdata_rxdata(uint8_t* pdata, int len, struct sockaddr_in* rxsock) void GRdata_rxdata(uint8_t* pdata, int len, struct sockaddr_in* rxsock)
{ {
static int lasttime = -1; static int64_t lasttime = -1;
static int triggertime = 0; static uint64_t triggertime = 0;
// raw symbols // raw symbols
uint8_t* pl = unpack_data(pdata, len); uint8_t* pl = unpack_data(pdata, len);
@ -665,43 +665,46 @@ void GRdata_rxdata(uint8_t* pdata, int len, struct sockaddr_in* rxsock)
int bps = sr[speedmode].linespeed; int bps = sr[speedmode].linespeed;
// time for one frame [ms] // time for one frame [ms]
int frmlen = UDPBLOCKLEN * 8; int frmlen = UDPBLOCKLEN * 8;
int tmfrm_ms = (frmlen * 1000) / bps; int tmfrm_ms = (frmlen * 1000) / bps; // ms for one frame
int acttm = getms(); uint64_t acttm = getms();
if (lasttime == -1) if (lasttime == -1)
{ {
lasttime = acttm; lasttime = acttm;
return; return;
} }
int tdiff = (acttm - lasttime); //ms int tdiff = (int)(acttm - lasttime); // elapsed time in ms
int elapsed_frames = tdiff / tmfrm_ms; int elapsed_frames = tdiff / tmfrm_ms;
//printf("difft:%d elfrm:%d\n", tdiff, elapsed_frames); //if((tdiff%1000)==0) printf("elapsed time:%d frames:%d\n", tdiff, elapsed_frames);
if (trigger_resetmodem == 1) if (trigger_resetmodem == 1)
{ {
// reset requested by FFT level detector
trigger_resetmodem = 2; trigger_resetmodem = 2;
//printf("set triggertime\n"); //printf("set triggertime\n");
triggertime = getms(); triggertime = acttm;
} }
if ((getms() - triggertime) > 1000 && trigger_resetmodem == 2) if ((acttm - triggertime) > 1000 && trigger_resetmodem == 2)
{ {
printf("signal detected, reset RX modem\n"); // reset rx 1 second after level detection
//printf("reset RX modem, 1s since signal detection\n");
trigger_resetmodem = 0; trigger_resetmodem = 0;
rx_in_sync = 0; rx_in_sync = 0;
resetModem(); resetModem();
lasttime = acttm; lasttime = acttm;
} }
if (tdiff > 5) if (tdiff > 5000)
{ {
// in any case, only every 5s or longer // in any case, only every 5s or longer
//printf("5s elapsed\n");
if (elapsed_frames > 2) if (elapsed_frames > 2)
{ {
// reset modem if more than 2 frames have not been received // reset modem if more than 2 frames have not been received
trigger_resetmodem = 0; trigger_resetmodem = 0;
rx_in_sync = 0; rx_in_sync = 0;
//printf("no signal detected, reset RX modem\n"); printf("no signal detected, reset RX modem\n");
resetModem(); resetModem();
lasttime = acttm; lasttime = acttm;
} }

View File

@ -147,7 +147,7 @@ void setVolume_voice(int pbcap, int v);
void sendAnnouncement(); void sendAnnouncement();
void sleep_ms(int ms); void sleep_ms(int ms);
int getms(); uint64_t getms();
void GRdata_rxdata(uint8_t* pdata, int len, struct sockaddr_in* rxsock); void GRdata_rxdata(uint8_t* pdata, int len, struct sockaddr_in* rxsock);
void toGR_sendData(uint8_t* data, int type, int status, int repeat); void toGR_sendData(uint8_t* data, int type, int status, int repeat);

View File

@ -31,26 +31,30 @@ int spdarr[MAXSPDARR];
int spdarrbps[MAXSPDARR]; int spdarrbps[MAXSPDARR];
#ifdef _LINUX_ #ifdef _LINUX_
int getms() uint64_t getms()
{ {
struct timeval tv; struct timeval tv;
gettimeofday(&tv, NULL); gettimeofday(&tv, NULL);
uint64_t at = tv.tv_sec * 1000000 + tv.tv_usec; uint64_t at = tv.tv_sec * 1000000 + tv.tv_usec;
at = at / 1000; at = at / 1000;
return (int)at; return at;
} }
#endif #endif
#ifdef _WIN32_ #ifdef _WIN32_
int getms() uint64_t getms()
{ {
int actms; // get time in 100ns resolution
FILETIME ft_now;
GetSystemTimeAsFileTime(&ft_now);
SYSTEMTIME st; // convert to full 64 bit time
GetSystemTime(&st); uint64_t ll_now = (uint64_t)ft_now.dwLowDateTime + ((uint64_t)(ft_now.dwHighDateTime) << 32LL);
actms = st.wSecond * 1000 + (int)st.wMilliseconds; // convert to Milliseconds
return actms; ll_now /= (10 * 1000); // still needs 64 bit integer
return ll_now;
} }
#endif #endif
@ -114,11 +118,11 @@ int meanvalbps(int v)
// measures and calculates the speed in bit / s // measures and calculates the speed in bit / s
void measure_speed_syms(int len) void measure_speed_syms(int len)
{ {
static int lasttim = 0; static uint64_t lasttim = 0;
static int elems = 0; static int elems = 0;
int tim = getms(); uint64_t tim = getms();
int timespan = tim - lasttim; int timespan = (int)(tim - lasttim);
if(timespan < 0) if(timespan < 0)
{ {
lasttim = tim; lasttim = tim;
@ -142,11 +146,11 @@ void measure_speed_syms(int len)
void measure_speed_bps(int len) void measure_speed_bps(int len)
{ {
static int lasttim = 0; static uint64_t lasttim = 0;
static int elems = 0; static int elems = 0;
int tim = getms(); uint64_t tim = getms();
int timespan = tim - lasttim; int timespan = (int)(tim - lasttim);
if (timespan < 0) if (timespan < 0)
{ {
lasttim = tim; lasttim = tim;

Binary file not shown.

View File

@ -118,6 +118,7 @@
this.cb_audioCAP = new System.Windows.Forms.ComboBox(); this.cb_audioCAP = new System.Windows.Forms.ComboBox();
this.label4 = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label();
this.groupBox2 = new System.Windows.Forms.GroupBox(); this.groupBox2 = new System.Windows.Forms.GroupBox();
this.lb_rec = new System.Windows.Forms.Label();
this.tb_recintro = new System.Windows.Forms.TextBox(); this.tb_recintro = new System.Windows.Forms.TextBox();
this.bt_astop = new System.Windows.Forms.Button(); this.bt_astop = new System.Windows.Forms.Button();
this.bt_aplay = new System.Windows.Forms.Button(); this.bt_aplay = new System.Windows.Forms.Button();
@ -148,7 +149,6 @@
this.progressBar_fifo = new oscardata.KmProgressBar(); this.progressBar_fifo = new oscardata.KmProgressBar();
this.vu_cap = new oscardata.KmProgressBar(); this.vu_cap = new oscardata.KmProgressBar();
this.vu_pb = new oscardata.KmProgressBar(); this.vu_pb = new oscardata.KmProgressBar();
this.lb_rec = new System.Windows.Forms.Label();
this.statusStrip1.SuspendLayout(); this.statusStrip1.SuspendLayout();
this.tabPage_ber.SuspendLayout(); this.tabPage_ber.SuspendLayout();
this.tabPage_image.SuspendLayout(); this.tabPage_image.SuspendLayout();
@ -1202,6 +1202,17 @@
this.groupBox2.TabStop = false; this.groupBox2.TabStop = false;
this.groupBox2.Text = "Personal Settings"; this.groupBox2.Text = "Personal Settings";
// //
// lb_rec
//
this.lb_rec.AutoSize = true;
this.lb_rec.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lb_rec.ForeColor = System.Drawing.Color.Red;
this.lb_rec.Location = new System.Drawing.Point(498, 101);
this.lb_rec.Name = "lb_rec";
this.lb_rec.Size = new System.Drawing.Size(23, 13);
this.lb_rec.TabIndex = 29;
this.lb_rec.Text = "....";
//
// tb_recintro // tb_recintro
// //
this.tb_recintro.BackColor = System.Drawing.SystemColors.Control; this.tb_recintro.BackColor = System.Drawing.SystemColors.Control;
@ -1527,17 +1538,6 @@
this.vu_pb.Size = new System.Drawing.Size(100, 10); this.vu_pb.Size = new System.Drawing.Size(100, 10);
this.vu_pb.TabIndex = 19; this.vu_pb.TabIndex = 19;
// //
// lb_rec
//
this.lb_rec.AutoSize = true;
this.lb_rec.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lb_rec.ForeColor = System.Drawing.Color.Red;
this.lb_rec.Location = new System.Drawing.Point(498, 101);
this.lb_rec.Name = "lb_rec";
this.lb_rec.Size = new System.Drawing.Size(23, 13);
this.lb_rec.TabIndex = 29;
this.lb_rec.Text = "....";
//
// Form1 // Form1
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -1562,7 +1562,7 @@
this.ForeColor = System.Drawing.SystemColors.ControlText; this.ForeColor = System.Drawing.SystemColors.ControlText;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "Form1"; this.Name = "Form1";
this.Text = "AMSAT-DL Multimedia HS Modem V0.52 by DJ0ABR"; this.Text = "AMSAT-DL Multimedia HS Modem V0.53 by DJ0ABR";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form1_FormClosing); this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form1_FormClosing);
this.statusStrip1.ResumeLayout(false); this.statusStrip1.ResumeLayout(false);
this.statusStrip1.PerformLayout(); this.statusStrip1.PerformLayout();

View File

@ -137,7 +137,7 @@
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAABw ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAABw
FwAAAk1TRnQBSQFMAgEBDQEAAWgBBAFoAQQBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo FwAAAk1TRnQBSQFMAgEBDQEAAYABBAGAAQQBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
AwABQAMAAUADAAEBAQABCAYAARAYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA AwABQAMAAUADAAEBAQABCAYAARAYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5 AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA

View File

@ -207,13 +207,14 @@ namespace oscardata
gr.FillRectangle(bgcol, 0,0, panelw, panelh); gr.FillRectangle(bgcol, 0,0, panelw, panelh);
// oscilloscope screen // oscilloscope screen
gr.DrawImage(new Bitmap(Properties.Resources.screen), 2, 1); gr.DrawImage(new Bitmap(Properties.Resources.screen), 2, 1);
/*
// screws at the 4 corners // screws at the 4 corners
Bitmap screw = new Bitmap(Properties.Resources.schraube); Bitmap screw = new Bitmap(Properties.Resources.schraube);
gr.DrawImage(screw, 2, 2); gr.DrawImage(screw, 2, 2);
gr.DrawImage(screw, panelw - 2-screw.Width, 2); gr.DrawImage(screw, panelw - 2-screw.Width, 2);
gr.DrawImage(screw, 2, panelh - 2 - screw.Height); gr.DrawImage(screw, 2, panelh - 2 - screw.Height);
gr.DrawImage(screw, panelw - 2 - screw.Width, panelh - 2 - screw.Height); gr.DrawImage(screw, panelw - 2 - screw.Width, panelh - 2 - screw.Height);
*/
// draw constellation points // draw constellation points
for (int i = 0; i < sumidx; i++) for (int i = 0; i < sumidx; i++)
{ {
@ -297,12 +298,14 @@ namespace oscardata
gr.FillRectangle(bgcol, 0, 0, bm.Width, bm.Height); gr.FillRectangle(bgcol, 0, 0, bm.Width, bm.Height);
// scala // scala
gr.DrawImage(bmskala,16,2); gr.DrawImage(bmskala,16,2);
/*
// screws at the 4 corners // screws at the 4 corners
Bitmap screw = new Bitmap(Properties.Resources.schraube); Bitmap screw = new Bitmap(Properties.Resources.schraube);
gr.DrawImage(screw, 2, 2); gr.DrawImage(screw, 2, 2);
gr.DrawImage(screw, 442 - 2 - screw.Width, 2); gr.DrawImage(screw, 442 - 2 - screw.Width, 2);
gr.DrawImage(screw, 2, 76 - 2 - screw.Height); gr.DrawImage(screw, 2, 76 - 2 - screw.Height);
gr.DrawImage(screw, 442 - 2 - screw.Width, 76 - 2 - screw.Height); gr.DrawImage(screw, 442 - 2 - screw.Width, 76 - 2 - screw.Height);
*/
// spectrum // spectrum
int lastus = -1; int lastus = -1;
// values // values