From 64d2e435928ed0b74a779d07e8fda56f808f85cf Mon Sep 17 00:00:00 2001 From: Philippe Teuwen Date: Fri, 13 Sep 2019 00:36:25 +0200 Subject: [PATCH] CmdFSKsimTAG: avoid padding with very short cycles, this confused lf io sim --- armsrc/lfops.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/armsrc/lfops.c b/armsrc/lfops.c index 3277100b0..b535e155a 100644 --- a/armsrc/lfops.c +++ b/armsrc/lfops.c @@ -941,7 +941,7 @@ static void fcSTT(int *n) { } // compose fc/X fc/Y waveform (FSKx) -static void fcAll(uint8_t fc, int *n, uint8_t clock, uint16_t *modCnt) { +static uint8_t fcAll(uint8_t fc, int *n, uint8_t clock, uint16_t *modCnt) { uint8_t *dest = BigBuf_get_addr(); uint8_t halfFC = fc >> 1; uint8_t wavesPerClock = clock / fc; @@ -966,12 +966,15 @@ static void fcAll(uint8_t fc, int *n, uint8_t clock, uint16_t *modCnt) { *n += fc; } } +/* This code interfers with FSK2 and I don't see any example of FSK1 simulation in the code... if (!modAdjOk) { //fsk1 memset(dest + (*n), 0, mod - (mod >> 1)); memset(dest + (*n) + (mod - (mod >> 1)), 1, mod >> 1); *n += mod; } +*/ } + return mod; } // prepare a waveform pattern in the buffer based on the ID given then @@ -1059,17 +1062,17 @@ void CmdFSKsimTAG(uint8_t fchigh, uint8_t fclow, uint8_t separator, uint8_t clk, int n = 0, i = 0; uint16_t modCnt = 0; + uint8_t mod = 0; if (separator) { //int fsktype = ( fchigh == 8 && fclow == 5) ? 1 : 2; //fcSTT(&n); } - for (i = 0; i < bitslen; i++) { if (bits[i]) - fcAll(fclow, &n, clk, &modCnt); + mod = fcAll(fclow, &n, clk+mod, &modCnt); else - fcAll(fchigh, &n, clk, &modCnt); + mod = fcAll(fchigh, &n, clk+mod, &modCnt); } WDT_HIT();