diff --git a/README.md b/README.md index fce236f..5817a16 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ The purpose of this project is to transfer data (pictures...) via a 2,7kHz SSB channel on the narrow band transponder as fast as possible. # this is work in progress -Version 0.52 +Version 0.55 Windows 10 (should work on Win7, not tested) linux Desktop PC, Odroid SBC diff --git a/WinRelease/hsmodem.exe b/WinRelease/hsmodem.exe index c71729f..c2f5a1f 100755 Binary files a/WinRelease/hsmodem.exe and b/WinRelease/hsmodem.exe differ diff --git a/WinRelease/oscardata.exe b/WinRelease/oscardata.exe index c4979c8..82afc41 100755 Binary files a/WinRelease/oscardata.exe and b/WinRelease/oscardata.exe differ diff --git a/hsmodem/Makefile b/hsmodem/Makefile index bf4f82c..656ae2a 100755 --- a/hsmodem/Makefile +++ b/hsmodem/Makefile @@ -9,7 +9,7 @@ CXXFLAGS = -Wall -O3 -std=c++0x -Wno-write-strings -Wno-narrowing LDFLAGS = -lpthread -lrt -lsndfile -lasound -lm -lopus -lfftw3 -lfftw3_threads -lliquid -lcodec2 -lsoundio -OBJ = hsmodem.o constellation.o crc16.o frame_packer.o main_helper.o scrambler.o speed.o fec.o udp.o fft.o liquid_if.o symboltracker.o voiceprocessor.o codec2.o soundio.o fifo.o announcement.o fifo_voice.o voiceio.o +OBJ = hsmodem.o constellation.o crc16.o frame_packer.o main_helper.o scrambler.o speed.o fec.o udp.o fft.o liquid_if.o symboltracker.o voiceprocessor.o codec2.o soundio.o fifo.o announcement.o fifo_voice.o voiceio.o tuning.o default: $(OBJ) mkdir -p ../hsmodemLinux diff --git a/hsmodem/Release/announcement.obj b/hsmodem/Release/announcement.obj index c5d368d..3bdde8d 100755 Binary files a/hsmodem/Release/announcement.obj and b/hsmodem/Release/announcement.obj differ diff --git a/hsmodem/Release/codec2.obj b/hsmodem/Release/codec2.obj index a89f970..e9d13cb 100755 Binary files a/hsmodem/Release/codec2.obj and b/hsmodem/Release/codec2.obj differ diff --git a/hsmodem/Release/constellation.obj b/hsmodem/Release/constellation.obj index 12d7607..ff547b8 100755 Binary files a/hsmodem/Release/constellation.obj and b/hsmodem/Release/constellation.obj differ diff --git a/hsmodem/Release/crc16.obj b/hsmodem/Release/crc16.obj index 9e1202b..12bc6f7 100755 Binary files a/hsmodem/Release/crc16.obj and b/hsmodem/Release/crc16.obj differ diff --git a/hsmodem/Release/fec.obj b/hsmodem/Release/fec.obj index 229f8d6..895d19e 100755 Binary files a/hsmodem/Release/fec.obj and b/hsmodem/Release/fec.obj differ diff --git a/hsmodem/Release/fft.obj b/hsmodem/Release/fft.obj index a376fff..42f29c9 100755 Binary files a/hsmodem/Release/fft.obj and b/hsmodem/Release/fft.obj differ diff --git a/hsmodem/Release/fifo.obj b/hsmodem/Release/fifo.obj index e91d07e..4348d34 100755 Binary files a/hsmodem/Release/fifo.obj and b/hsmodem/Release/fifo.obj differ diff --git a/hsmodem/Release/fifo_voice.obj b/hsmodem/Release/fifo_voice.obj index 24a0cf3..b32ff78 100755 Binary files a/hsmodem/Release/fifo_voice.obj and b/hsmodem/Release/fifo_voice.obj differ diff --git a/hsmodem/Release/frame_packer.obj b/hsmodem/Release/frame_packer.obj index 3a326f5..88275ff 100755 Binary files a/hsmodem/Release/frame_packer.obj and b/hsmodem/Release/frame_packer.obj differ diff --git a/hsmodem/Release/hsmodem.Build.CppClean.log b/hsmodem/Release/hsmodem.Build.CppClean.log index e69de29..7e8dd76 100755 --- a/hsmodem/Release/hsmodem.Build.CppClean.log +++ b/hsmodem/Release/hsmodem.Build.CppClean.log @@ -0,0 +1,32 @@ +e:\funk\hsmodem\hsmodem\release\vc140.pdb +e:\funk\hsmodem\hsmodem\release\tuning.obj +e:\funk\hsmodem\hsmodem\release\liquid_if.obj +e:\funk\hsmodem\hsmodem\release\fft.obj +e:\funk\hsmodem\hsmodem\release\voiceprocessor.obj +e:\funk\hsmodem\hsmodem\release\voiceio.obj +e:\funk\hsmodem\hsmodem\release\udp.obj +e:\funk\hsmodem\hsmodem\release\symboltracker.obj +e:\funk\hsmodem\hsmodem\release\speed.obj +e:\funk\hsmodem\hsmodem\release\soundio.obj +e:\funk\hsmodem\hsmodem\release\scrambler.obj +e:\funk\hsmodem\hsmodem\release\main_helper.obj +e:\funk\hsmodem\hsmodem\release\hsmodem.obj +e:\funk\hsmodem\hsmodem\release\frame_packer.obj +e:\funk\hsmodem\hsmodem\release\fifo_voice.obj +e:\funk\hsmodem\hsmodem\release\fifo.obj +e:\funk\hsmodem\hsmodem\release\fec.obj +e:\funk\hsmodem\hsmodem\release\crc16.obj +e:\funk\hsmodem\hsmodem\release\constellation.obj +e:\funk\hsmodem\hsmodem\release\codec2.obj +e:\funk\hsmodem\hsmodem\release\announcement.obj +e:\funk\hsmodem\winrelease\hsmodem.exe +e:\funk\hsmodem\winrelease\hsmodem.ipdb +e:\funk\hsmodem\winrelease\hsmodem.iobj +e:\funk\hsmodem\winrelease\hsmodem.pdb +e:\funk\hsmodem\hsmodem\..\winrelease\hsmodem.exe +e:\funk\hsmodem\hsmodem\release\hsmodem.tlog\cl.command.1.tlog +e:\funk\hsmodem\hsmodem\release\hsmodem.tlog\cl.read.1.tlog +e:\funk\hsmodem\hsmodem\release\hsmodem.tlog\cl.write.1.tlog +e:\funk\hsmodem\hsmodem\release\hsmodem.tlog\link.command.1.tlog +e:\funk\hsmodem\hsmodem\release\hsmodem.tlog\link.read.1.tlog +e:\funk\hsmodem\hsmodem\release\hsmodem.tlog\link.write.1.tlog diff --git a/hsmodem/Release/hsmodem.log b/hsmodem/Release/hsmodem.log index f0fa945..6a30007 100755 --- a/hsmodem/Release/hsmodem.log +++ b/hsmodem/Release/hsmodem.log @@ -1 +1,24 @@ - hsmodem.vcxproj -> E:\funk\hsmodem\hsmodem\..\WinRelease\hsmodem.exe + announcement.cpp + codec2.cpp + constellation.cpp + crc16.cpp + fec.cpp + fft.cpp + fifo.cpp + fifo_voice.cpp + frame_packer.cpp + hsmodem.cpp + liquid_if.cpp + main_helper.cpp + scrambler.cpp + soundio.cpp + speed.cpp + symboltracker.cpp + tuning.cpp + udp.cpp + voiceio.cpp + voiceprocessor.cpp + Code wird generiert. + All 602 functions were compiled because no usable IPDB/IOBJ from previous compilation was found. + Codegenerierung ist abgeschlossen. + hsmodem.vcxproj -> E:\funk\hsmodem\hsmodem\..\WinRelease\hsmodem.exe diff --git a/hsmodem/Release/hsmodem.obj b/hsmodem/Release/hsmodem.obj index d4f57b6..8fd2ecf 100755 Binary files a/hsmodem/Release/hsmodem.obj and b/hsmodem/Release/hsmodem.obj differ diff --git a/hsmodem/Release/hsmodem.tlog/CL.command.1.tlog b/hsmodem/Release/hsmodem.tlog/CL.command.1.tlog index e1e706d..70e5322 100755 Binary files a/hsmodem/Release/hsmodem.tlog/CL.command.1.tlog and b/hsmodem/Release/hsmodem.tlog/CL.command.1.tlog differ diff --git a/hsmodem/Release/hsmodem.tlog/CL.read.1.tlog b/hsmodem/Release/hsmodem.tlog/CL.read.1.tlog index cbc30c4..ef9120e 100755 Binary files a/hsmodem/Release/hsmodem.tlog/CL.read.1.tlog and b/hsmodem/Release/hsmodem.tlog/CL.read.1.tlog differ diff --git a/hsmodem/Release/hsmodem.tlog/CL.write.1.tlog b/hsmodem/Release/hsmodem.tlog/CL.write.1.tlog index 39fb88e..6b01914 100755 Binary files a/hsmodem/Release/hsmodem.tlog/CL.write.1.tlog and b/hsmodem/Release/hsmodem.tlog/CL.write.1.tlog differ diff --git a/hsmodem/Release/hsmodem.tlog/link.command.1.tlog b/hsmodem/Release/hsmodem.tlog/link.command.1.tlog index e915d1e..bc14a2c 100755 Binary files a/hsmodem/Release/hsmodem.tlog/link.command.1.tlog and b/hsmodem/Release/hsmodem.tlog/link.command.1.tlog differ diff --git a/hsmodem/Release/hsmodem.tlog/link.read.1.tlog b/hsmodem/Release/hsmodem.tlog/link.read.1.tlog index 9bcd221..0513737 100755 Binary files a/hsmodem/Release/hsmodem.tlog/link.read.1.tlog and b/hsmodem/Release/hsmodem.tlog/link.read.1.tlog differ diff --git a/hsmodem/Release/hsmodem.tlog/link.write.1.tlog b/hsmodem/Release/hsmodem.tlog/link.write.1.tlog index ac98225..02829da 100755 Binary files a/hsmodem/Release/hsmodem.tlog/link.write.1.tlog and b/hsmodem/Release/hsmodem.tlog/link.write.1.tlog differ diff --git a/hsmodem/Release/liquid_if.obj b/hsmodem/Release/liquid_if.obj index a6ec5ee..24c40b9 100755 Binary files a/hsmodem/Release/liquid_if.obj and b/hsmodem/Release/liquid_if.obj differ diff --git a/hsmodem/Release/main_helper.obj b/hsmodem/Release/main_helper.obj index 13959d4..abdc194 100755 Binary files a/hsmodem/Release/main_helper.obj and b/hsmodem/Release/main_helper.obj differ diff --git a/hsmodem/Release/scrambler.obj b/hsmodem/Release/scrambler.obj index a917911..9454855 100755 Binary files a/hsmodem/Release/scrambler.obj and b/hsmodem/Release/scrambler.obj differ diff --git a/hsmodem/Release/soundio.obj b/hsmodem/Release/soundio.obj index 29c9d53..5fe8b4f 100755 Binary files a/hsmodem/Release/soundio.obj and b/hsmodem/Release/soundio.obj differ diff --git a/hsmodem/Release/speed.obj b/hsmodem/Release/speed.obj index cadcd19..dce1202 100755 Binary files a/hsmodem/Release/speed.obj and b/hsmodem/Release/speed.obj differ diff --git a/hsmodem/Release/symboltracker.obj b/hsmodem/Release/symboltracker.obj index d9fc6fb..0cf525a 100755 Binary files a/hsmodem/Release/symboltracker.obj and b/hsmodem/Release/symboltracker.obj differ diff --git a/hsmodem/Release/tuning.obj b/hsmodem/Release/tuning.obj new file mode 100755 index 0000000..222443d Binary files /dev/null and b/hsmodem/Release/tuning.obj differ diff --git a/hsmodem/Release/udp.obj b/hsmodem/Release/udp.obj index 80b4959..3994531 100755 Binary files a/hsmodem/Release/udp.obj and b/hsmodem/Release/udp.obj differ diff --git a/hsmodem/Release/vc140.pdb b/hsmodem/Release/vc140.pdb index 0cc524b..a3e3c8d 100755 Binary files a/hsmodem/Release/vc140.pdb and b/hsmodem/Release/vc140.pdb differ diff --git a/hsmodem/Release/voiceio.obj b/hsmodem/Release/voiceio.obj index bb7ccea..27326cb 100755 Binary files a/hsmodem/Release/voiceio.obj and b/hsmodem/Release/voiceio.obj differ diff --git a/hsmodem/Release/voiceprocessor.obj b/hsmodem/Release/voiceprocessor.obj index 39e65a8..df245ce 100755 Binary files a/hsmodem/Release/voiceprocessor.obj and b/hsmodem/Release/voiceprocessor.obj differ diff --git a/hsmodem/fft.cpp b/hsmodem/fft.cpp index 75a70a8..d53aefa 100755 --- a/hsmodem/fft.cpp +++ b/hsmodem/fft.cpp @@ -159,7 +159,12 @@ int yidx = 0; uint16_t* mean(uint16_t* f) { + static uint16_t fa[FFT_AUDIOSAMPLERATE / 2 + 1]; + + if (tuning) + return f; + // first smooth X values for (int x = 0; x < smoothX / 2; x++) fa[x] = f[x]; @@ -189,6 +194,10 @@ uint16_t* mean(uint16_t* f) fa[i] /= smoothY; } + // do not smooth 2950 to 3050 Hz + for (int i = 295; i < 305; i++) + fa[i] = f[i]; + return fa; } @@ -207,7 +216,7 @@ void _init_fft() // decimate 44.1k or 48k down to 8000Hz // the FFT rate is 800, but we feed it with 8000 Samplerate // this results in a new fft every 100ms with a resolution of 10 Hz - float ratio = 10.0f * (float)FFT_AUDIOSAMPLERATE / (float)caprate; + float ratio = 10.0f * (float)FFT_AUDIOSAMPLERATE / (float)physcaprate; fftdecim = msresamp_crcf_create(ratio, 40.0f); } diff --git a/hsmodem/hsmodem.cpp b/hsmodem/hsmodem.cpp index 0164ae6..e084475 100755 --- a/hsmodem/hsmodem.cpp +++ b/hsmodem/hsmodem.cpp @@ -86,6 +86,8 @@ float softwareLSvolume = 1; int announcement = 0; int VoiceAudioMode = VOICEMODE_OFF; int codec = 1; // 0=opus, 1=codec2 +int tuning = 0; +int marker = 0; int init_audio_result = 0; int init_voice_result = 0; @@ -247,6 +249,11 @@ int main(int argc, char* argv[]) encode(f); } } + + if (tuning != 0) + { + do_tuning(tuning); + } // demodulate incoming audio data stream static uint64_t old_tm = 0; @@ -482,6 +489,7 @@ void appdata_rxdata(uint8_t* pdata, int len, struct sockaddr_in* rxsock) if (type == 20) { // reset liquid RX modem + tuning = 0; resetModem(); io_clear_audio_fifos(); return; @@ -555,6 +563,24 @@ void appdata_rxdata(uint8_t* pdata, int len, struct sockaddr_in* rxsock) // GUI requests termination of this hsmodem printf("shut down hsmodem\n"); closeAllandTerminate(); + return; + } + + if (type == 27) + { + // send Tuning tones + printf("Tuning mode active\n"); + VoiceAudioMode = VOICEMODE_OFF; + tuning_runtime = 0; + tuning = minfo; + return; + } + + if (type == 28) + { + printf("marker:%d\n",minfo); + marker = minfo; + return; } // here we are with payload data to be sent via the modulator diff --git a/hsmodem/hsmodem.h b/hsmodem/hsmodem.h index f09687e..eaf03e9 100755 --- a/hsmodem/hsmodem.h +++ b/hsmodem/hsmodem.h @@ -203,6 +203,9 @@ void km_symtrack_execute(liquid_float_complex _x, liquid_float_complex* _y, unsi void io_saveStream(float f); void playIntro(); void io_clear_voice_fifos(); +float do_tuning(int send); +void init_tune(); +float singleFrequency(); extern int speedmode; @@ -242,6 +245,9 @@ extern int restart_modems; extern int safemode; extern char homepath[]; extern int sendIntro; +extern int tuning; +extern uint32_t tuning_runtime; +extern int marker; #ifdef _LINUX_ int isRunning(char* prgname); diff --git a/hsmodem/hsmodem.vcxproj b/hsmodem/hsmodem.vcxproj index f7b0623..8c992c6 100755 --- a/hsmodem/hsmodem.vcxproj +++ b/hsmodem/hsmodem.vcxproj @@ -255,6 +255,7 @@ + diff --git a/hsmodem/hsmodem.vcxproj.filters b/hsmodem/hsmodem.vcxproj.filters index 66ee4f2..c4015bf 100755 --- a/hsmodem/hsmodem.vcxproj.filters +++ b/hsmodem/hsmodem.vcxproj.filters @@ -72,6 +72,9 @@ Source Files + + Source Files + diff --git a/hsmodem/liquid_if.cpp b/hsmodem/liquid_if.cpp index e271365..3c0356d 100755 --- a/hsmodem/liquid_if.cpp +++ b/hsmodem/liquid_if.cpp @@ -193,7 +193,7 @@ void modulator(uint8_t sym_in) { // move sample to 1,5kHz carrier nco_crcf_step(upnco); - + liquid_float_complex c; nco_crcf_mix_up(upnco,y[i],&c); float usb = c.real + c.imag; @@ -207,7 +207,10 @@ void modulator(uint8_t sym_in) if(fs > 20000) break; sleep_ms(10); } - + + if(marker) + usb += singleFrequency() / 10.0f; + io_pb_write_fifo(usb * 0.2f); // reduce volume and send to soundcard } } diff --git a/hsmodem/soundio.cpp b/hsmodem/soundio.cpp index 246bbc8..0df6f2e 100755 --- a/hsmodem/soundio.cpp +++ b/hsmodem/soundio.cpp @@ -615,6 +615,8 @@ int io_init_sound(char *pbname, char *capname) printf("physical capture rate:%d, logical capture rate:%d\n", caprate, caprate); printf("format: %s\n\n", soundio_format_string(outstream->format)); + init_tune(); + return init_audio_result; } diff --git a/hsmodem/tuning.cpp b/hsmodem/tuning.cpp new file mode 100755 index 0000000..9d48137 --- /dev/null +++ b/hsmodem/tuning.cpp @@ -0,0 +1,113 @@ +/* +* High Speed modem to transfer data in a 2,7kHz SSB channel +* ========================================================= +* Author: DJ0ABR +* +* (c) DJ0ABR +* www.dj0abr.de +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program 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 General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +* +* tuning.c ... generate tuning tones and feed audio to TRX +* +*/ + +#include "hsmodem.h" + + + + +#define NUMFREQ 12 +int tunefreq[NUMFREQ] = { 150,420,690,960,1230,1500,1770,2040,2310,2580,2850,3000 }; +nco_crcf tunenco[NUMFREQ]; +uint32_t tuning_runtime = 0; + +void init_tune() +{ + static int f = 1; + if (f) + { + for (int i = 0; i < NUMFREQ; i++) + tunenco[i] = NULL; + f = 0; + } + + for (int i = 0; i < NUMFREQ; i++) + { + if (tunenco[i] != NULL) nco_crcf_destroy(tunenco[i]); + + // create NCO for frequency + printf("tuning: physcaprate:%d\n", physcaprate); + float rad_per_sample = ((2.0f * (float)M_PI * (float)tunefreq[i]) / (float)caprate); + tunenco[i] = nco_crcf_create(LIQUID_NCO); + nco_crcf_set_phase(tunenco[i], 0.0f); + nco_crcf_set_frequency(tunenco[i], rad_per_sample); + } +} + +// send= 1 ... send all frequencies to soundcard +// send= 2,3,4 ... send a single freq to soundcard +float do_tuning(int send) +{ + if (tunenco == NULL) return 0.0f; + if (send < 0 || send > 4) return 0.0f; + + float f = 0; + if (send == 1) + { + for (int i = 0; i < NUMFREQ; i++) + { + nco_crcf_step(tunenco[i]); + float v = nco_crcf_sin(tunenco[i]); + f += v; + } + f /= 3; + } + else + { + nco_crcf_step(tunenco[send-2]); + f = nco_crcf_sin(tunenco[send-2]); + } + + // adapt speed to soundcard samplerate + int fs; + while (1) + { + fs = io_pb_fifo_freespace(0); + // wait until there is space in fifo + if (fs > 20000) break; + sleep_ms(10); + } + + io_pb_write_fifo(f * 0.05f); // reduce volume and send to soundcard + + if (++tuning_runtime >= (48000 * 5 * 60)) + { + // 5min max time + printf("Maximum tuning time, switch off tuning\n"); + tuning = 0; + } + return f; +} + +float singleFrequency() +{ + int i = 11; // 3000 Hz + + if (tunenco[i] == NULL) return 0.0f; + + nco_crcf_step(tunenco[i]); + return nco_crcf_sin(tunenco[i]); +} diff --git a/hsmodemLinux/hsmodem b/hsmodemLinux/hsmodem index 496e813..1bb6492 100755 Binary files a/hsmodemLinux/hsmodem and b/hsmodemLinux/hsmodem differ diff --git a/hsmodemLinux/oscardata.exe b/hsmodemLinux/oscardata.exe index 291d103..706dd5f 100755 Binary files a/hsmodemLinux/oscardata.exe and b/hsmodemLinux/oscardata.exe differ diff --git a/oscardata/oscardata/Form1.Designer.cs b/oscardata/oscardata/Form1.Designer.cs index ab7c312..ad688c5 100755 --- a/oscardata/oscardata/Form1.Designer.cs +++ b/oscardata/oscardata/Form1.Designer.cs @@ -41,6 +41,8 @@ this.timer_qpsk = new System.Windows.Forms.Timer(this.components); this.panel_txspectrum = new System.Windows.Forms.Panel(); this.tabPage_ber = new System.Windows.Forms.TabPage(); + this.bt_allf = new System.Windows.Forms.Button(); + this.lb_tuningqrgs = new System.Windows.Forms.Label(); this.button_stopBERtest = new System.Windows.Forms.Button(); this.imageList1 = new System.Windows.Forms.ImageList(this.components); this.button_startBERtest = new System.Windows.Forms.Button(); @@ -149,6 +151,7 @@ this.progressBar_fifo = new oscardata.KmProgressBar(); this.vu_cap = new oscardata.KmProgressBar(); this.vu_pb = new oscardata.KmProgressBar(); + this.cb_marker = new System.Windows.Forms.CheckBox(); this.statusStrip1.SuspendLayout(); this.tabPage_ber.SuspendLayout(); this.tabPage_image.SuspendLayout(); @@ -256,6 +259,8 @@ // tabPage_ber // this.tabPage_ber.BackColor = System.Drawing.Color.Transparent; + this.tabPage_ber.Controls.Add(this.bt_allf); + this.tabPage_ber.Controls.Add(this.lb_tuningqrgs); this.tabPage_ber.Controls.Add(this.button_stopBERtest); this.tabPage_ber.Controls.Add(this.button_startBERtest); this.tabPage_ber.Controls.Add(this.rtb); @@ -263,10 +268,30 @@ this.tabPage_ber.Location = new System.Drawing.Point(4, 23); this.tabPage_ber.Name = "tabPage_ber"; this.tabPage_ber.Padding = new System.Windows.Forms.Padding(3); - this.tabPage_ber.Size = new System.Drawing.Size(1291, 552); + this.tabPage_ber.Size = new System.Drawing.Size(1280, 552); this.tabPage_ber.TabIndex = 0; this.tabPage_ber.Text = "BER Test"; // + // bt_allf + // + this.bt_allf.Location = new System.Drawing.Point(537, 18); + this.bt_allf.Name = "bt_allf"; + this.bt_allf.Size = new System.Drawing.Size(95, 23); + this.bt_allf.TabIndex = 25; + this.bt_allf.Text = "150..2850 Hz"; + this.bt_allf.UseVisualStyleBackColor = true; + this.bt_allf.Click += new System.EventHandler(this.bt_allf_Click); + // + // lb_tuningqrgs + // + this.lb_tuningqrgs.AutoSize = true; + this.lb_tuningqrgs.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lb_tuningqrgs.Location = new System.Drawing.Point(436, 22); + this.lb_tuningqrgs.Name = "lb_tuningqrgs"; + this.lb_tuningqrgs.Size = new System.Drawing.Size(84, 13); + this.lb_tuningqrgs.TabIndex = 21; + this.lb_tuningqrgs.Text = "Frequency Test:"; + // // button_stopBERtest // this.button_stopBERtest.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); @@ -318,7 +343,7 @@ this.rtb.Font = new System.Drawing.Font("Courier New", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.rtb.Location = new System.Drawing.Point(6, 51); this.rtb.Name = "rtb"; - this.rtb.Size = new System.Drawing.Size(1270, 494); + this.rtb.Size = new System.Drawing.Size(1266, 494); this.rtb.TabIndex = 0; this.rtb.Text = ""; // @@ -334,7 +359,7 @@ this.tabPage_image.Location = new System.Drawing.Point(4, 23); this.tabPage_image.Name = "tabPage_image"; this.tabPage_image.Padding = new System.Windows.Forms.Padding(3); - this.tabPage_image.Size = new System.Drawing.Size(1291, 552); + this.tabPage_image.Size = new System.Drawing.Size(1280, 552); this.tabPage_image.TabIndex = 1; this.tabPage_image.Text = "Image"; // @@ -508,7 +533,7 @@ this.tabControl1.Location = new System.Drawing.Point(5, 3); this.tabControl1.Name = "tabControl1"; this.tabControl1.SelectedIndex = 0; - this.tabControl1.Size = new System.Drawing.Size(1299, 579); + this.tabControl1.Size = new System.Drawing.Size(1288, 579); this.tabControl1.TabIndex = 3; // // tabPage_file @@ -528,7 +553,7 @@ this.tabPage_file.ImageIndex = 9; this.tabPage_file.Location = new System.Drawing.Point(4, 23); this.tabPage_file.Name = "tabPage_file"; - this.tabPage_file.Size = new System.Drawing.Size(1291, 552); + this.tabPage_file.Size = new System.Drawing.Size(1280, 552); this.tabPage_file.TabIndex = 2; this.tabPage_file.Text = "File"; // @@ -670,7 +695,7 @@ this.tabPage_audio.ImageIndex = 11; this.tabPage_audio.Location = new System.Drawing.Point(4, 23); this.tabPage_audio.Name = "tabPage_audio"; - this.tabPage_audio.Size = new System.Drawing.Size(1291, 552); + this.tabPage_audio.Size = new System.Drawing.Size(1280, 552); this.tabPage_audio.TabIndex = 5; this.tabPage_audio.Text = "Voice Audio"; // @@ -928,7 +953,7 @@ this.tabPage_setup.ImageIndex = 6; this.tabPage_setup.Location = new System.Drawing.Point(4, 23); this.tabPage_setup.Name = "tabPage_setup"; - this.tabPage_setup.Size = new System.Drawing.Size(1291, 552); + this.tabPage_setup.Size = new System.Drawing.Size(1280, 552); this.tabPage_setup.TabIndex = 4; this.tabPage_setup.Text = "Setup"; // @@ -943,9 +968,9 @@ this.groupBox4.Controls.Add(this.tb_shutdown); this.groupBox4.Controls.Add(this.bt_resetmodem); this.groupBox4.Controls.Add(this.textBox3); - this.groupBox4.Location = new System.Drawing.Point(12, 257); + this.groupBox4.Location = new System.Drawing.Point(12, 313); this.groupBox4.Name = "groupBox4"; - this.groupBox4.Size = new System.Drawing.Size(674, 121); + this.groupBox4.Size = new System.Drawing.Size(743, 121); this.groupBox4.TabIndex = 15; this.groupBox4.TabStop = false; this.groupBox4.Text = "Maintenance"; @@ -1038,6 +1063,7 @@ this.bt_resetmodem.TabIndex = 6; this.bt_resetmodem.Text = "Reset RX Modem"; this.bt_resetmodem.UseVisualStyleBackColor = true; + this.bt_resetmodem.Visible = false; this.bt_resetmodem.Click += new System.EventHandler(this.bt_resetmodem_Click); // // textBox3 @@ -1055,6 +1081,7 @@ // // groupBox3 // + this.groupBox3.Controls.Add(this.cb_marker); this.groupBox3.Controls.Add(this.vu_cap); this.groupBox3.Controls.Add(this.vu_pb); this.groupBox3.Controls.Add(this.pb_audioCAPstatus); @@ -1069,7 +1096,7 @@ this.groupBox3.Controls.Add(this.label4); this.groupBox3.Location = new System.Drawing.Point(12, 144); this.groupBox3.Name = "groupBox3"; - this.groupBox3.Size = new System.Drawing.Size(674, 107); + this.groupBox3.Size = new System.Drawing.Size(743, 163); this.groupBox3.TabIndex = 14; this.groupBox3.TabStop = false; this.groupBox3.Text = "Transceiver Audio"; @@ -1197,7 +1224,7 @@ this.groupBox2.Controls.Add(this.cb_stampcall); this.groupBox2.Location = new System.Drawing.Point(12, 13); this.groupBox2.Name = "groupBox2"; - this.groupBox2.Size = new System.Drawing.Size(674, 127); + this.groupBox2.Size = new System.Drawing.Size(734, 127); this.groupBox2.TabIndex = 13; this.groupBox2.TabStop = false; this.groupBox2.Text = "Personal Settings"; @@ -1388,7 +1415,7 @@ this.tabPage_about.ImageIndex = 12; this.tabPage_about.Location = new System.Drawing.Point(4, 23); this.tabPage_about.Name = "tabPage_about"; - this.tabPage_about.Size = new System.Drawing.Size(1291, 552); + this.tabPage_about.Size = new System.Drawing.Size(1280, 552); this.tabPage_about.TabIndex = 6; this.tabPage_about.Text = "About"; this.tabPage_about.UseVisualStyleBackColor = true; @@ -1538,6 +1565,18 @@ this.vu_pb.Size = new System.Drawing.Size(100, 10); this.vu_pb.TabIndex = 19; // + // cb_marker + // + this.cb_marker.AutoSize = true; + this.cb_marker.Location = new System.Drawing.Point(605, 21); + this.cb_marker.Name = "cb_marker"; + this.cb_marker.RightToLeft = System.Windows.Forms.RightToLeft.No; + this.cb_marker.Size = new System.Drawing.Size(123, 17); + this.cb_marker.TabIndex = 27; + this.cb_marker.Text = "3kHz Tuning Marker"; + this.cb_marker.UseVisualStyleBackColor = true; + this.cb_marker.CheckedChanged += new System.EventHandler(this.cb_marker_CheckedChanged); + // // Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -1562,11 +1601,12 @@ this.ForeColor = System.Drawing.SystemColors.ControlText; this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.Name = "Form1"; - this.Text = "AMSAT-DL Multimedia HS Modem V0.53 by DJ0ABR"; + this.Text = "AMSAT-DL Multimedia HS Modem V0.55 by DJ0ABR"; this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form1_FormClosing); this.statusStrip1.ResumeLayout(false); this.statusStrip1.PerformLayout(); this.tabPage_ber.ResumeLayout(false); + this.tabPage_ber.PerformLayout(); this.tabPage_image.ResumeLayout(false); this.tabPage_image.PerformLayout(); this.groupBox1.ResumeLayout(false); @@ -1730,6 +1770,9 @@ private System.Windows.Forms.Button bt_aplay; private System.Windows.Forms.TextBox tb_recintro; private System.Windows.Forms.Label lb_rec; + private System.Windows.Forms.Label lb_tuningqrgs; + private System.Windows.Forms.Button bt_allf; + private System.Windows.Forms.CheckBox cb_marker; } } diff --git a/oscardata/oscardata/Form1.cs b/oscardata/oscardata/Form1.cs index 7d350f9..651318a 100755 --- a/oscardata/oscardata/Form1.cs +++ b/oscardata/oscardata/Form1.cs @@ -48,6 +48,7 @@ namespace oscardata int last_initVoiceStatus; int recordStatus = 0; int recPhase = 0; + public Form1() { @@ -636,6 +637,13 @@ namespace oscardata { lb_rec.Visible = false; } + + if (statics.tuning_active == 1 && txcommand != statics.noTX) + { + // stop tuning + bt_resetmodem_Click(null, null); + statics.tuning_active = 0; + } } private void panel_constel_Paint(object sender, PaintEventArgs e) @@ -1443,6 +1451,8 @@ namespace oscardata // and transmit it Udp.UdpSendCtrl(txdata); + + statics.tuning_active = 0; } int setPBvolume = -1; @@ -1734,6 +1744,8 @@ namespace oscardata lb_rxsync.Text = "RX Sync:"; cb_sendIntro.Text = "send introduction"; tb_recintro.Text = "record introduction"; + lb_tuningqrgs.Text = "Frequency Test"; + cb_marker.Text = "3kHz Tuning Marker"; } if (language == 1) @@ -1790,6 +1802,8 @@ namespace oscardata tb_shutdown.Text = "Vor dem Ausschalten eines SBC diesen hier herunterfahren"; cb_sendIntro.Text = "sende Vorstellung"; tb_recintro.Text = "Vorstellung aufnehmen"; + lb_tuningqrgs.Text = "Frequenz Test:"; + cb_marker.Text = "3kHz Tuning Markierung"; } } @@ -1894,6 +1908,44 @@ namespace oscardata } } + int acttuning = 0; + private void bt_tuning(int fr) + { + if (statics.tuning_active == 0 || fr != acttuning) + { + label_rximage.ForeColor = Color.Black; + pictureBox_rximage.Image = null; + ArraySend.stopSending(); + bt_resetmodem_Click(null, null); + txcommand = statics.noTX; + + Byte[] txdata = new byte[2]; + txdata[0] = statics.tuning; + txdata[1] = (Byte)fr; + Udp.UdpSendCtrl(txdata); + statics.tuning_active = 1; + } + else + { + txcommand = statics.noTX; + bt_resetmodem_Click(null, null); + statics.tuning_active = 0; + } + acttuning = fr; + } + + private void bt_allf_Click(object sender, EventArgs e) + { + bt_tuning(1); + } + + private void cb_marker_CheckedChanged(object sender, EventArgs e) + { + Byte[] txdata = new byte[2]; + txdata[0] = statics.marker; + txdata[1] = (Byte)(cb_marker.Checked ? 1 : 0); + Udp.UdpSendCtrl(txdata); + } } } diff --git a/oscardata/oscardata/Form1.resx b/oscardata/oscardata/Form1.resx index 3ae742d..43c08c7 100755 --- a/oscardata/oscardata/Form1.resx +++ b/oscardata/oscardata/Form1.resx @@ -137,7 +137,7 @@ AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAABw - FwAAAk1TRnQBSQFMAgEBDQEAAYABBAGAAQQBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo + FwAAAk1TRnQBSQFMAgEBDQEAAQgBBQEIAQUBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo AwABQAMAAUADAAEBAQABCAYAARAYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5 AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA diff --git a/oscardata/oscardata/bin/Release/oscardata.exe b/oscardata/oscardata/bin/Release/oscardata.exe index c4979c8..82afc41 100755 Binary files a/oscardata/oscardata/bin/Release/oscardata.exe and b/oscardata/oscardata/bin/Release/oscardata.exe differ diff --git a/oscardata/oscardata/config.cs b/oscardata/oscardata/config.cs index a95d713..7cf7d05 100755 --- a/oscardata/oscardata/config.cs +++ b/oscardata/oscardata/config.cs @@ -36,6 +36,8 @@ namespace oscardata public static Byte SetMICvolume = 24; public static Byte SetVoiceMode = 25; public static Byte terminate = 26; + public static Byte tuning = 27; + public static Byte marker = 28; // frame sequence, modem needs that for i.e. sending a preamble public static Byte FirstFrame = 0; @@ -80,6 +82,7 @@ namespace oscardata public static int maxTXlevel = 0; public static Color WindowBackColor; public static String[] langstr; + public static int tuning_active = 0; public static String[] getOwnIPs() { diff --git a/oscardata/oscardata/udp.cs b/oscardata/oscardata/udp.cs index 2b726c3..2004f34 100755 --- a/oscardata/oscardata/udp.cs +++ b/oscardata/oscardata/udp.cs @@ -269,6 +269,7 @@ namespace oscardata gr.DrawLine(penred, 150, yl, 150, yh); gr.DrawLine(pensolid, 20, yl, 20, yh); gr.DrawLine(pensolid, 280, yl, 280, yh); + gr.DrawLine(penred, 300, yl, 300, yh); gr.DrawLine(pensolid, 360, yl, 360, yh); gr.DrawRectangle(penred, 15, yh, 270, yl-yh); @@ -327,20 +328,11 @@ namespace oscardata uq_fft.Add(bm); } - static AutoResetEvent autoEvent = new AutoResetEvent(false); - // Udp TX Loop runs in its own thread static void Udptxloop() { UdpClient udpc = new UdpClient(); - // calculate cycle time for the requested data rate - // time in ms for one bit: 1000/statics.datarate - - //int actdatarate = statics.getDatarate(); - //int wait_datarate = (int)(((double)statics.UdpBlocklen * 8.0 * 1000.0 / (double)(statics.getDatarate()))); - //Timer TTimer = new Timer(new TimerCallback(TXTickTimer), autoEvent, 0, wait_datarate); - while (statics.running) { bool wait = true; @@ -352,7 +344,7 @@ namespace oscardata wait = false; } - if(statics.PBfifousage < 2) + if(statics.PBfifousage < 3) { // we need to send more payload data if (uq_tx.Count() > 0) @@ -373,13 +365,6 @@ namespace oscardata udpc.Send(b, b.Length, ip, port); } - static void TXTickTimer(object stateInfo) - { - autoEvent = (AutoResetEvent)stateInfo; - - autoEvent.Set(); - } - // send a Byte array via UDP // this function can be called from anywhere in the program // it transfers the data to the udp-tx thread via a thread-safe pipe