Skip to content

Commit

Permalink
Add an easy menu for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
F5OEO committed Nov 1, 2018
1 parent 550eaab commit a8b7756
Show file tree
Hide file tree
Showing 4 changed files with 93 additions and 10 deletions.
32 changes: 32 additions & 0 deletions easytest.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash
status="0"
while [ "$status" -eq 0 ]
do

menuchoice=$(whiptail --title "Rpitx on 434Mhz" --menu "Choose your test, ctrl^c to end a test" 16 82 8 \
"0 Tune" "Carrier" \
"1 Chirp" "Moving carrier" \
"2 Spectrum" "Spectrum painting" \
"3 FmRds" "Broadcast modulation with RDS" \
"4 SSB" "USB modulation" \
"5 SSTV" "Patern picture" \
"6 Opera" "Like morse but need Opera decoder" \
"7 Pocsag" "Pager message" \
"8 FreeDV" "Digital voice mode 800XA" \
3>&2 2>&1 1>&3)

case "$menuchoice" in
0\ *) "./testvfo.sh" >/dev/null 2>/dev/null ;;
1\ *) "./testchirp.sh" >/dev/null 2>/dev/null ;;
2\ *) "./testspectrum.sh" >/dev/null 2>/dev/null ;;
3\ *) "./testfmrds.sh" >/dev/null 2>/dev/null ;;
4\ *) "./testssb.sh" >/dev/null 2>/dev/null ;;
5\ *) "./testsstv.sh" >/dev/null 2>/dev/null ;;
6\ *) "./testopera.sh" >/dev/null 2>/dev/null ;;
7\ *) "./testpocsag.sh" >/dev/null 2>/dev/null ;;
8\ *) "./testfreedv.sh" >/dev/null 2>/dev/null ;;
*) status=1;;
esac

done
exit
25 changes: 21 additions & 4 deletions src/opera/opera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,17 @@
//#include <locale.h>
//#include <tchar.h>
#include "stdio.h"
#include "string.h"
#include "cstring"
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include "stdint.h"
#include "math.h"
#include <signal.h>
#include <unistd.h>
#include "../librpitx/src/librpitx.h"

bool running=true;
//#define __VCpp__ TRUE

// Grobal Variables
Expand Down Expand Up @@ -137,6 +138,14 @@ int _tmain(int argc, _TCHAR* argv[])
return 0;
} // end of _tmain

static void
terminate(int num)
{
running=false;
fprintf(stderr,"Caught signal - Terminating %x\n",num);

}

//*******************
void genn_opera(float mode)
//*******************
Expand Down Expand Up @@ -165,7 +174,15 @@ void genn_opera(float mode)
print_short_int("symbol_interleaving =", symbol_interleaving, 119);

ManchesterEncode(symbol_interleaving, symbol);
//print_short_int("symbol =", symbol, 239);

for (int i = 0; i < 64; i++) {
struct sigaction sa;

std::memset(&sa, 0, sizeof(sa));
sa.sa_handler = terminate;
sigaction(i, &sa, NULL);
}

encodepitx(symbol,239,mode);

} // genn_opera
Expand Down Expand Up @@ -451,7 +468,7 @@ with the Opera frequency recommendation: */
int FifoSize=512;
amdmasync amtest(Frequency,SR,14,FifoSize);
int count=0;
for (int i = 0; i < length-1; )
for (int i = 0; (i < length-1)&&(running==true); )
{
int Available=amtest.GetBufferAvailable();
if(Available>FifoSize/2)
Expand Down
24 changes: 20 additions & 4 deletions src/spectrumpaint/spectrum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <cstring>
#include <errno.h>
#include <stdarg.h>
#include <stdint.h>
Expand All @@ -22,7 +22,7 @@ int FileFreqTiming;
iqdmasync *fmmod;
static double GlobalTuningFrequency=00000.0;
int FifoSize=35000;

bool running=true;

void ProcessPicture(float Excursion)
{
Expand All @@ -36,7 +36,7 @@ void ProcessPicture(float Excursion)

//while(1)
{
while(EndOfPicture==0)
while((EndOfPicture==0)&&(running==true))
{
NbRead=read(FilePicture,Line,320);
if(NbRead!=320) EndOfPicture=1;
Expand All @@ -57,6 +57,14 @@ void ProcessPicture(float Excursion)
}
}

static void
terminate(int num)
{
running=false;
fprintf(stderr,"Caught signal - Terminating %x\n",num);

}


int main(int argc, char **argv)
{
Expand All @@ -78,7 +86,15 @@ int main(int argc, char **argv)
printf("usage : spectrum picture.rgb frequency(Hz) Excursion(Hz)\n");
exit(0);
}


for (int i = 0; i < 64; i++) {
struct sigaction sa;

std::memset(&sa, 0, sizeof(sa));
sa.sa_handler = terminate;
sigaction(i, &sa, NULL);
}

fmmod=new iqdmasync(frequency,10000,14,FifoSize,MODE_FREQ_A);
ProcessPicture(Excursion);
close(FilePicture);
Expand Down
22 changes: 20 additions & 2 deletions src/sstv/pisstv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <cstring>
#include <errno.h>
#include <stdarg.h>
#include <stdint.h>
Expand All @@ -14,6 +14,7 @@
#include <fcntl.h>
#include <sys/mman.h>


#include "../librpitx/src/librpitx.h"

int FilePicture;
Expand All @@ -22,6 +23,7 @@ int FileFreqTiming;
ngfmdmasync *fmmod;
static double GlobalTuningFrequency=00000.0;
int FifoSize=10000; //10ms
bool running=true;

void playtone(double Frequency,uint32_t Timing)//Timing in 0.1us
{
Expand Down Expand Up @@ -122,7 +124,7 @@ void ProcessMartin1()

addvisheader();
addvistrailer();
while(EndOfPicture==0)
while((EndOfPicture==0)&&(running==true))
{
NbRead=read(FilePicture,Line,320*3);
if(NbRead!=320*3) EndOfPicture=1;
Expand Down Expand Up @@ -157,6 +159,14 @@ void ProcessMartin1()
}


static void
terminate(int num)
{
running=false;
fprintf(stderr,"Caught signal - Terminating %x\n",num);

}

int main(int argc, char **argv)
{
float frequency=144.5e6;
Expand All @@ -174,6 +184,14 @@ int main(int argc, char **argv)
exit(0);
}

for (int i = 0; i < 64; i++) {
struct sigaction sa;

std::memset(&sa, 0, sizeof(sa));
sa.sa_handler = terminate;
sigaction(i, &sa, NULL);
}

fmmod=new ngfmdmasync(frequency,100000,14,FifoSize);
ProcessMartin1();
close(FilePicture);
Expand Down

0 comments on commit a8b7756

Please sign in to comment.