mirror of
https://github.com/NawfalMotii79/PLFM_RADAR.git
synced 2026-06-13 17:01:17 +00:00
fix(mcu): PR-AB.a — move vector_0 out of inner beam_pos loop
runRadarPulseSequence used to fire vector_0 (broadside reference) between every matrix1 and matrix2 pattern, i.e. 15 times per azimuth. That dwell × 8 ms × 15 = 120 ms per azimuth × 50 azimuths = ~6 s of the 18.4 s revisit time was burned on redundant broadside frames. Pull vector_0 out of the loop and fire it once per azimuth before the sweep. Each azimuth now produces 1 broadside frame + 30 steered frames (matrix1 + matrix2 across 15 beam_pos), down from 15 + 30 = 45 frames. Revisit time drops from 18.4 s to ~12.8 s (31% improvement). If multiple per-position broadside frames are ever needed, gate them behind a runtime switch — the comment block flags this. test_bug16_runradar_shadows_globals updated to mirror the new 1-outside + 2-inside m-counter pattern; 13/13 PASS, full MCU regression 51/0 + 34/0.
This commit is contained in:
@@ -59,13 +59,20 @@ static void run_buggy(void)
|
||||
(void)m; (void)n; (void)y;
|
||||
}
|
||||
|
||||
/* Post-fix: same body, no local redeclaration — references globals. */
|
||||
/* Post-fix: same body, no local redeclaration — references globals.
|
||||
* PR-AB.a moved vector_0 out of the inner loop, so the m advance is now
|
||||
* 1 (vector_0, before loop) + 2 × 15 (matrix1+matrix2 in loop) = 31 increments
|
||||
* per azimuth, instead of the prior 3 × 15 = 45. The wrap behavior
|
||||
* (g_m wraps on every iteration's matrix2 add) is unchanged. */
|
||||
static void run_fixed(void)
|
||||
{
|
||||
/* PR-AB.a: vector_0 broadside reference, 1× per azimuth (was inside loop). */
|
||||
g_m += m_max / 2;
|
||||
if (g_m > m_max) g_m = 1;
|
||||
|
||||
for (int beam_pos = 0; beam_pos < 15; beam_pos++) {
|
||||
g_m += m_max / 2;
|
||||
g_m += m_max / 2;
|
||||
g_m += m_max / 2;
|
||||
g_m += m_max / 2; /* matrix1 (negative-θ scan) */
|
||||
g_m += m_max / 2; /* matrix2 (positive-θ scan) */
|
||||
if (g_m > m_max) g_m = 1;
|
||||
|
||||
g_n++;
|
||||
|
||||
Reference in New Issue
Block a user