rename globals GraphBuffer

This commit is contained in:
Philippe Teuwen 2021-08-21 17:39:17 +02:00
parent b02fef5c70
commit f1f2389fb4
15 changed files with 107 additions and 107 deletions

View file

@ -1049,7 +1049,7 @@ static int CmdAnalyseFoo(const char *Cmd) {
if (i & 0x0E00) o |= 0x20; // corr_i_accum[12] | corr_i_accum[11] | corr_i_accum[9], if (i & 0x0E00) o |= 0x20; // corr_i_accum[12] | corr_i_accum[11] | corr_i_accum[9],
o |= (i & 0x1F0) >> 4; // corr_i_accum[8:4] o |= (i & 0x1F0) >> 4; // corr_i_accum[8:4]
GraphBuffer[i] = o; g_GraphBuffer[i] = o;
} }
for (int i = 0; i < 4095; i++) { for (int i = 0; i < 4095; i++) {
@ -1066,12 +1066,12 @@ static int CmdAnalyseFoo(const char *Cmd) {
o |= 0x7f; // corr_i_out <= 8'b01111111; o |= 0x7f; // corr_i_out <= 8'b01111111;
} }
} }
GraphBuffer[i + 5000] = o; g_GraphBuffer[i + 5000] = o;
} }
for (int i = 0; i < 4095; i++) { for (int i = 0; i < 4095; i++) {
int o = i >> 5; int o = i >> 5;
GraphBuffer[i + 10000] = o; g_GraphBuffer[i + 10000] = o;
} }
RepaintGraphWindow(); RepaintGraphWindow();

View file

@ -329,7 +329,7 @@ int CmdGetBitStream(const char *Cmd) {
CmdHpf(""); CmdHpf("");
for (uint32_t i = 0; i < GraphTraceLen; i++) { for (uint32_t i = 0; i < GraphTraceLen; i++) {
GraphBuffer[i] = (GraphBuffer[i] >= 1) ? 1 : 0; g_GraphBuffer[i] = (g_GraphBuffer[i] >= 1) ? 1 : 0;
} }
RepaintGraphWindow(); RepaintGraphWindow();
return PM3_SUCCESS; return PM3_SUCCESS;
@ -667,9 +667,9 @@ static int CmdBiphaseDecodeRaw(const char *Cmd) {
return PM3_SUCCESS; return PM3_SUCCESS;
} }
// ASK Demod then Biphase decode GraphBuffer samples // ASK Demod then Biphase decode g_GraphBuffer samples
int ASKbiphaseDemod(int offset, int clk, int invert, int maxErr, bool verbose) { int ASKbiphaseDemod(int offset, int clk, int invert, int maxErr, bool verbose) {
//ask raw demod GraphBuffer first //ask raw demod g_GraphBuffer first
uint8_t bs[MAX_DEMOD_BUF_LEN]; uint8_t bs[MAX_DEMOD_BUF_LEN];
size_t size = getFromGraphBuf(bs); size_t size = getFromGraphBuf(bs);
@ -892,7 +892,7 @@ static int CmdAutoCorr(const char *Cmd) {
return PM3_EINVARG; return PM3_EINVARG;
} }
AutoCorrelate(GraphBuffer, GraphBuffer, GraphTraceLen, window, updateGrph, true); AutoCorrelate(g_GraphBuffer, g_GraphBuffer, GraphTraceLen, window, updateGrph, true);
return PM3_SUCCESS; return PM3_SUCCESS;
} }
@ -921,9 +921,9 @@ static int CmdBitsamples(const char *Cmd) {
for (size_t j = 0; j < ARRAYLEN(got); j++) { for (size_t j = 0; j < ARRAYLEN(got); j++) {
for (uint8_t k = 0; k < 8; k++) { for (uint8_t k = 0; k < 8; k++) {
if (got[j] & (1 << (7 - k))) if (got[j] & (1 << (7 - k)))
GraphBuffer[cnt++] = 1; g_GraphBuffer[cnt++] = 1;
else else
GraphBuffer[cnt++] = 0; g_GraphBuffer[cnt++] = 0;
} }
} }
GraphTraceLen = cnt; GraphTraceLen = cnt;
@ -969,7 +969,7 @@ static int CmdDecimate(const char *Cmd) {
CLIParserFree(ctx); CLIParserFree(ctx);
for (size_t i = 0; i < (GraphTraceLen / n); ++i) for (size_t i = 0; i < (GraphTraceLen / n); ++i)
GraphBuffer[i] = GraphBuffer[i * n]; g_GraphBuffer[i] = g_GraphBuffer[i * n];
GraphTraceLen /= n; GraphTraceLen /= n;
PrintAndLogEx(SUCCESS, "decimated by " _GREEN_("%u"), n); PrintAndLogEx(SUCCESS, "decimated by " _GREEN_("%u"), n);
@ -1007,15 +1007,15 @@ static int CmdUndecimate(const char *Cmd) {
int count = 0; int count = 0;
for (count = 0; count < factor && s_index + count < MAX_GRAPH_TRACE_LEN; count++) { for (count = 0; count < factor && s_index + count < MAX_GRAPH_TRACE_LEN; count++) {
swap[s_index + count] = ( swap[s_index + count] = (
(double)(factor - count) / (factor - 1)) * GraphBuffer[g_index] + (double)(factor - count) / (factor - 1)) * g_GraphBuffer[g_index] +
((double)count / factor) * GraphBuffer[g_index + 1] ((double)count / factor) * g_GraphBuffer[g_index + 1]
; ;
} }
s_index += count; s_index += count;
g_index++; g_index++;
} }
memcpy(GraphBuffer, swap, s_index * sizeof(int)); memcpy(g_GraphBuffer, swap, s_index * sizeof(int));
GraphTraceLen = s_index; GraphTraceLen = s_index;
RepaintGraphWindow(); RepaintGraphWindow();
return PM3_SUCCESS; return PM3_SUCCESS;
@ -1040,13 +1040,13 @@ static int CmdGraphShiftZero(const char *Cmd) {
CLIParserFree(ctx); CLIParserFree(ctx);
for (size_t i = 0; i < GraphTraceLen; i++) { for (size_t i = 0; i < GraphTraceLen; i++) {
int shiftedVal = GraphBuffer[i] + shift; int shiftedVal = g_GraphBuffer[i] + shift;
if (shiftedVal > 127) if (shiftedVal > 127)
shiftedVal = 127; shiftedVal = 127;
else if (shiftedVal < -127) else if (shiftedVal < -127)
shiftedVal = -127; shiftedVal = -127;
GraphBuffer[i] = shiftedVal; g_GraphBuffer[i] = shiftedVal;
} }
CmdNorm(""); CmdNorm("");
return PM3_SUCCESS; return PM3_SUCCESS;
@ -1085,7 +1085,7 @@ static int CmdAskEdgeDetect(const char *Cmd) {
CLIParserFree(ctx); CLIParserFree(ctx);
PrintAndLogEx(INFO, "using threshold " _YELLOW_("%i"), threshold); PrintAndLogEx(INFO, "using threshold " _YELLOW_("%i"), threshold);
int res = AskEdgeDetect(GraphBuffer, GraphBuffer, GraphTraceLen, threshold); int res = AskEdgeDetect(g_GraphBuffer, g_GraphBuffer, GraphTraceLen, threshold);
RepaintGraphWindow(); RepaintGraphWindow();
return res; return res;
} }
@ -1684,7 +1684,7 @@ static int CmdHide(const char *Cmd) {
return PM3_SUCCESS; return PM3_SUCCESS;
} }
// zero mean GraphBuffer // zero mean g_GraphBuffer
int CmdHpf(const char *Cmd) { int CmdHpf(const char *Cmd) {
CLIParserContext *ctx; CLIParserContext *ctx;
CLIParserInit(&ctx, "data hpf", CLIParserInit(&ctx, "data hpf",
@ -1775,7 +1775,7 @@ int getSamplesEx(uint32_t start, uint32_t end, bool verbose) {
uint32_t j = 0; uint32_t j = 0;
for (j = 0; j * bits_per_sample < n * 8 && j < n; j++) { for (j = 0; j * bits_per_sample < n * 8 && j < n; j++) {
uint8_t sample = getByte(bits_per_sample, &bout); uint8_t sample = getByte(bits_per_sample, &bout);
GraphBuffer[j] = ((int) sample) - 127; g_GraphBuffer[j] = ((int) sample) - 127;
} }
GraphTraceLen = j; GraphTraceLen = j;
@ -1783,7 +1783,7 @@ int getSamplesEx(uint32_t start, uint32_t end, bool verbose) {
} else { } else {
for (uint32_t j = 0; j < n; j++) { for (uint32_t j = 0; j < n; j++) {
GraphBuffer[j] = ((int)got[j]) - 127; g_GraphBuffer[j] = ((int)got[j]) - 127;
} }
GraphTraceLen = n; GraphTraceLen = n;
} }
@ -1995,7 +1995,7 @@ int CmdTuneSamples(const char *Cmd) {
// even here, these values has 3% error. // even here, these values has 3% error.
uint16_t test1 = 0; uint16_t test1 = 0;
for (int i = 0; i < 256; i++) { for (int i = 0; i < 256; i++) {
GraphBuffer[i] = package->results[i] - 128; g_GraphBuffer[i] = package->results[i] - 128;
test1 += package->results[i]; test1 += package->results[i];
} }
@ -2053,7 +2053,7 @@ static int CmdLoad(const char *Cmd) {
GraphTraceLen = 0; GraphTraceLen = 0;
char line[80]; char line[80];
while (fgets(line, sizeof(line), f)) { while (fgets(line, sizeof(line), f)) {
GraphBuffer[GraphTraceLen] = atoi(line); g_GraphBuffer[GraphTraceLen] = atoi(line);
GraphTraceLen++; GraphTraceLen++;
if (GraphTraceLen >= MAX_GRAPH_TRACE_LEN) if (GraphTraceLen >= MAX_GRAPH_TRACE_LEN)
@ -2099,7 +2099,7 @@ int CmdLtrim(const char *Cmd) {
} }
for (uint32_t i = ds; i < GraphTraceLen; ++i) for (uint32_t i = ds; i < GraphTraceLen; ++i)
GraphBuffer[i - ds] = GraphBuffer[i]; g_GraphBuffer[i - ds] = g_GraphBuffer[i];
GraphTraceLen -= ds; GraphTraceLen -= ds;
g_DemodStartIdx -= ds; g_DemodStartIdx -= ds;
@ -2164,7 +2164,7 @@ static int CmdMtrim(const char *Cmd) {
GraphTraceLen = stop - start; GraphTraceLen = stop - start;
for (uint32_t i = 0; i < GraphTraceLen; i++) { for (uint32_t i = 0; i < GraphTraceLen; i++) {
GraphBuffer[i] = GraphBuffer[start + i]; g_GraphBuffer[i] = g_GraphBuffer[start + i];
} }
return PM3_SUCCESS; return PM3_SUCCESS;
@ -2188,13 +2188,13 @@ int CmdNorm(const char *Cmd) {
// Find local min, max // Find local min, max
for (uint32_t i = 10; i < GraphTraceLen; ++i) { for (uint32_t i = 10; i < GraphTraceLen; ++i) {
if (GraphBuffer[i] > max) max = GraphBuffer[i]; if (g_GraphBuffer[i] > max) max = g_GraphBuffer[i];
if (GraphBuffer[i] < min) min = GraphBuffer[i]; if (g_GraphBuffer[i] < min) min = g_GraphBuffer[i];
} }
if (max != min) { if (max != min) {
for (uint32_t i = 0; i < GraphTraceLen; ++i) { for (uint32_t i = 0; i < GraphTraceLen; ++i) {
GraphBuffer[i] = ((long)(GraphBuffer[i] - ((max + min) / 2)) * 256) / (max - min); g_GraphBuffer[i] = ((long)(g_GraphBuffer[i] - ((max + min) / 2)) * 256) / (max - min);
//marshmelow: adjusted *1000 to *256 to make +/- 128 so demod commands still work //marshmelow: adjusted *1000 to *256 to make +/- 128 so demod commands still work
} }
} }
@ -2254,9 +2254,9 @@ int CmdSave(const char *Cmd) {
CLIParserFree(ctx); CLIParserFree(ctx);
if (as_wave) if (as_wave)
return saveFileWAVE(filename, GraphBuffer, GraphTraceLen); return saveFileWAVE(filename, g_GraphBuffer, GraphTraceLen);
else else
return saveFilePM3(filename, GraphBuffer, GraphTraceLen); return saveFilePM3(filename, g_GraphBuffer, GraphTraceLen);
} }
static int CmdTimeScale(const char *Cmd) { static int CmdTimeScale(const char *Cmd) {
@ -2338,7 +2338,7 @@ static int CmdDirectionalThreshold(const char *Cmd) {
PrintAndLogEx(INFO, "Applying up threshold: " _YELLOW_("%i") ", down threshold: " _YELLOW_("%i") "\n", up, down); PrintAndLogEx(INFO, "Applying up threshold: " _YELLOW_("%i") ", down threshold: " _YELLOW_("%i") "\n", up, down);
directionalThreshold(GraphBuffer, GraphBuffer, GraphTraceLen, up, down); directionalThreshold(g_GraphBuffer, g_GraphBuffer, GraphTraceLen, up, down);
// set signal properties low/high/mean/amplitude and isnoice detection // set signal properties low/high/mean/amplitude and isnoice detection
uint8_t bits[GraphTraceLen]; uint8_t bits[GraphTraceLen];
@ -2369,14 +2369,14 @@ static int CmdZerocrossings(const char *Cmd) {
int sign = 1, zc = 0, lastZc = 0; int sign = 1, zc = 0, lastZc = 0;
for (uint32_t i = 0; i < GraphTraceLen; ++i) { for (uint32_t i = 0; i < GraphTraceLen; ++i) {
if (GraphBuffer[i] * sign >= 0) { if (g_GraphBuffer[i] * sign >= 0) {
// No change in sign, reproduce the previous sample count. // No change in sign, reproduce the previous sample count.
zc++; zc++;
GraphBuffer[i] = lastZc; g_GraphBuffer[i] = lastZc;
} else { } else {
// Change in sign, reset the sample count. // Change in sign, reset the sample count.
sign = -sign; sign = -sign;
GraphBuffer[i] = lastZc; g_GraphBuffer[i] = lastZc;
if (sign > 0) { if (sign > 0) {
lastZc = zc; lastZc = zc;
zc = 0; zc = 0;
@ -2664,7 +2664,7 @@ static int CmdFSKToNRZ(const char *Cmd) {
setClockGrid(0, 0); setClockGrid(0, 0);
g_DemodBufferLen = 0; g_DemodBufferLen = 0;
int ans = FSKToNRZ(GraphBuffer, &GraphTraceLen, clk, fc_low, fc_high); int ans = FSKToNRZ(g_GraphBuffer, &GraphTraceLen, clk, fc_low, fc_high);
CmdNorm(""); CmdNorm("");
RepaintGraphWindow(); RepaintGraphWindow();
return ans; return ans;
@ -2686,7 +2686,7 @@ static int CmdDataIIR(const char *Cmd) {
uint8_t k = (arg_get_u32_def(ctx, 1, 0) & 0xFF); uint8_t k = (arg_get_u32_def(ctx, 1, 0) & 0xFF);
CLIParserFree(ctx); CLIParserFree(ctx);
iceSimple_Filter(GraphBuffer, GraphTraceLen, k); iceSimple_Filter(g_GraphBuffer, GraphTraceLen, k);
uint8_t bits[GraphTraceLen]; uint8_t bits[GraphTraceLen];
size_t size = getFromGraphBuf(bits); size_t size = getFromGraphBuf(bits);

View file

@ -365,7 +365,7 @@ int handle_hf_plot(void) {
} }
for (size_t i = 0; i < FPGA_TRACE_SIZE; i++) { for (size_t i = 0; i < FPGA_TRACE_SIZE; i++) {
GraphBuffer[i] = ((int)buf[i]) - 128; g_GraphBuffer[i] = ((int)buf[i]) - 128;
} }
GraphTraceLen = FPGA_TRACE_SIZE; GraphTraceLen = FPGA_TRACE_SIZE;

View file

@ -520,7 +520,7 @@ static int CmdHF15Demod(const char *Cmd) {
for (i = 0; i < 1000; i++) { for (i = 0; i < 1000; i++) {
int corr = 0; int corr = 0;
for (j = 0; j < ARRAYLEN(FrameSOF); j += skip) { for (j = 0; j < ARRAYLEN(FrameSOF); j += skip) {
corr += FrameSOF[j] * GraphBuffer[i + (j / skip)]; corr += FrameSOF[j] * g_GraphBuffer[i + (j / skip)];
} }
if (corr > max) { if (corr > max) {
max = corr; max = corr;
@ -538,13 +538,13 @@ static int CmdHF15Demod(const char *Cmd) {
for (;;) { for (;;) {
int corr0 = 0, corr1 = 0, corrEOF = 0; int corr0 = 0, corr1 = 0, corrEOF = 0;
for (j = 0; j < ARRAYLEN(Logic0); j += skip) { for (j = 0; j < ARRAYLEN(Logic0); j += skip) {
corr0 += Logic0[j] * GraphBuffer[i + (j / skip)]; corr0 += Logic0[j] * g_GraphBuffer[i + (j / skip)];
} }
for (j = 0; j < ARRAYLEN(Logic1); j += skip) { for (j = 0; j < ARRAYLEN(Logic1); j += skip) {
corr1 += Logic1[j] * GraphBuffer[i + (j / skip)]; corr1 += Logic1[j] * g_GraphBuffer[i + (j / skip)];
} }
for (j = 0; j < ARRAYLEN(FrameEOF); j += skip) { for (j = 0; j < ARRAYLEN(FrameEOF); j += skip) {
corrEOF += FrameEOF[j] * GraphBuffer[i + (j / skip)]; corrEOF += FrameEOF[j] * g_GraphBuffer[i + (j / skip)];
} }
// Even things out by the length of the target waveform. // Even things out by the length of the target waveform.
corr0 *= 4; corr0 *= 4;

View file

@ -368,7 +368,7 @@ int CmdFlexdemod(const char *Cmd) {
int i, j, start, bit, sum; int i, j, start, bit, sum;
int data[GraphTraceLen]; int data[GraphTraceLen];
memcpy(data, GraphBuffer, GraphTraceLen); memcpy(data, g_GraphBuffer, GraphTraceLen);
size_t size = GraphTraceLen; size_t size = GraphTraceLen;
@ -426,7 +426,7 @@ int CmdFlexdemod(const char *Cmd) {
int phase = (bits[bit] == 0) ? 0 : 1; int phase = (bits[bit] == 0) ? 0 : 1;
for (j = 0; j < 32; j++) { for (j = 0; j < 32; j++) {
GraphBuffer[i++] = phase; g_GraphBuffer[i++] = phase;
phase = !phase; phase = !phase;
} }
} }
@ -766,7 +766,7 @@ int CmdLFSniff(const char *Cmd) {
static void lf_chk_bitstream(void) { static void lf_chk_bitstream(void) {
// convert to bitstream if necessary // convert to bitstream if necessary
for (int i = 0; i < (int)(GraphTraceLen / 2); i++) { for (int i = 0; i < (int)(GraphTraceLen / 2); i++) {
if (GraphBuffer[i] > 1 || GraphBuffer[i] < 0) { if (g_GraphBuffer[i] > 1 || g_GraphBuffer[i] < 0) {
CmdGetBitStream(""); CmdGetBitStream("");
PrintAndLogEx(INFO, "converted Graphbuffer to bitstream values (0|1)"); PrintAndLogEx(INFO, "converted Graphbuffer to bitstream values (0|1)");
break; break;
@ -774,7 +774,7 @@ static void lf_chk_bitstream(void) {
} }
} }
// Uploads GraphBuffer to device, in order to be used for LF SIM. // Uploads g_GraphBuffer to device, in order to be used for LF SIM.
int lfsim_upload_gb(void) { int lfsim_upload_gb(void) {
PrintAndLogEx(DEBUG, "DEBUG: Uploading %zu bytes", GraphTraceLen); PrintAndLogEx(DEBUG, "DEBUG: Uploading %zu bytes", GraphTraceLen);
@ -803,7 +803,7 @@ int lfsim_upload_gb(void) {
payload_up.offset = i; payload_up.offset = i;
for (uint16_t j = 0; j < len; j++) for (uint16_t j = 0; j < len; j++)
payload_up.data[j] = GraphBuffer[i + j]; payload_up.data[j] = g_GraphBuffer[i + j];
SendCommandNG(CMD_LF_UPLOAD_SIM_SAMPLES, (uint8_t *)&payload_up, sizeof(struct pupload)); SendCommandNG(CMD_LF_UPLOAD_SIM_SAMPLES, (uint8_t *)&payload_up, sizeof(struct pupload));
WaitForResponse(CMD_LF_UPLOAD_SIM_SAMPLES, &resp); WaitForResponse(CMD_LF_UPLOAD_SIM_SAMPLES, &resp);
@ -823,7 +823,7 @@ int lfsim_upload_gb(void) {
} }
//Attempt to simulate any wave in buffer (one bit per output sample) //Attempt to simulate any wave in buffer (one bit per output sample)
// converts GraphBuffer to bitstream (based on zero crossings) if needed. // converts g_GraphBuffer to bitstream (based on zero crossings) if needed.
int CmdLFSim(const char *Cmd) { int CmdLFSim(const char *Cmd) {
CLIParserContext *ctx; CLIParserContext *ctx;
CLIParserInit(&ctx, "lf sim", CLIParserInit(&ctx, "lf sim",
@ -1276,7 +1276,7 @@ int CmdVchDemod(const char *Cmd) {
for (i = 0; i < (GraphTraceLen - 2048); i++) { for (i = 0; i < (GraphTraceLen - 2048); i++) {
for (j = 0; j < ARRAYLEN(SyncPattern); j++) { for (j = 0; j < ARRAYLEN(SyncPattern); j++) {
sum += GraphBuffer[i + j] * SyncPattern[j]; sum += g_GraphBuffer[i + j] * SyncPattern[j];
} }
if (sum > bestCorrel) { if (sum > bestCorrel) {
bestCorrel = sum; bestCorrel = sum;
@ -1293,7 +1293,7 @@ int CmdVchDemod(const char *Cmd) {
for (i = 0; i < 2048; i += 8) { for (i = 0; i < 2048; i += 8) {
sum = 0; sum = 0;
for (j = 0; j < 8; j++) for (j = 0; j < 8; j++)
sum += GraphBuffer[bestPos + i + j]; sum += g_GraphBuffer[bestPos + i + j];
if (sum < 0) if (sum < 0)
bits[i / 8] = '.'; bits[i / 8] = '.';
@ -1315,7 +1315,7 @@ int CmdVchDemod(const char *Cmd) {
char *s; char *s;
for (s = bits; *s; s++) { for (s = bits; *s; s++) {
for (j = 0; j < 16; j++) { for (j = 0; j < 16; j++) {
GraphBuffer[GraphTraceLen++] = (*s == '1') ? 1 : 0; g_GraphBuffer[GraphTraceLen++] = (*s == '1') ? 1 : 0;
} }
} }
RepaintGraphWindow(); RepaintGraphWindow();
@ -1379,9 +1379,9 @@ int CmdLFfind(const char *Cmd) {
CLIParserInit(&ctx, "lf search", CLIParserInit(&ctx, "lf search",
"Read and search for valid known tag. For offline mode, you can `data load` first then search.", "Read and search for valid known tag. For offline mode, you can `data load` first then search.",
"lf search -> try reading data from tag & search for known tag\n" "lf search -> try reading data from tag & search for known tag\n"
"lf search -1 -> use data from GraphBuffer & search for known tag\n" "lf search -1 -> use data from the GraphBuffer & search for known tag\n"
"lf search -u -> try reading data from tag & search for known and unknown tag\n" "lf search -u -> try reading data from tag & search for known and unknown tag\n"
"lf search -1u -> use data from GraphBuffer & search for known and unknown tag\n" "lf search -1u -> use data from the GraphBuffer & search for known and unknown tag\n"
); );
void *argtable[] = { void *argtable[] = {
@ -1690,7 +1690,7 @@ int CmdLFfind(const char *Cmd) {
if (search_unk) { if (search_unk) {
//test unknown tag formats (raw mode) //test unknown tag formats (raw mode)
PrintAndLogEx(INFO, "\nChecking for unknown tags:\n"); PrintAndLogEx(INFO, "\nChecking for unknown tags:\n");
int ans = AutoCorrelate(GraphBuffer, GraphBuffer, GraphTraceLen, 8000, false, false); int ans = AutoCorrelate(g_GraphBuffer, g_GraphBuffer, GraphTraceLen, 8000, false, false);
if (ans > 0) { if (ans > 0) {
PrintAndLogEx(INFO, "Possible auto correlation of %d repeating samples", ans); PrintAndLogEx(INFO, "Possible auto correlation of %d repeating samples", ans);

View file

@ -20,7 +20,7 @@
static int CmdHelp(const char *Cmd); static int CmdHelp(const char *Cmd);
// COTAG demod should be able to use GraphBuffer, // COTAG demod should be able to use g_GraphBuffer,
// when data load samples // when data load samples
int demodCOTAG(bool verbose) { int demodCOTAG(bool verbose) {
(void) verbose; // unused so far (void) verbose; // unused so far

View file

@ -263,7 +263,7 @@ int AskEm410xDecode(bool verbose, uint32_t *hi, uint64_t *lo) {
return PM3_ESOFT; return PM3_ESOFT;
} }
//set GraphBuffer for clone or sim command //set g_GraphBuffer for clone or sim command
setDemodBuff(g_DemodBuffer, (size == 40) ? 64 : 128, idx + 1); setDemodBuff(g_DemodBuffer, (size == 40) ? 64 : 128, idx + 1);
setClockGrid(g_DemodClock, g_DemodStartIdx + ((idx + 1)*g_DemodClock)); setClockGrid(g_DemodClock, g_DemodStartIdx + ((idx + 1)*g_DemodClock));

View file

@ -2026,13 +2026,13 @@ int CmdEM4x05Sniff(const char *Cmd) {
haveData = false; haveData = false;
pwd = false; pwd = false;
idx = em4x05_Sniff_GetNextBitStart(idx, GraphTraceLen, GraphBuffer, &pulseSamples); idx = em4x05_Sniff_GetNextBitStart(idx, GraphTraceLen, g_GraphBuffer, &pulseSamples);
pktOffset = idx; pktOffset = idx;
if (pulseSamples >= 10) { // Should be 18 so a bit less to allow for processing if (pulseSamples >= 10) { // Should be 18 so a bit less to allow for processing
// Use first bit to get "0" bit samples as a reference // Use first bit to get "0" bit samples as a reference
ZeroWidth = idx; ZeroWidth = idx;
idx = em4x05_Sniff_GetNextBitStart(idx, GraphTraceLen, GraphBuffer, &pulseSamples); idx = em4x05_Sniff_GetNextBitStart(idx, GraphTraceLen, g_GraphBuffer, &pulseSamples);
ZeroWidth = idx - ZeroWidth; ZeroWidth = idx - ZeroWidth;
if (ZeroWidth <= 50) { if (ZeroWidth <= 50) {
@ -2042,7 +2042,7 @@ int CmdEM4x05Sniff(const char *Cmd) {
while ((idx < GraphTraceLen) && !eop) { while ((idx < GraphTraceLen) && !eop) {
CycleWidth = idx; CycleWidth = idx;
idx = em4x05_Sniff_GetNextBitStart(idx, GraphTraceLen, GraphBuffer, &pulseSamples); idx = em4x05_Sniff_GetNextBitStart(idx, GraphTraceLen, g_GraphBuffer, &pulseSamples);
CycleWidth = idx - CycleWidth; CycleWidth = idx - CycleWidth;
if ((CycleWidth > 300) || (CycleWidth < (ZeroWidth - 5))) { // to long or too short if ((CycleWidth > 300) || (CycleWidth < (ZeroWidth - 5))) { // to long or too short

View file

@ -29,7 +29,7 @@ static int CmdHelp(const char *Cmd);
// attempts to demodulate and identify a G_Prox_II verex/chubb card // attempts to demodulate and identify a G_Prox_II verex/chubb card
// WARNING: if it fails during some points it will destroy the g_DemodBuffer data // WARNING: if it fails during some points it will destroy the g_DemodBuffer data
// but will leave the GraphBuffer intact. // but will leave the g_GraphBuffer intact.
// if successful it will push askraw data back to g_DemodBuffer ready for emulation // if successful it will push askraw data back to g_DemodBuffer ready for emulation
int demodGuard(bool verbose) { int demodGuard(bool verbose) {
(void) verbose; // unused so far (void) verbose; // unused so far

View file

@ -253,9 +253,9 @@ static int CmdIndalaDemod(const char *Cmd) {
CLIParserInit(&ctx, "lf indala demod", CLIParserInit(&ctx, "lf indala demod",
"Tries to PSK demodulate the graphbuffer as Indala", "Tries to PSK demodulate the graphbuffer as Indala",
"lf indala demod\n" "lf indala demod\n"
"lf indala demod --clock 32 -> demod a Indala tag from GraphBuffer using a clock of RF/32\n" "lf indala demod --clock 32 -> demod a Indala tag from the GraphBuffer using a clock of RF/32\n"
"lf indala demod --clock 32 -i -> demod a Indala tag from GraphBuffer using a clock of RF/32 and inverting data\n" "lf indala demod --clock 32 -i -> demod a Indala tag from the GraphBuffer using a clock of RF/32 and inverting data\n"
"lf indala demod --clock 64 -i --maxerror 0 -> demod a Indala tag from GraphBuffer using a clock of RF/64, inverting data and allowing 0 demod errors" "lf indala demod --clock 64 -i --maxerror 0 -> demod a Indala tag from the GraphBuffer using a clock of RF/64, inverting data and allowing 0 demod errors"
); );
void *argtable[] = { void *argtable[] = {
@ -286,7 +286,7 @@ static int CmdIndalaDemodAlt(const char *Cmd) {
"This is uses a alternative way to demodulate and was used from the beginning in the Pm3 client.\n" "This is uses a alternative way to demodulate and was used from the beginning in the Pm3 client.\n"
"It's now considered obsolete but remains because it has sometimes its advantages.", "It's now considered obsolete but remains because it has sometimes its advantages.",
"lf indala altdemod\n" "lf indala altdemod\n"
"lf indala altdemod --long -> demod a Indala tag from GraphBuffer as 224 bit long format" "lf indala altdemod --long -> demod a Indala tag from the GraphBuffer as 224 bit long format"
); );
void *argtable[] = { void *argtable[] = {
@ -486,7 +486,7 @@ static int CmdIndalaDemodAlt(const char *Cmd) {
phase = 1; phase = 1;
} }
for (j = 0; j < 32; j++) { for (j = 0; j < 32; j++) {
GraphBuffer[i++] = phase; g_GraphBuffer[i++] = phase;
phase = !phase; phase = !phase;
} }
} }
@ -797,7 +797,7 @@ static int CmdIndalaClone(const char *Cmd) {
static command_t CommandTable[] = { static command_t CommandTable[] = {
{"help", CmdHelp, AlwaysAvailable, "This help"}, {"help", CmdHelp, AlwaysAvailable, "This help"},
{"demod", CmdIndalaDemod, AlwaysAvailable, "Demodulate an Indala tag (PSK1) from GraphBuffer"}, {"demod", CmdIndalaDemod, AlwaysAvailable, "Demodulate an Indala tag (PSK1) from the GraphBuffer"},
{"altdemod", CmdIndalaDemodAlt, AlwaysAvailable, "Alternative method to demodulate samples for Indala 64 bit UID (option '224' for 224 bit)"}, {"altdemod", CmdIndalaDemodAlt, AlwaysAvailable, "Alternative method to demodulate samples for Indala 64 bit UID (option '224' for 224 bit)"},
{"reader", CmdIndalaReader, IfPm3Lf, "Read an Indala tag from the antenna"}, {"reader", CmdIndalaReader, IfPm3Lf, "Read an Indala tag from the antenna"},
{"clone", CmdIndalaClone, IfPm3Lf, "Clone Indala tag to T55x7 or Q5/T5555"}, {"clone", CmdIndalaClone, IfPm3Lf, "Clone Indala tag to T55x7 or Q5/T5555"},

View file

@ -4059,13 +4059,13 @@ static int CmdT55xxSniff(const char *Cmd) {
} }
// find high // find high
while ((idx < GraphTraceLen) && (GraphBuffer[idx] < 0)) { while ((idx < GraphTraceLen) && (g_GraphBuffer[idx] < 0)) {
idx++; idx++;
} }
// count high samples // count high samples
pulseSamples = 0; pulseSamples = 0;
while ((idx < GraphTraceLen) && (GraphBuffer[idx] > 0)) { // last bit seems to be high to zero, but can vary in width.. while ((idx < GraphTraceLen) && (g_GraphBuffer[idx] > 0)) { // last bit seems to be high to zero, but can vary in width..
pulseSamples++; pulseSamples++;
idx++; idx++;
} }

View file

@ -95,17 +95,17 @@ int demodTI(bool verbose) {
highSum = 0; highSum = 0;
for (j = 0; j < lowLen; j++) { for (j = 0; j < lowLen; j++) {
lowSum += LowTone[j] * GraphBuffer[i + j]; lowSum += LowTone[j] * g_GraphBuffer[i + j];
} }
for (j = 0; j < highLen; j++) { for (j = 0; j < highLen; j++) {
highSum += HighTone[j] * GraphBuffer[i + j]; highSum += HighTone[j] * g_GraphBuffer[i + j];
} }
lowSum = abs((100 * lowSum) / lowLen); lowSum = abs((100 * lowSum) / lowLen);
highSum = abs((100 * highSum) / highLen); highSum = abs((100 * highSum) / highLen);
lowSum = (lowSum < 0) ? -lowSum : lowSum; lowSum = (lowSum < 0) ? -lowSum : lowSum;
highSum = (highSum < 0) ? -highSum : highSum; highSum = (highSum < 0) ? -highSum : highSum;
GraphBuffer[i] = (highSum << 16) | lowSum; g_GraphBuffer[i] = (highSum << 16) | lowSum;
} }
for (i = 0; i < GraphTraceLen - convLen - 16; i++) { for (i = 0; i < GraphTraceLen - convLen - 16; i++) {
@ -113,12 +113,12 @@ int demodTI(bool verbose) {
highTot = 0; highTot = 0;
// 16 and 15 are f_s divided by f_l and f_h, rounded // 16 and 15 are f_s divided by f_l and f_h, rounded
for (j = 0; j < 16; j++) { for (j = 0; j < 16; j++) {
lowTot += (GraphBuffer[i + j] & 0xffff); lowTot += (g_GraphBuffer[i + j] & 0xffff);
} }
for (j = 0; j < 15; j++) { for (j = 0; j < 15; j++) {
highTot += (GraphBuffer[i + j] >> 16); highTot += (g_GraphBuffer[i + j] >> 16);
} }
GraphBuffer[i] = lowTot - highTot; g_GraphBuffer[i] = lowTot - highTot;
} }
GraphTraceLen -= (convLen + 16); GraphTraceLen -= (convLen + 16);
@ -143,11 +143,11 @@ int demodTI(bool verbose) {
int dec = 0; int dec = 0;
// searching 17 consecutive lows // searching 17 consecutive lows
for (j = 0; j < 17 * lowLen; j++) { for (j = 0; j < 17 * lowLen; j++) {
dec -= GraphBuffer[i + j]; dec -= g_GraphBuffer[i + j];
} }
// searching 7 consecutive highs // searching 7 consecutive highs
for (; j < 17 * lowLen + 6 * highLen; j++) { for (; j < 17 * lowLen + 6 * highLen; j++) {
dec += GraphBuffer[i + j]; dec += g_GraphBuffer[i + j];
} }
if (dec > max) { if (dec > max) {
max = dec; max = dec;
@ -157,8 +157,8 @@ int demodTI(bool verbose) {
// place a marker in the buffer to visually aid location // place a marker in the buffer to visually aid location
// of the start of sync // of the start of sync
GraphBuffer[maxPos] = 800; g_GraphBuffer[maxPos] = 800;
GraphBuffer[maxPos + 1] = -800; g_GraphBuffer[maxPos + 1] = -800;
// advance pointer to start of actual data stream (after 16 pre and 8 start bits) // advance pointer to start of actual data stream (after 16 pre and 8 start bits)
maxPos += 17 * lowLen; maxPos += 17 * lowLen;
@ -166,8 +166,8 @@ int demodTI(bool verbose) {
// place a marker in the buffer to visually aid location // place a marker in the buffer to visually aid location
// of the end of sync // of the end of sync
GraphBuffer[maxPos] = 800; g_GraphBuffer[maxPos] = 800;
GraphBuffer[maxPos + 1] = -800; g_GraphBuffer[maxPos + 1] = -800;
PrintAndLogEx(DEBUG, "actual data bits start at sample %d", maxPos); PrintAndLogEx(DEBUG, "actual data bits start at sample %d", maxPos);
PrintAndLogEx(DEBUG, "length %d/%d", highLen, lowLen); PrintAndLogEx(DEBUG, "length %d/%d", highLen, lowLen);
@ -180,10 +180,10 @@ int demodTI(bool verbose) {
for (i = 0; i < ARRAYLEN(bits) - 1; i++) { for (i = 0; i < ARRAYLEN(bits) - 1; i++) {
int high = 0, low = 0; int high = 0, low = 0;
for (j = 0; j < lowLen; j++) { for (j = 0; j < lowLen; j++) {
low -= GraphBuffer[maxPos + j]; low -= g_GraphBuffer[maxPos + j];
} }
for (j = 0; j < highLen; j++) { for (j = 0; j < highLen; j++) {
high += GraphBuffer[maxPos + j]; high += g_GraphBuffer[maxPos + j];
} }
if (high > low) { if (high > low) {
@ -203,8 +203,8 @@ int demodTI(bool verbose) {
shift3 >>= 1; shift3 >>= 1;
// place a marker in the buffer between bits to visually aid location // place a marker in the buffer between bits to visually aid location
GraphBuffer[maxPos] = 800; g_GraphBuffer[maxPos] = 800;
GraphBuffer[maxPos + 1] = -800; g_GraphBuffer[maxPos + 1] = -800;
} }
RepaintGraphWindow(); RepaintGraphWindow();

View file

@ -17,7 +17,7 @@
#include "cmddata.h" //for g_debugmode #include "cmddata.h" //for g_debugmode
int GraphBuffer[MAX_GRAPH_TRACE_LEN]; int g_GraphBuffer[MAX_GRAPH_TRACE_LEN];
size_t GraphTraceLen; size_t GraphTraceLen;
/* write a manchester bit to the graph /* write a manchester bit to the graph
@ -28,11 +28,11 @@ void AppendGraph(bool redraw, uint16_t clock, int bit) {
uint8_t i; uint8_t i;
//set first half the clock bit (all 1's or 0's for a 0 or 1 bit) //set first half the clock bit (all 1's or 0's for a 0 or 1 bit)
for (i = 0; i < half; ++i) for (i = 0; i < half; ++i)
GraphBuffer[GraphTraceLen++] = bit; g_GraphBuffer[GraphTraceLen++] = bit;
//set second half of the clock bit (all 0's or 1's for a 0 or 1 bit) //set second half of the clock bit (all 0's or 1's for a 0 or 1 bit)
for (; i < clock; ++i) for (; i < clock; ++i)
GraphBuffer[GraphTraceLen++] = bit ^ 1; g_GraphBuffer[GraphTraceLen++] = bit ^ 1;
if (redraw) if (redraw)
RepaintGraphWindow(); RepaintGraphWindow();
@ -41,7 +41,7 @@ void AppendGraph(bool redraw, uint16_t clock, int bit) {
// clear out our graph window // clear out our graph window
size_t ClearGraph(bool redraw) { size_t ClearGraph(bool redraw) {
size_t gtl = GraphTraceLen; size_t gtl = GraphTraceLen;
memset(GraphBuffer, 0x00, GraphTraceLen); memset(g_GraphBuffer, 0x00, GraphTraceLen);
GraphTraceLen = 0; GraphTraceLen = 0;
g_GraphStart = 0; g_GraphStart = 0;
g_GraphStop = 0; g_GraphStop = 0;
@ -52,7 +52,7 @@ size_t ClearGraph(bool redraw) {
return gtl; return gtl;
} }
// option '1' to save GraphBuffer any other to restore // option '1' to save g_GraphBuffer any other to restore
void save_restoreGB(uint8_t saveOpt) { void save_restoreGB(uint8_t saveOpt) {
static int SavedGB[MAX_GRAPH_TRACE_LEN]; static int SavedGB[MAX_GRAPH_TRACE_LEN];
static size_t SavedGBlen = 0; static size_t SavedGBlen = 0;
@ -60,12 +60,12 @@ void save_restoreGB(uint8_t saveOpt) {
static int Savedg_GridOffsetAdj = 0; static int Savedg_GridOffsetAdj = 0;
if (saveOpt == GRAPH_SAVE) { //save if (saveOpt == GRAPH_SAVE) { //save
memcpy(SavedGB, GraphBuffer, sizeof(GraphBuffer)); memcpy(SavedGB, g_GraphBuffer, sizeof(g_GraphBuffer));
SavedGBlen = GraphTraceLen; SavedGBlen = GraphTraceLen;
GB_Saved = true; GB_Saved = true;
Savedg_GridOffsetAdj = g_GridOffset; Savedg_GridOffsetAdj = g_GridOffset;
} else if (GB_Saved) { //restore } else if (GB_Saved) { //restore
memcpy(GraphBuffer, SavedGB, sizeof(GraphBuffer)); memcpy(g_GraphBuffer, SavedGB, sizeof(g_GraphBuffer));
GraphTraceLen = SavedGBlen; GraphTraceLen = SavedGBlen;
g_GridOffset = Savedg_GridOffsetAdj; g_GridOffset = Savedg_GridOffsetAdj;
RepaintGraphWindow(); RepaintGraphWindow();
@ -81,7 +81,7 @@ void setGraphBuf(uint8_t *buff, size_t size) {
size = MAX_GRAPH_TRACE_LEN; size = MAX_GRAPH_TRACE_LEN;
for (size_t i = 0; i < size; ++i) for (size_t i = 0; i < size; ++i)
GraphBuffer[i] = buff[i] - 128; g_GraphBuffer[i] = buff[i] - 128;
GraphTraceLen = size; GraphTraceLen = size;
RepaintGraphWindow(); RepaintGraphWindow();
@ -94,9 +94,9 @@ size_t getFromGraphBuf(uint8_t *buff) {
size_t i; size_t i;
for (i = 0; i < GraphTraceLen; ++i) { for (i = 0; i < GraphTraceLen; ++i) {
//trim //trim
if (GraphBuffer[i] > 127) GraphBuffer[i] = 127; if (g_GraphBuffer[i] > 127) g_GraphBuffer[i] = 127;
if (GraphBuffer[i] < -127) GraphBuffer[i] = -127; if (g_GraphBuffer[i] < -127) g_GraphBuffer[i] = -127;
buff[i] = (uint8_t)(GraphBuffer[i] + 128); buff[i] = (uint8_t)(g_GraphBuffer[i] + 128);
} }
return i; return i;
} }
@ -113,7 +113,7 @@ bool HasGraphData(void) {
bool isGraphBitstream(void) { bool isGraphBitstream(void) {
// convert to bitstream if necessary // convert to bitstream if necessary
for (int i = 0; i < GraphTraceLen; i++) { for (int i = 0; i < GraphTraceLen; i++) {
if (GraphBuffer[i] > 1 || GraphBuffer[i] < 0) { if (g_GraphBuffer[i] > 1 || g_GraphBuffer[i] < 0) {
return false; return false;
} }
} }
@ -126,12 +126,12 @@ void convertGraphFromBitstream(void) {
void convertGraphFromBitstreamEx(int hi, int low) { void convertGraphFromBitstreamEx(int hi, int low) {
for (int i = 0; i < GraphTraceLen; i++) { for (int i = 0; i < GraphTraceLen; i++) {
if (GraphBuffer[i] == hi) if (g_GraphBuffer[i] == hi)
GraphBuffer[i] = 127; g_GraphBuffer[i] = 127;
else if (GraphBuffer[i] == low) else if (g_GraphBuffer[i] == low)
GraphBuffer[i] = -127; g_GraphBuffer[i] = -127;
else else
GraphBuffer[i] = 0; g_GraphBuffer[i] = 0;
} }
uint8_t *bits = calloc(GraphTraceLen, sizeof(uint8_t)); uint8_t *bits = calloc(GraphTraceLen, sizeof(uint8_t));

View file

@ -38,7 +38,7 @@ bool fskClocks(uint8_t *fc1, uint8_t *fc2, uint8_t *rf1, int *firstClockEdge);
#define GRAPH_SAVE 1 #define GRAPH_SAVE 1
#define GRAPH_RESTORE 0 #define GRAPH_RESTORE 0
extern int GraphBuffer[MAX_GRAPH_TRACE_LEN]; extern int g_GraphBuffer[MAX_GRAPH_TRACE_LEN];
extern size_t GraphTraceLen; extern size_t GraphTraceLen;
#ifdef __cplusplus #ifdef __cplusplus

View file

@ -292,7 +292,7 @@ void SliderWidget::moveEvent(QMoveEvent *event) {
void ProxWidget::applyOperation() { void ProxWidget::applyOperation() {
//printf("ApplyOperation()"); //printf("ApplyOperation()");
save_restoreGB(GRAPH_SAVE); save_restoreGB(GRAPH_SAVE);
memcpy(GraphBuffer, s_Buff, sizeof(int) * GraphTraceLen); memcpy(g_GraphBuffer, s_Buff, sizeof(int) * GraphTraceLen);
RepaintGraphWindow(); RepaintGraphWindow();
} }
void ProxWidget::stickOperation() { void ProxWidget::stickOperation() {
@ -300,21 +300,21 @@ void ProxWidget::stickOperation() {
//printf("stickOperation()"); //printf("stickOperation()");
} }
void ProxWidget::vchange_autocorr(int v) { void ProxWidget::vchange_autocorr(int v) {
int ans = AutoCorrelate(GraphBuffer, s_Buff, GraphTraceLen, v, true, false); int ans = AutoCorrelate(g_GraphBuffer, s_Buff, GraphTraceLen, v, true, false);
if (g_debugMode) printf("vchange_autocorr(w:%d): %d\n", v, ans); if (g_debugMode) printf("vchange_autocorr(w:%d): %d\n", v, ans);
g_useOverlays = true; g_useOverlays = true;
RepaintGraphWindow(); RepaintGraphWindow();
} }
void ProxWidget::vchange_askedge(int v) { void ProxWidget::vchange_askedge(int v) {
//extern int AskEdgeDetect(const int *in, int *out, int len, int threshold); //extern int AskEdgeDetect(const int *in, int *out, int len, int threshold);
int ans = AskEdgeDetect(GraphBuffer, s_Buff, GraphTraceLen, v); int ans = AskEdgeDetect(g_GraphBuffer, s_Buff, GraphTraceLen, v);
if (g_debugMode) printf("vchange_askedge(w:%d)%d\n", v, ans); if (g_debugMode) printf("vchange_askedge(w:%d)%d\n", v, ans);
g_useOverlays = true; g_useOverlays = true;
RepaintGraphWindow(); RepaintGraphWindow();
} }
void ProxWidget::vchange_dthr_up(int v) { void ProxWidget::vchange_dthr_up(int v) {
int down = opsController->horizontalSlider_dirthr_down->value(); int down = opsController->horizontalSlider_dirthr_down->value();
directionalThreshold(GraphBuffer, s_Buff, GraphTraceLen, v, down); directionalThreshold(g_GraphBuffer, s_Buff, GraphTraceLen, v, down);
//printf("vchange_dthr_up(%d)", v); //printf("vchange_dthr_up(%d)", v);
g_useOverlays = true; g_useOverlays = true;
RepaintGraphWindow(); RepaintGraphWindow();
@ -322,7 +322,7 @@ void ProxWidget::vchange_dthr_up(int v) {
void ProxWidget::vchange_dthr_down(int v) { void ProxWidget::vchange_dthr_down(int v) {
//printf("vchange_dthr_down(%d)", v); //printf("vchange_dthr_down(%d)", v);
int up = opsController->horizontalSlider_dirthr_up->value(); int up = opsController->horizontalSlider_dirthr_up->value();
directionalThreshold(GraphBuffer, s_Buff, GraphTraceLen, v, up); directionalThreshold(g_GraphBuffer, s_Buff, GraphTraceLen, v, up);
g_useOverlays = true; g_useOverlays = true;
RepaintGraphWindow(); RepaintGraphWindow();
} }
@ -700,7 +700,7 @@ void Plot::paintEvent(QPaintEvent *event) {
painter.fillRect(plotRect, BLACK); painter.fillRect(plotRect, BLACK);
//init graph variables //init graph variables
setMaxAndStart(GraphBuffer, GraphTraceLen, plotRect); setMaxAndStart(g_GraphBuffer, GraphTraceLen, plotRect);
// center line // center line
int zeroHeight = plotRect.top() + (plotRect.bottom() - plotRect.top()) / 2; int zeroHeight = plotRect.top() + (plotRect.bottom() - plotRect.top()) / 2;
@ -710,7 +710,7 @@ void Plot::paintEvent(QPaintEvent *event) {
plotGridLines(&painter, plotRect); plotGridLines(&painter, plotRect);
//Start painting graph //Start painting graph
PlotGraph(GraphBuffer, GraphTraceLen, plotRect, infoRect, &painter, 0); PlotGraph(g_GraphBuffer, GraphTraceLen, plotRect, infoRect, &painter, 0);
if (showDemod && g_DemodBufferLen > 8) { if (showDemod && g_DemodBufferLen > 8) {
PlotDemod(g_DemodBuffer, g_DemodBufferLen, plotRect, infoRect, &painter, 2, g_DemodStartIdx); PlotDemod(g_DemodBuffer, g_DemodBufferLen, plotRect, infoRect, &painter, 2, g_DemodStartIdx);
} }
@ -868,7 +868,7 @@ void Plot::Trim(void) {
} }
g_DemodStartIdx -= lref; g_DemodStartIdx -= lref;
for (uint32_t i = lref; i < rref; ++i) for (uint32_t i = lref; i < rref; ++i)
GraphBuffer[i - lref] = GraphBuffer[i]; g_GraphBuffer[i - lref] = g_GraphBuffer[i];
GraphTraceLen = rref - lref; GraphTraceLen = rref - lref;
g_GraphStart = 0; g_GraphStart = 0;
} }