From e810245caab40660a6000de24c0ab52595c4af36 Mon Sep 17 00:00:00 2001 From: Matthew Carroll Date: Fri, 11 Sep 2026 02:20:10 -0700 Subject: [PATCH] lf t55xx detect: save and restore the graph buffer through the shared helpers The psk antenna-settle trim open-coded the save/restore pair: save_bufferS32 plus g_GridOffset on the way in, and restore_bufferS32's return assigned to g_GraphTraceLen on the way out. graph.c now has save_graphbuffer and restore_graphbuffer, which hold contents, length and grid offset together, so call those and drop the local copy of the length contract. No behaviour change. `lf t55xx detect -1` on the in-tree psk traces leaves the graph at 20000 samples before and after. Co-Authored-By: Claude Opus 5 --- client/src/cmdlft55xx.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/client/src/cmdlft55xx.c b/client/src/cmdlft55xx.c index eb1006e90..67669749b 100644 --- a/client/src/cmdlft55xx.c +++ b/client/src/cmdlft55xx.c @@ -111,8 +111,7 @@ static void t55xx_record_hit(t55xx_conf_block_t *t) { // skip first 160 samples to allow antenna to settle in (psk gets inverted occasionally otherwise) static buffer_savestate_t t55xx_psk_trim_head(void) { - buffer_savestate_t st = save_bufferS32(g_GraphBuffer, g_GraphTraceLen); - st.offset = g_GridOffset; + buffer_savestate_t st = save_graphbuffer(); char ltrim[16]; snprintf(ltrim, sizeof(ltrim), "-i %d", T55XX_PSK_SETTLE_TRIM); @@ -124,9 +123,7 @@ static buffer_savestate_t t55xx_psk_trim_head(void) { static void t55xx_psk_untrim_head(buffer_savestate_t st) { s_sample_bias = 0; - // restore_bufferS32 returns the length it put back; dropping it leaves the trim in place - g_GraphTraceLen = restore_bufferS32(st, g_GraphBuffer); - g_GridOffset = st.offset; + restore_graphbuffer(st); } // the bit offset to read a block at in the demod buffer loaded right now