some changes in code, optional

This commit is contained in:
Kuba 2023-10-28 18:02:34 +00:00
parent 3ead6f0209
commit 9dad264e92
1 changed files with 4 additions and 15 deletions

View File

@ -24,12 +24,6 @@ extern "C"
#include <librpitx/librpitx.h> #include <librpitx/librpitx.h>
ngfmdmasync *fmmod; ngfmdmasync *fmmod;
// The deviation specifies how wide the signal is.
// Use 75kHz for WFM (broadcast radio)
// and about 2.5kHz for NFM (walkie-talkie style radio)
//#define DEVIATION 75000
//FOR NFM
//#define DEVIATION 2500
static volatile uint32_t *pad_reg; static volatile uint32_t *pad_reg;
#define GPIO_PAD_0_27 (0x2C/4) #define GPIO_PAD_0_27 (0x2C/4)
#define GPIO_PAD_28_45 (0x30/4) #define GPIO_PAD_28_45 (0x30/4)
@ -164,6 +158,10 @@ int tx(uint32_t carrier_freq, char *audio_file, uint16_t pi, char *ps, char *rt,
float deviation_scale_factor; float deviation_scale_factor;
//if( divider ) // PLL modulation //if( divider ) // PLL modulation
{ // note samples are [-10:10] { // note samples are [-10:10]
// The deviation specifies how wide the signal is (from its lowest bandwidht to its highest).
// Use 75kHz for WFM (broadcast radio, or 50khz can be used)
// and about 2.5kHz for NFM (walkie-talkie style radio)
deviation_scale_factor= 0.1 * (deviation ) ; // todo PPM deviation_scale_factor= 0.1 * (deviation ) ; // todo PPM
} }
@ -230,7 +228,6 @@ int main(int argc, char **argv) {
int alternative_freq[100] = {}; int alternative_freq[100] = {};
float ppm = 0; float ppm = 0;
int bypassfreqrange = 0; int bypassfreqrange = 0;
int custom_deviation = 0;
float cutofffreq = 15700; float cutofffreq = 15700;
// Parse command-line arguments // Parse command-line arguments
for(int i=1; i<argc; i++) { for(int i=1; i<argc; i++) {
@ -282,13 +279,10 @@ int main(int argc, char **argv) {
control_pipe = param; control_pipe = param;
} else if(strcmp("-deviation", arg)==0 && param != NULL) { } else if(strcmp("-deviation", arg)==0 && param != NULL) {
i++; i++;
custom_deviation = 1;
if(strcmp("ukf", param)==0) { if(strcmp("ukf", param)==0) {
deviation = 65000; //i don't know the original bandwidht, but when testing on an UNITRA LIZA R-203, the sound doesn't sound out of order, correct this if im wrong deviation = 65000; //i don't know the original bandwidht, but when testing on an UNITRA LIZA R-203, the sound doesn't sound out of order, correct this if im wrong
} else if(strcmp("nfm", param)==0) { } else if(strcmp("nfm", param)==0) {
deviation = 2500; deviation = 2500;
drds = 1;
custom_deviation = 2;
} }
else { else {
deviation = atoi(param); deviation = atoi(param);
@ -339,11 +333,6 @@ int main(int argc, char **argv) {
" [-ps ps_text] [-rt rt_text] [-ctl control_pipe] [-pty program_type] [-raw play raw audio from stdin] [-disablerds] [-af alt freq] [-preemphasis us] [-rawchannels when using the raw option you can change this] [-rawsamplerate same business] [-deviation the deviation, default is 75000, there are 2 predefined other cases: ukf (for old radios such as the UNITRA Jowita), nfm] [-tp] [-ta]\n", arg); " [-ps ps_text] [-rt rt_text] [-ctl control_pipe] [-pty program_type] [-raw play raw audio from stdin] [-disablerds] [-af alt freq] [-preemphasis us] [-rawchannels when using the raw option you can change this] [-rawsamplerate same business] [-deviation the deviation, default is 75000, there are 2 predefined other cases: ukf (for old radios such as the UNITRA Jowita), nfm] [-tp] [-ta]\n", arg);
} }
} }
if(custom_deviation == 1 && drds == 0) {
printf("You've set a custom deviation (like not the default one), the RDS may be broken, just a warning\n");
} else if(custom_deviation == 2) { //there came the reason, if you dont know why this is here, dont ask
printf("RDS is gonna be disabled for NFM, because you know, nothing will decode the rds from a nfm signal anyway\n");
}
alternative_freq[0] = af_size; alternative_freq[0] = af_size;
int FifoSize=DATA_SIZE*2; int FifoSize=DATA_SIZE*2;
fmmod=new ngfmdmasync(carrier_freq,228000,14,FifoSize, false, gpiopin); fmmod=new ngfmdmasync(carrier_freq,228000,14,FifoSize, false, gpiopin);