开云体育

ctrl + shift + ? for shortcuts
© 2025 开云体育

Re: frequency correction #tinysa


 

You can get a better frequency estimate for a marker that is set to "Tracking the peak". I modified this bit with some extra code to estimate the actual carrier frequency ..

=========
sa_core.c line 2070

????? while (m < MARKERS_MAX)
????? {
??????? if (markers[m].enabled && markers[m].mtype & M_TRACKING)
??????? {?? // Available marker found
????????? markers[m].index = max_index[i];
????????? markers[m].frequency = frequencies[markers[m].index];

????????? { // calculate the predicted frequency - OneOfEleven .. parabolic method (their are other methods)
??????????? const int idx????????? = markers[m].index;
??????????? if (idx > 0 && idx < sweep_points)
??????????? {
????????????? const float y1???????? = actual_t[idx - 1];
????????????? const float y2???????? = actual_t[idx + 0];
????????????? const float y3???????? = actual_t[idx + 1];
????????????? const float d????????? = 0.5f * (y1 - y3) / ((y1 - (2 * y2) + y3) + 1e-12f);
????????????? //const float bin????? = (float)idx + d;
????????????? const int32_t delta_Hz = abs((int64_t)frequencies[idx + 0] - frequencies[idx + 1]);
????????????? markers[m].frequency?? += (int32_t)(delta_Hz * d);
??????????? }
????????? }

????????? m++;
????????? break;????????????????????????? // Next maximum
??????? }
??????? m++;????????????????????????????? // Try next marker
????? }
????? i++;

=========

It doesn't yet use the calculated carrier frequency on my TinySA that this calculates as the display is still getting it from the frequencies[] array rather than the marker[].frequency value. I'll leave that to Erik if he so wishes to use the code.

But this would display a more accurate frequency that simply using the spot frequency from the frequencies[] array.

Join [email protected] to automatically receive all group messages.