/*! The nominal baud or symbol rate */
#define BAUD_RATE 2400
/*! The adaption rate coefficient for the equalizer during initial training */
-#define EQUALIZER_DELTA 0.21f
-/*! The adaption rate coefficient for the equalizer during continuous fine tuning */
-#define EQUALIZER_SLOW_ADAPT_RATIO 0.1f
+#define EQUALIZER_FAST_ADAPTION_DELTA (0.21f/V17_EQUALIZER_LEN)
+/*! The adaption rate coefficient for the equalizer during fine tuning */
+#define EQUALIZER_SLOW_ADAPTION_DELTA (0.1f*EQUALIZER_FAST_ADAPTION_DELTA)
/* Segments of the training sequence */
/*! The length of training segment 1, in symbols */
#if defined(SPANDSP_USE_FIXED_POINTx)
cvec_copyi16(s->eq_coeff, s->eq_coeff_save, V17_EQUALIZER_LEN);
cvec_zeroi16(s->eq_buf, V17_EQUALIZER_LEN);
- s->eq_delta = 32768.0f*EQUALIZER_SLOW_ADAPT_RATIO*EQUALIZER_DELTA/V17_EQUALIZER_LEN;
+ s->eq_delta = 32768.0f*EQUALIZER_SLOW_ADAPTION_DELTA;
#else
cvec_copyf(s->eq_coeff, s->eq_coeff_save, V17_EQUALIZER_LEN);
cvec_zerof(s->eq_buf, V17_EQUALIZER_LEN);
- s->eq_delta = EQUALIZER_SLOW_ADAPT_RATIO*EQUALIZER_DELTA/V17_EQUALIZER_LEN;
+ s->eq_delta = EQUALIZER_SLOW_ADAPTION_DELTA;
#endif
s->eq_put_step = RX_PULSESHAPER_COEFF_SETS*10/(3*2) - 1;
cvec_zeroi16(s->eq_coeff, V17_EQUALIZER_LEN);
s->eq_coeff[V17_EQUALIZER_PRE_LEN] = x;
cvec_zeroi16(s->eq_buf, V17_EQUALIZER_LEN);
- s->eq_delta = 32768.0f*EQUALIZER_DELTA/V17_EQUALIZER_LEN;
+ s->eq_delta = 32768.0f*EQUALIZER_FAST_ADAPTION_DELTA;
#else
static const complexf_t x = {FP_CONSTELLATION_SCALE(3.0f), FP_CONSTELLATION_SCALE(0.0f)};
cvec_zerof(s->eq_coeff, V17_EQUALIZER_LEN);
s->eq_coeff[V17_EQUALIZER_PRE_LEN] = x;
cvec_zerof(s->eq_buf, V17_EQUALIZER_LEN);
- s->eq_delta = EQUALIZER_DELTA/V17_EQUALIZER_LEN;
+ s->eq_delta = EQUALIZER_FAST_ADAPTION_DELTA;
#endif
s->eq_put_step = RX_PULSESHAPER_COEFF_SETS*10/(3*2) - 1;
/* A little integration will now filter away much of the HF noise */
s->baud_phase -= p;
v = labs(s->baud_phase);
- if (v > FP_SYNC_SCALE_32(100.0f))
- {
- i = (v > FP_SYNC_SCALE_32(1000.0f)) ? 15 : 1;
- if (s->baud_phase < FP_SYNC_SCALE_32(0.0f))
- i = -i;
- //printf("v = %10.5f %5d - %f %f %d %d\n", v, i, p, s->baud_phase, s->total_baud_timing_correction);
- s->eq_put_step += i;
- s->total_baud_timing_correction += i;
- }
#else
/* Cross correlate */
v = s->symbol_sync_low[1]*s->symbol_sync_high[0]*SYNC_LOW_BAND_EDGE_COEFF_2
/* A little integration will now filter away much of the HF noise */
s->baud_phase -= p;
v = fabsf(s->baud_phase);
+#endif
if (v > FP_SYNC_SCALE_32(100.0f))
{
i = (v > FP_SYNC_SCALE_32(1000.0f)) ? 15 : 1;
s->eq_put_step += i;
s->total_baud_timing_correction += i;
}
-#endif
}
/*- End of function --------------------------------------------------------*/
out is the phase. */
/* Check if we just saw A or B */
/* atan(1/3) = 18.433 degrees */
- if ((uint32_t) (angle - s->last_angles[0]) < 0x80000000U)
+ if ((uint32_t) (angle - s->last_angles[0]) < (uint32_t) DDS_PHASE(180.0f))
{
angle = s->last_angles[0];
s->last_angles[0] = DDS_PHASE(270.0f + 18.433f);
{
/* Now the equaliser adaption should be getting somewhere, slow it down, or it will never
tune very well on a noisy signal. */
- s->eq_delta *= EQUALIZER_SLOW_ADAPT_RATIO;
+ s->eq_delta = EQUALIZER_SLOW_ADAPTION_DELTA;
#if defined(SPANDSP_USE_FIXED_POINTx)
s->carrier_track_i = 1000;
#else
{
if (++s->low_samples > 120)
{
- power_meter_init(&(s->power), 4);
+ power_meter_init(&s->power, 4);
s->high_sample = 0;
s->low_samples = 0;
}
s->trellis_ptr = 14;
s->carrier_phase = 0;
- power_meter_init(&(s->power), 4);
+ power_meter_init(&s->power, 4);
if (s->short_train)
{