rename globals GraphBuffer

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

No files matched your search

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