mirror of
https://github.com/radio95-rnt/rds95.git
synced 2026-02-26 20:33:53 +01:00
add some dps things and run at ratio 14
This commit is contained in:
2
.vscode/.server-controller-port.log
vendored
2
.vscode/.server-controller-port.log
vendored
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"port": 13452,
|
||||
"time": 1742173957327,
|
||||
"time": 1742230721693,
|
||||
"version": "0.0.3"
|
||||
}
|
||||
@@ -6,7 +6,10 @@ import io, os
|
||||
if PLOT: import matplotlib.pyplot as plt
|
||||
if FFT: import numpy as np # Import numpy for FFT
|
||||
|
||||
sample_rate = 11875
|
||||
ratio = 14
|
||||
sample_rate = 1187.5*ratio
|
||||
print(f"{sample_rate=}")
|
||||
if not sample_rate.is_integer(): raise ValueError("Need a even value")
|
||||
|
||||
# this is modified from ChristopheJacquet's pydemod
|
||||
def rrcosfilter(NumSamples):
|
||||
|
||||
31
src/rds.c
31
src/rds.c
@@ -182,6 +182,7 @@ static uint16_t get_next_af(RDSEncoder* enc) {
|
||||
// #region Group encoding
|
||||
static void get_rds_ps_group(RDSEncoder* enc, uint16_t *blocks) {
|
||||
uint8_t dps1_on = (enc->data[enc->program].dps1_enabled && enc->data[enc->program].dps1_len != 0);
|
||||
uint8_t dps2_on = (enc->data[enc->program].dps2_enabled && enc->data[enc->program].dps2_len != 0);
|
||||
if(enc->state[enc->program].ps_csegment == 0) {
|
||||
if(enc->state[enc->program].ps_update && !dps1_on) {
|
||||
memcpy(enc->state[enc->program].ps_text, enc->data[enc->program].ps, PS_LENGTH);
|
||||
@@ -199,6 +200,12 @@ static void get_rds_ps_group(RDSEncoder* enc, uint16_t *blocks) {
|
||||
enc->state[enc->program].dps1_repeat_count = 0;
|
||||
}
|
||||
|
||||
if(enc->state[enc->program].dps2_update && dps2_on) {
|
||||
memcpy(enc->state[enc->program].dps2_text, enc->data[enc->program].dps2, DPS_LENGTH);
|
||||
enc->state[enc->program].dps2_update = 0;
|
||||
enc->state[enc->program].dps2_repeat_count = 0;
|
||||
}
|
||||
|
||||
if(dps1_on) {
|
||||
if(enc->state[enc->program].dynamic_ps_state == 0) {
|
||||
memcpy(enc->state[enc->program].ps_text, enc->data[enc->program].ps, PS_LENGTH);
|
||||
@@ -210,15 +217,21 @@ static void get_rds_ps_group(RDSEncoder* enc, uint16_t *blocks) {
|
||||
}
|
||||
} else {
|
||||
if(enc->data[enc->program].dps1_len > PS_LENGTH) {
|
||||
switch(enc->data[enc->program].dps1_mode) {
|
||||
case 0:
|
||||
memcpy(enc->state[enc->program].ps_text, &(enc->state[enc->program].dps1_text[enc->state[enc->program].dynamic_ps_position]), PS_LENGTH);
|
||||
enc->state[enc->program].dynamic_ps_position += PS_LENGTH;
|
||||
break;
|
||||
case 1:
|
||||
memcpy(enc->state[enc->program].ps_text, &(enc->state[enc->program].dps1_text[enc->state[enc->program].dynamic_ps_position]), PS_LENGTH);
|
||||
enc->state[enc->program].dynamic_ps_position++;
|
||||
break;
|
||||
uint8_t scroll_threshold = (enc->data[enc->program].dps1_mode == 0) ? 8 : 6;
|
||||
|
||||
if(enc->state[enc->program].dynamic_ps_scroll_counter >= scroll_threshold) {
|
||||
switch(enc->data[enc->program].dps1_mode) {
|
||||
case 0:
|
||||
memcpy(enc->state[enc->program].ps_text, &(enc->state[enc->program].dps1_text[enc->state[enc->program].dynamic_ps_position]), PS_LENGTH);
|
||||
enc->state[enc->program].dynamic_ps_position += PS_LENGTH;
|
||||
break;
|
||||
case 1:
|
||||
memcpy(enc->state[enc->program].ps_text, &(enc->state[enc->program].dps1_text[enc->state[enc->program].dynamic_ps_position]), PS_LENGTH);
|
||||
enc->state[enc->program].dynamic_ps_position++;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
enc->state[enc->program].dynamic_ps_scroll_counter++;
|
||||
}
|
||||
|
||||
if(enc->state[enc->program].dynamic_ps_position >= enc->data[enc->program].dps1_len) {
|
||||
|
||||
12
src/rds.h
12
src/rds.h
@@ -10,10 +10,10 @@
|
||||
|
||||
#define GROUP_LENGTH 4
|
||||
#define BITS_PER_GROUP (GROUP_LENGTH * (BLOCK_SIZE + POLY_DEG))
|
||||
// when i say ratio 10, i mean 1187.5*10
|
||||
#define RDS_SAMPLE_RATE 11875 // pira's m32 works at 361 khz, which is a ratio of 304, but this does a ratio of 10, while the m232 does a ratio of about 500
|
||||
#define SAMPLES_PER_BIT 10 // (1/1187.5)*RDS_SAMPLE_RATE or RDS_SAMPLE_RATE/1187.5, to check you can do (1187.5*SAMPLES_PER_BIT)=(RDS_SAMPLE_RATE)
|
||||
#define FILTER_SIZE 40
|
||||
// Higher sample rate makes you more synchronized so you stay at the 11.4 GPS (group per sec) but lesser sample rate gives a smaller amount of cpu usage
|
||||
#define RDS_SAMPLE_RATE 16625 // pira's m32 works at 361 khz, which is a ratio of 304, but this does a ratio of 14, while the m232 does a ratio of about 500
|
||||
#define SAMPLES_PER_BIT 14 // this would be your ratio
|
||||
#define FILTER_SIZE 84
|
||||
#define SAMPLE_BUFFER_SIZE (SAMPLES_PER_BIT + FILTER_SIZE)
|
||||
|
||||
#define RT_LENGTH 64
|
||||
@@ -154,13 +154,17 @@ typedef struct {
|
||||
uint8_t ps_csegment : 4;
|
||||
|
||||
uint8_t dps1_update : 1;
|
||||
uint8_t dps2_update : 1;
|
||||
char dps1_text[DPS_LENGTH];
|
||||
char dps1_nexttext[127];
|
||||
char dps2_text[DPS_LENGTH];
|
||||
uint8_t dps1_repeat_count : 7;
|
||||
uint8_t dps2_repeat_count : 7;
|
||||
uint8_t static_ps_period : 4;
|
||||
uint8_t dynamic_ps_period : 4;
|
||||
uint8_t dynamic_ps_position : 4;
|
||||
uint8_t dynamic_ps_state : 2;
|
||||
uint8_t dynamic_ps_scroll_counter : 7;
|
||||
|
||||
char rt_text[RT_LENGTH];
|
||||
uint8_t rt_state : 5;
|
||||
|
||||
@@ -6,5 +6,5 @@
|
||||
Released under the GNU GPL v3 license.
|
||||
*/
|
||||
|
||||
float waveform_biphase[40] = {0.001428519781289772, 0.0016664760371696286, -0.0007489747210579489, -0.002879473467708782, -0.00106869603307147, 0.003402376491623338, 0.004197098675717825, -0.0020108774820242203, -0.008325008325008265, -0.003370279435959911, 0.011902549863605172, 0.016661972622002308, -0.009354493372215611, -0.04761904761904756, -0.02565484871607826, 0.14035864022832323, 0.4612061004721879, 0.817876195033512, 1.0, 0.8360849414906586, 0.3268491412309902, -0.3268491412309902, -0.8360849414906588, -1.0, -0.817876195033512, -0.461206100472188, -0.14035864022832323, 0.02565484871607837, 0.04761904761904745, 0.009354493372215611, -0.016661972622002308, -0.011902549863605172, 0.0033702794359598, 0.008325008325008376, 0.0020108774820242203, -0.004197098675717825, -0.003402376491623449, 0.00106869603307147, 0.002879473467708893, 0.00074897472105806};
|
||||
float waveform_biphase[84] = {0.0004798810307378165, 0.0005158464188224077, 0.00013719954366608889, -0.00041476999846934426, -0.0007191892775416653, -0.0004857966171196715, 0.00018825494724739045, 0.0008295842549825849, 0.0009051529485941678, 0.0002445671263298088, -0.000751794191973798, -0.0013268465280850128, -0.0009132708722269234, 0.0003610677822902808, 0.001625489447084183, 0.0018145689052271319, 0.0005024534563098371, -0.001585786352611529, -0.002879473467708782, -0.0020438605658038567, 0.000835500801372735, 0.00390082480083076, 0.004531695189377238, 0.001311093111172612, -0.004343673377232293, -0.008325008325008265, -0.006278010462553496, 0.0027481739441221897, 0.013873333089300166, 0.01763827184078881, 0.005671482599529876, -0.021310188015785658, -0.04761904761904767, -0.04356053386843084, 0.024589602704327973, 0.17800990857960053, 0.4089809815715042, 0.6732730423553916, 0.8973021064512403, 1.0, 0.9222744610899845, 0.6523476952736391, 0.23572259472961843, -0.23572259472961843, -0.6523476952736391, -0.9222744610899845, -1.0, -0.8973021064512402, -0.6732730423553918, -0.4089809815715043, -0.17800990857960053, -0.024589602704327973, 0.04356053386843084, 0.04761904761904767, 0.02131018801578577, -0.005671482599529876, -0.01763827184078881, -0.013873333089300166, -0.0027481739441221897, 0.006278010462553496, 0.008325008325008376, 0.004343673377232404, -0.001311093111172501, -0.004531695189377238, -0.003900824800830649, -0.000835500801372846, 0.0020438605658037456, 0.002879473467708893, 0.00158578635261164, -0.000502453456309726, -0.0018145689052271319, -0.001625489447084072, -0.0003610677822902808, 0.0009132708722270344, 0.0013268465280849018, 0.000751794191973687, -0.0002445671263296978, -0.0009051529485940568, -0.0008295842549824739, -0.00018825494724750147, 0.0004857966171196715, 0.0007191892775417763, 0.00041476999846934426, -0.0001371995436661999};
|
||||
|
||||
|
||||
@@ -6,4 +6,4 @@
|
||||
Released under the GNU GPL v3 license.
|
||||
*/
|
||||
|
||||
extern float waveform_biphase[40];
|
||||
extern float waveform_biphase[84];
|
||||
|
||||
Reference in New Issue
Block a user