mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-21 13:05:43 -05:00
#2212 Introduce carrier offset measurement processor to monitor a 12.5 kHz channel and provide estimated carrier offset measurements that allow the tuner's frequency error monitor to correct for the average error reported from each channel. Uses a 15 dB threshold where the signal must be at least 15 dB above the noise floor before it will calculate and broadcast the estimate. Stores the updated PPM in the tuner configuration after each update to ensure the value persists across sessions. When selected in the tuner panel, updates the displayed PPM value after each PPM autocorrection. (#2218)
Co-authored-by: Dennis Sheirer <dsheirer@github.com>
This commit is contained in:
@@ -38,7 +38,42 @@ public record ComplexSamples(float[] i, float[] q, long timestamp)
|
||||
interleaved[2 * x + 1] = q()[x];
|
||||
}
|
||||
|
||||
return new InterleavedComplexSamples(interleaved, System.currentTimeMillis());
|
||||
return new InterleavedComplexSamples(interleaved, timestamp());
|
||||
}
|
||||
|
||||
/**
|
||||
* Length of complex samples available in this buffer.
|
||||
* @return sample count.
|
||||
*/
|
||||
public int length()
|
||||
{
|
||||
return i().length;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts an interleaved buffer of specified count of complex samples starting at the specified offset
|
||||
* @param offset into the I or Q sample array
|
||||
* @param length of complex samples.
|
||||
* @return interleaved complex samples with an array length that is twice as long as the requested length.
|
||||
* @throws ArrayIndexOutOfBoundsException if the requested offset + length exceeds the sample count.
|
||||
*/
|
||||
public InterleavedComplexSamples toInterleaved(int offset, int length)
|
||||
{
|
||||
if(offset + length > i().length)
|
||||
{
|
||||
throw new ArrayIndexOutOfBoundsException("Offset [" + offset + "] length [" + length +
|
||||
"] out of bounds for length [" + i().length + "]");
|
||||
}
|
||||
|
||||
float[] interleaved = new float[length * 2];
|
||||
|
||||
for(int x = 0; x < length; x++)
|
||||
{
|
||||
interleaved[2 * x] = i()[offset + x];
|
||||
interleaved[2 * x + 1] = q()[offset + x];
|
||||
}
|
||||
|
||||
return new InterleavedComplexSamples(interleaved, timestamp());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user