From: marshmellow42 Date: Thu, 13 Apr 2017 14:33:18 +0000 (-0400) Subject: combine autocorr, dirth functions X-Git-Tag: v3.0.0~12^2~11^2~2 X-Git-Url: http://cvs.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/commitdiff_plain/c4f51073fc1a2cb74363bb9b0d9f616c7dd742bb combine autocorr, dirth functions fix lfdemod bug add askedge to overlays (remove askdemod) --- diff --git a/client/cmddata.c b/client/cmddata.c index a59236e6..5dcd87b6 100644 --- a/client/cmddata.c +++ b/client/cmddata.c @@ -507,45 +507,44 @@ int Cmdaskrawdemod(const char *Cmd) return ASKDemod(Cmd, true, false, 0); } -int AutoCorrelate(int window, bool SaveGrph, bool verbose) +int AutoCorrelate(const int *in, int *out, size_t len, int window, bool SaveGrph, bool verbose) { static int CorrelBuffer[MAX_GRAPH_TRACE_LEN]; size_t Correlation = 0; int maxSum = 0; int lastMax = 0; if (verbose) PrintAndLog("performing %d correlations", GraphTraceLen - window); - for (int i = 0; i < GraphTraceLen - window; ++i) { + for (int i = 0; i < len - window; ++i) { int sum = 0; for (int j = 0; j < window; ++j) { - sum += (GraphBuffer[j]*GraphBuffer[i + j]) / 256; + sum += (in[j]*in[i + j]) / 256; } CorrelBuffer[i] = sum; - if (sum >= maxSum-100 && sum <= maxSum+100){ + if (sum >= maxSum-100 && sum <= maxSum+100) { //another max Correlation = i-lastMax; lastMax = i; if (sum > maxSum) maxSum = sum; - } else if (sum > maxSum){ + } else if (sum > maxSum) { maxSum=sum; lastMax = i; } } - if (Correlation==0){ + if (Correlation==0) { //try again with wider margin - for (int i = 0; i < GraphTraceLen - window; i++){ - if (CorrelBuffer[i] >= maxSum-(maxSum*0.05) && CorrelBuffer[i] <= maxSum+(maxSum*0.05)){ + for (int i = 0; i < len - window; i++) { + if (CorrelBuffer[i] >= maxSum-(maxSum*0.05) && CorrelBuffer[i] <= maxSum+(maxSum*0.05)) { //another max Correlation = i-lastMax; lastMax = i; - //if (CorrelBuffer[i] > maxSum) maxSum = sum; } } } if (verbose && Correlation > 0) PrintAndLog("Possible Correlation: %d samples",Correlation); - if (SaveGrph){ - GraphTraceLen = GraphTraceLen - window; - memcpy(GraphBuffer, CorrelBuffer, GraphTraceLen * sizeof (int)); + if (SaveGrph) { + //GraphTraceLen = GraphTraceLen - window; + memcpy(out, CorrelBuffer, len * sizeof(int)); RepaintGraphWindow(); } return Correlation; @@ -578,7 +577,7 @@ int CmdAutoCorr(const char *Cmd) return 0; } if (grph == 'g') updateGrph=true; - return AutoCorrelate(window, updateGrph, true); + return AutoCorrelate(GraphBuffer, GraphBuffer, GraphTraceLen, window, updateGrph, true); } int CmdBitsamples(const char *Cmd) @@ -681,6 +680,18 @@ int CmdGraphShiftZero(const char *Cmd) return 0; } +int AskEdgeDetect(const int *in, int *out, int len, int threshold) { + int Last = 0; + for(int i = 1; i= threshold) //large jump up + Last = 127; + else if(in[i]-in[i-1] <= -1 * threshold) //large jump down + Last = -127; + out[i-1] = Last; + } + return 0; +} + //by marshmellow //use large jumps in read samples to identify edges of waves and then amplify that wave to max //similar to dirtheshold, threshold commands @@ -688,18 +699,12 @@ int CmdGraphShiftZero(const char *Cmd) int CmdAskEdgeDetect(const char *Cmd) { int thresLen = 25; - int Last = 0; + int ans = 0; sscanf(Cmd, "%i", &thresLen); - for(int i = 1; i=thresLen) //large jump up - Last = 127; - else if(GraphBuffer[i]-GraphBuffer[i-1]<=-1*thresLen) //large jump down - Last = -127; - GraphBuffer[i-1] = Last; - } + ans = AskEdgeDetect(GraphBuffer, GraphBuffer, GraphTraceLen, thresLen); RepaintGraphWindow(); - return 0; + return ans; } /* Print our clock rate */ @@ -1433,37 +1438,42 @@ int CmdScale(const char *Cmd) return 0; } -int CmdDirectionalThreshold(const char *Cmd) +int directionalThreshold(const int* in, int *out, size_t len, int8_t up, int8_t down) { - int8_t upThres = param_get8(Cmd, 0); - int8_t downThres = param_get8(Cmd, 1); - - printf("Applying Up Threshold: %d, Down Threshold: %d\n", upThres, downThres); - - int lastValue = GraphBuffer[0]; - GraphBuffer[0] = 0; // Will be changed at the end, but init 0 as we adjust to last samples value if no threshold kicks in. + int lastValue = in[0]; + out[0] = 0; // Will be changed at the end, but init 0 as we adjust to last samples value if no threshold kicks in. - for (int i = 1; i < GraphTraceLen; ++i) { + for (int i = 1; i < len; ++i) { // Apply first threshold to samples heading up - if (GraphBuffer[i] >= upThres && GraphBuffer[i] > lastValue) + if (in[i] >= up && in[i] > lastValue) { - lastValue = GraphBuffer[i]; // Buffer last value as we overwrite it. - GraphBuffer[i] = 127; + lastValue = out[i]; // Buffer last value as we overwrite it. + out[i] = 1; } // Apply second threshold to samples heading down - else if (GraphBuffer[i] <= downThres && GraphBuffer[i] < lastValue) + else if (in[i] <= down && in[i] < lastValue) { - lastValue = GraphBuffer[i]; // Buffer last value as we overwrite it. - GraphBuffer[i] = -127; + lastValue = out[i]; // Buffer last value as we overwrite it. + out[i] = -1; } else { - lastValue = GraphBuffer[i]; // Buffer last value as we overwrite it. - GraphBuffer[i] = GraphBuffer[i-1]; - + lastValue = out[i]; // Buffer last value as we overwrite it. + out[i] = out[i-1]; } } - GraphBuffer[0] = GraphBuffer[1]; // Aline with first edited sample. + out[0] = out[1]; // Align with first edited sample. + return 0; +} + +int CmdDirectionalThreshold(const char *Cmd) +{ + int8_t upThres = param_get8(Cmd, 0); + int8_t downThres = param_get8(Cmd, 1); + + printf("Applying Up Threshold: %d, Down Threshold: %d\n", upThres, downThres); + + directionalThreshold(GraphBuffer, GraphBuffer,GraphTraceLen, upThres, downThres); RepaintGraphWindow(); return 0; } diff --git a/client/cmddata.h b/client/cmddata.h index 4a3287a7..0484acdb 100644 --- a/client/cmddata.h +++ b/client/cmddata.h @@ -27,7 +27,7 @@ void save_restoreDB(uint8_t saveOpt);// option '1' to save DemodBuffer any other int CmdPrintDemodBuff(const char *Cmd); int Cmdaskrawdemod(const char *Cmd); int Cmdaskmandemod(const char *Cmd); -int AutoCorrelate(int window, bool SaveGrph, bool verbose); +int AutoCorrelate(const int *in, int *out, size_t len, int window, bool SaveGrph, bool verbose); int CmdAutoCorr(const char *Cmd); int CmdBiphaseDecodeRaw(const char *Cmd); int CmdBitsamples(const char *Cmd); @@ -65,6 +65,9 @@ int PSKDemod(const char *Cmd, bool verbose); int NRZrawDemod(const char *Cmd, bool verbose); int getSamples(int n, bool silent); void setClockGrid(int clk, int offset); +int directionalThreshold(const int* in, int *out, size_t len, int8_t up, int8_t down); +extern int AskEdgeDetect(const int *in, int *out, int len, int threshold); +//int autoCorr(const int* in, int *out, size_t len, int window); #define MAX_DEMOD_BUF_LEN (1024*128) extern uint8_t DemodBuffer[MAX_DEMOD_BUF_LEN]; diff --git a/client/cmdlf.c b/client/cmdlf.c index 5825b339..3c4319c7 100644 --- a/client/cmdlf.c +++ b/client/cmdlf.c @@ -1059,7 +1059,7 @@ int CmdLFfind(const char *Cmd) ans=CheckChipType(cmdp); //test unknown tag formats (raw mode)0 PrintAndLog("\nChecking for Unknown tags:\n"); - ans=AutoCorrelate(4000, false, false); + ans=AutoCorrelate(GraphBuffer, GraphBuffer, GraphTraceLen, 4000, false, false); if (ans > 0) PrintAndLog("Possible Auto Correlation of %d repeating samples",ans); ans=GetFskClock("",false,false); if (ans != 0) { //fsk diff --git a/client/graph.c b/client/graph.c index 547e9b30..cc0ec6fb 100644 --- a/client/graph.c +++ b/client/graph.c @@ -293,57 +293,3 @@ bool graphJustNoise(int *BitStream, int size) } return justNoise1; } -int autoCorr(const int* in, int *out, size_t len, int window) -{ - static int CorrelBuffer[MAX_GRAPH_TRACE_LEN]; - - if (window == 0) { - PrintAndLog("needs a window"); - return 0; - } - if (window >= len) { - PrintAndLog("window must be smaller than trace (%d samples)", - len); - return 0; - } - - PrintAndLog("performing %d correlations", len - window); - - for (int i = 0; i < len - window; ++i) { - int sum = 0; - for (int j = 0; j < window; ++j) { - sum += (in[j]*in[i + j]) / 256; - } - CorrelBuffer[i] = sum; - } - //GraphTraceLen = GraphTraceLen - window; - memcpy(out, CorrelBuffer, len * sizeof (int)); - return 0; -} -int directionalThreshold(const int* in, int *out, size_t len, int8_t up, int8_t down) -{ - int lastValue = in[0]; - out[0] = 0; // Will be changed at the end, but init 0 as we adjust to last samples value if no threshold kicks in. - - for (int i = 1; i < len; ++i) { - // Apply first threshold to samples heading up - if (in[i] >= up && in[i] > lastValue) - { - lastValue = out[i]; // Buffer last value as we overwrite it. - out[i] = 1; - } - // Apply second threshold to samples heading down - else if (in[i] <= down && in[i] < lastValue) - { - lastValue = out[i]; // Buffer last value as we overwrite it. - out[i] = -1; - } - else - { - lastValue = out[i]; // Buffer last value as we overwrite it. - out[i] = out[i-1]; - } - } - out[0] = out[1]; // Align with first edited sample. - return 0; -} diff --git a/client/graph.h b/client/graph.h index e70efe46..d77db301 100644 --- a/client/graph.h +++ b/client/graph.h @@ -37,7 +37,4 @@ extern int GraphBuffer[MAX_GRAPH_TRACE_LEN]; extern int GraphTraceLen; extern int s_Buff[MAX_GRAPH_TRACE_LEN]; -int autoCorr(const int* in, int *out, size_t len, int window); -int directionalThreshold(const int* in, int *out, size_t len, int8_t up, int8_t down); - #endif diff --git a/client/proxgui.h b/client/proxgui.h index a6d8f24a..de6dd6c2 100644 --- a/client/proxgui.h +++ b/client/proxgui.h @@ -34,7 +34,9 @@ extern int offline; extern bool GridLocked; //Operations defined in data_operations -extern int autoCorr(const int* in, int *out, size_t len, int window); +//extern int autoCorr(const int* in, int *out, size_t len, int window); +extern int AskEdgeDetect(const int *in, int *out, int len, int threshold); +extern int AutoCorrelate(const int *in, int *out, size_t len, int window, bool SaveGrph, bool verbose); extern int directionalThreshold(const int* in, int *out, size_t len, int8_t up, int8_t down); extern void save_restoreGB(uint8_t saveOpt); diff --git a/client/proxguiqt.cpp b/client/proxguiqt.cpp index 05a048d8..c1fc7e12 100644 --- a/client/proxguiqt.cpp +++ b/client/proxguiqt.cpp @@ -109,7 +109,7 @@ void ProxWidget::applyOperation() { printf("ApplyOperation()"); save_restoreGB(1); - memcpy(GraphBuffer,s_Buff, sizeof(int) * GraphTraceLen); + memcpy(GraphBuffer, s_Buff, sizeof(int) * GraphTraceLen); RepaintGraphWindow(); } @@ -120,14 +120,23 @@ void ProxWidget::stickOperation() } void ProxWidget::vchange_autocorr(int v) { - autoCorr(GraphBuffer,s_Buff, GraphTraceLen, v); - printf("vchange_autocorr(%d)\n", v); + int ans; + ans = AutoCorrelate(GraphBuffer, s_Buff, GraphTraceLen, v, true, false); + printf("vchange_autocorr(w:%d): %d\n", v, ans); + RepaintGraphWindow(); +} +void ProxWidget::vchange_askedge(int v) +{ + int ans; + //extern int AskEdgeDetect(const int *in, int *out, int len, int threshold); + ans = AskEdgeDetect(GraphBuffer, s_Buff, GraphTraceLen, v); + printf("vchange_askedge(w:%d)\n", v); RepaintGraphWindow(); } void ProxWidget::vchange_dthr_up(int v) { int down = opsController->horizontalSlider_dirthr_down->value(); - directionalThreshold(GraphBuffer,s_Buff, GraphTraceLen, v, down); + directionalThreshold(GraphBuffer, s_Buff, GraphTraceLen, v, down); printf("vchange_dthr_up(%d)", v); RepaintGraphWindow(); @@ -161,6 +170,7 @@ ProxWidget::ProxWidget(QWidget *parent, ProxGuiQT *master) : QWidget(parent) QObject::connect(opsController->horizontalSlider_window, SIGNAL(valueChanged(int)), this, SLOT(vchange_autocorr(int))); QObject::connect(opsController->horizontalSlider_dirthr_up, SIGNAL(valueChanged(int)), this, SLOT(vchange_dthr_up(int))); QObject::connect(opsController->horizontalSlider_dirthr_down, SIGNAL(valueChanged(int)), this, SLOT(vchange_dthr_down(int))); + QObject::connect(opsController->horizontalSlider_askedge, SIGNAL(valueChanged(int)), this, SLOT(vchange_askedge(int))); controlWidget->show(); @@ -178,7 +188,7 @@ ProxWidget::ProxWidget(QWidget *parent, ProxGuiQT *master) : QWidget(parent) //layout->addWidget(slider); layout->addWidget(plot); setLayout(layout); - //printf("Proxwidget Constructor just set layout\r\n"); + printf("Proxwidget Constructor just set layout\r\n"); } diff --git a/client/proxguiqt.h b/client/proxguiqt.h index 794db2d7..fa1ba018 100644 --- a/client/proxguiqt.h +++ b/client/proxguiqt.h @@ -71,6 +71,7 @@ class ProxWidget : public QWidget void applyOperation(); void stickOperation(); void vchange_autocorr(int v); + void vchange_askedge(int v); void vchange_dthr_up(int v); void vchange_dthr_down(int v); }; diff --git a/client/ui/overlays.ui b/client/ui/overlays.ui index 8b7f85e5..7cc9043e 100644 --- a/client/ui/overlays.ui +++ b/client/ui/overlays.ui @@ -17,7 +17,7 @@ - 0 + 1 @@ -29,17 +29,17 @@ - - + + - Window size + - - + + - + Window size @@ -78,8 +78,60 @@ - Askdemod + AskEdge + + + + + 0 + + + + + Edge Jump Threshold + + + + + + + + + + + + + + + + 5 + + + 80 + + + 20 + + + Qt::Horizontal + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + @@ -174,7 +226,7 @@ - Sticky + Restore @@ -194,7 +246,7 @@ - TextLabel + @@ -211,8 +263,8 @@ setNum(int) - 29 - 90 + 46 + 118 597 @@ -227,8 +279,8 @@ setNum(int) - 153 - 84 + 170 + 118 161 @@ -243,8 +295,8 @@ setNum(int) - 53 - 92 + 70 + 118 68 @@ -259,8 +311,8 @@ setNum(int) - 184 - 161 + 201 + 185 149 @@ -268,5 +320,21 @@ + + horizontalSlider_askedge + valueChanged(int) + label_9 + setNum(int) + + + 149 + 102 + + + 250 + 70 + + + diff --git a/client/ui/ui_overlays.h b/client/ui/ui_overlays.h index 83aa3e6c..daa6192b 100644 --- a/client/ui/ui_overlays.h +++ b/client/ui/ui_overlays.h @@ -1,13 +1,13 @@ /******************************************************************************** -** Form generated from reading UI file 'overlaystQ7020.ui' +** Form generated from reading UI file 'overlays.ui' ** -** Created by: Qt User Interface Compiler version 4.8.6 +** Created by: Qt User Interface Compiler version 5.6.1 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ -#ifndef OVERLAYSTQ7020_H -#define OVERLAYSTQ7020_H +#ifndef UI_OVERLAYS_H +#define UI_OVERLAYS_H #include #include @@ -34,11 +34,17 @@ public: QWidget *tab; QVBoxLayout *verticalLayout_2; QFormLayout *formLayout; - QLabel *label; QLabel *label_5; + QLabel *label; QSlider *horizontalSlider_window; QSpacerItem *verticalSpacer; QWidget *tab_3; + QVBoxLayout *verticalLayout_4; + QFormLayout *formLayout_4; + QLabel *label_8; + QLabel *label_9; + QSlider *horizontalSlider_askedge; + QSpacerItem *verticalSpacer_3; QWidget *tab_2; QVBoxLayout *verticalLayout; QFormLayout *formLayout_2; @@ -59,34 +65,34 @@ public: void setupUi(QWidget *Form) { if (Form->objectName().isEmpty()) - Form->setObjectName(QString::fromUtf8("Form")); + Form->setObjectName(QStringLiteral("Form")); Form->resize(614, 286); verticalLayout_3 = new QVBoxLayout(Form); - verticalLayout_3->setObjectName(QString::fromUtf8("verticalLayout_3")); + verticalLayout_3->setObjectName(QStringLiteral("verticalLayout_3")); tabWidget_overlays = new QTabWidget(Form); - tabWidget_overlays->setObjectName(QString::fromUtf8("tabWidget_overlays")); + tabWidget_overlays->setObjectName(QStringLiteral("tabWidget_overlays")); tab = new QWidget(); - tab->setObjectName(QString::fromUtf8("tab")); + tab->setObjectName(QStringLiteral("tab")); tab->setFocusPolicy(Qt::StrongFocus); verticalLayout_2 = new QVBoxLayout(tab); - verticalLayout_2->setObjectName(QString::fromUtf8("verticalLayout_2")); + verticalLayout_2->setObjectName(QStringLiteral("verticalLayout_2")); formLayout = new QFormLayout(); - formLayout->setObjectName(QString::fromUtf8("formLayout")); - label = new QLabel(tab); - label->setObjectName(QString::fromUtf8("label")); - - formLayout->setWidget(0, QFormLayout::LabelRole, label); - + formLayout->setObjectName(QStringLiteral("formLayout")); label_5 = new QLabel(tab); - label_5->setObjectName(QString::fromUtf8("label_5")); + label_5->setObjectName(QStringLiteral("label_5")); formLayout->setWidget(0, QFormLayout::FieldRole, label_5); + label = new QLabel(tab); + label->setObjectName(QStringLiteral("label")); + + formLayout->setWidget(0, QFormLayout::LabelRole, label); + verticalLayout_2->addLayout(formLayout); horizontalSlider_window = new QSlider(tab); - horizontalSlider_window->setObjectName(QString::fromUtf8("horizontalSlider_window")); + horizontalSlider_window->setObjectName(QStringLiteral("horizontalSlider_window")); horizontalSlider_window->setMinimum(10); horizontalSlider_window->setMaximum(10000); horizontalSlider_window->setValue(2000); @@ -100,21 +106,52 @@ public: tabWidget_overlays->addTab(tab, QString()); tab_3 = new QWidget(); - tab_3->setObjectName(QString::fromUtf8("tab_3")); + tab_3->setObjectName(QStringLiteral("tab_3")); + verticalLayout_4 = new QVBoxLayout(tab_3); + verticalLayout_4->setObjectName(QStringLiteral("verticalLayout_4")); + formLayout_4 = new QFormLayout(); + formLayout_4->setObjectName(QStringLiteral("formLayout_4")); + formLayout_4->setContentsMargins(-1, -1, -1, 0); + label_8 = new QLabel(tab_3); + label_8->setObjectName(QStringLiteral("label_8")); + + formLayout_4->setWidget(0, QFormLayout::LabelRole, label_8); + + label_9 = new QLabel(tab_3); + label_9->setObjectName(QStringLiteral("label_9")); + + formLayout_4->setWidget(0, QFormLayout::FieldRole, label_9); + + + verticalLayout_4->addLayout(formLayout_4); + + horizontalSlider_askedge = new QSlider(tab_3); + horizontalSlider_askedge->setObjectName(QStringLiteral("horizontalSlider_askedge")); + horizontalSlider_askedge->setMinimum(5); + horizontalSlider_askedge->setMaximum(80); + horizontalSlider_askedge->setValue(20); + horizontalSlider_askedge->setOrientation(Qt::Horizontal); + + verticalLayout_4->addWidget(horizontalSlider_askedge); + + verticalSpacer_3 = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding); + + verticalLayout_4->addItem(verticalSpacer_3); + tabWidget_overlays->addTab(tab_3, QString()); tab_2 = new QWidget(); - tab_2->setObjectName(QString::fromUtf8("tab_2")); + tab_2->setObjectName(QStringLiteral("tab_2")); verticalLayout = new QVBoxLayout(tab_2); - verticalLayout->setObjectName(QString::fromUtf8("verticalLayout")); + verticalLayout->setObjectName(QStringLiteral("verticalLayout")); formLayout_2 = new QFormLayout(); - formLayout_2->setObjectName(QString::fromUtf8("formLayout_2")); + formLayout_2->setObjectName(QStringLiteral("formLayout_2")); label_2 = new QLabel(tab_2); - label_2->setObjectName(QString::fromUtf8("label_2")); + label_2->setObjectName(QStringLiteral("label_2")); formLayout_2->setWidget(0, QFormLayout::LabelRole, label_2); label_6 = new QLabel(tab_2); - label_6->setObjectName(QString::fromUtf8("label_6")); + label_6->setObjectName(QStringLiteral("label_6")); formLayout_2->setWidget(0, QFormLayout::FieldRole, label_6); @@ -122,7 +159,7 @@ public: verticalLayout->addLayout(formLayout_2); horizontalSlider_dirthr_up = new QSlider(tab_2); - horizontalSlider_dirthr_up->setObjectName(QString::fromUtf8("horizontalSlider_dirthr_up")); + horizontalSlider_dirthr_up->setObjectName(QStringLiteral("horizontalSlider_dirthr_up")); horizontalSlider_dirthr_up->setMaximum(128); horizontalSlider_dirthr_up->setValue(20); horizontalSlider_dirthr_up->setOrientation(Qt::Horizontal); @@ -130,14 +167,14 @@ public: verticalLayout->addWidget(horizontalSlider_dirthr_up); formLayout_3 = new QFormLayout(); - formLayout_3->setObjectName(QString::fromUtf8("formLayout_3")); + formLayout_3->setObjectName(QStringLiteral("formLayout_3")); label_3 = new QLabel(tab_2); - label_3->setObjectName(QString::fromUtf8("label_3")); + label_3->setObjectName(QStringLiteral("label_3")); formLayout_3->setWidget(0, QFormLayout::LabelRole, label_3); label_7 = new QLabel(tab_2); - label_7->setObjectName(QString::fromUtf8("label_7")); + label_7->setObjectName(QStringLiteral("label_7")); formLayout_3->setWidget(0, QFormLayout::FieldRole, label_7); @@ -145,7 +182,7 @@ public: verticalLayout->addLayout(formLayout_3); horizontalSlider_dirthr_down = new QSlider(tab_2); - horizontalSlider_dirthr_down->setObjectName(QString::fromUtf8("horizontalSlider_dirthr_down")); + horizontalSlider_dirthr_down->setObjectName(QStringLiteral("horizontalSlider_dirthr_down")); horizontalSlider_dirthr_down->setMaximum(127); horizontalSlider_dirthr_down->setOrientation(Qt::Horizontal); @@ -160,14 +197,14 @@ public: verticalLayout_3->addWidget(tabWidget_overlays); horizontalLayout = new QHBoxLayout(); - horizontalLayout->setObjectName(QString::fromUtf8("horizontalLayout")); + horizontalLayout->setObjectName(QStringLiteral("horizontalLayout")); pushButton_apply = new QPushButton(Form); - pushButton_apply->setObjectName(QString::fromUtf8("pushButton_apply")); + pushButton_apply->setObjectName(QStringLiteral("pushButton_apply")); horizontalLayout->addWidget(pushButton_apply); pushButton_sticky = new QPushButton(Form); - pushButton_sticky->setObjectName(QString::fromUtf8("pushButton_sticky")); + pushButton_sticky->setObjectName(QStringLiteral("pushButton_sticky")); horizontalLayout->addWidget(pushButton_sticky); @@ -176,7 +213,7 @@ public: horizontalLayout->addItem(horizontalSpacer); label_4 = new QLabel(Form); - label_4->setObjectName(QString::fromUtf8("label_4")); + label_4->setObjectName(QStringLiteral("label_4")); horizontalLayout->addWidget(label_4); @@ -189,8 +226,9 @@ public: QObject::connect(horizontalSlider_window, SIGNAL(valueChanged(int)), label_5, SLOT(setNum(int))); QObject::connect(horizontalSlider_dirthr_up, SIGNAL(valueChanged(int)), label_6, SLOT(setNum(int))); QObject::connect(horizontalSlider_dirthr_down, SIGNAL(valueChanged(int)), label_7, SLOT(setNum(int))); + QObject::connect(horizontalSlider_askedge, SIGNAL(valueChanged(int)), label_9, SLOT(setNum(int))); - tabWidget_overlays->setCurrentIndex(0); + tabWidget_overlays->setCurrentIndex(1); QMetaObject::connectSlotsByName(Form); @@ -199,18 +237,20 @@ public: void retranslateUi(QWidget *Form) { Form->setWindowTitle(QApplication::translate("Form", "Overlays", 0)); - label->setText(QApplication::translate("Form", "Window size", 0)); label_5->setText(QString()); + label->setText(QApplication::translate("Form", "Window size", 0)); tabWidget_overlays->setTabText(tabWidget_overlays->indexOf(tab), QApplication::translate("Form", "Autocorrelate", 0)); - tabWidget_overlays->setTabText(tabWidget_overlays->indexOf(tab_3), QApplication::translate("Form", "Askdemod", 0)); + label_8->setText(QApplication::translate("Form", "Edge Jump Threshold", 0)); + label_9->setText(QString()); + tabWidget_overlays->setTabText(tabWidget_overlays->indexOf(tab_3), QApplication::translate("Form", "AskEdge", 0)); label_2->setText(QApplication::translate("Form", "Up", 0)); label_6->setText(QString()); label_3->setText(QApplication::translate("Form", "Down", 0)); label_7->setText(QString()); tabWidget_overlays->setTabText(tabWidget_overlays->indexOf(tab_2), QApplication::translate("Form", "Dirthreshold", 0)); pushButton_apply->setText(QApplication::translate("Form", "Apply", 0)); - pushButton_sticky->setText(QApplication::translate("Form", "Sticky", 0)); - label_4->setText(QApplication::translate("Form", "TextLabel", 0)); + pushButton_sticky->setText(QApplication::translate("Form", "Restore", 0)); + label_4->setText(QString()); } // retranslateUi }; @@ -221,4 +261,4 @@ namespace Ui { QT_END_NAMESPACE -#endif // OVERLAYSTQ7020_H +#endif // UI_OVERLAYS_H diff --git a/common/lfdemod.c b/common/lfdemod.c index 072bd120..be9d3613 100644 --- a/common/lfdemod.c +++ b/common/lfdemod.c @@ -1490,7 +1490,7 @@ size_t aggregate_bits(uint8_t *dest, size_t size, uint8_t rfLen, uint8_t invert, //by marshmellow (from holiman's base) // full fsk demod from GraphBuffer wave to decoded 1s and 0s (no mandemod) int fskdemod_ext(uint8_t *dest, size_t size, uint8_t rfLen, uint8_t invert, uint8_t fchigh, uint8_t fclow, int *startIdx) { - if (justNoise(dest, *size)) return 0; + if (justNoise(dest, size)) return 0; // FSK demodulator size = fsk_wave_demod(dest, size, fchigh, fclow, startIdx); size = aggregate_bits(dest, size, rfLen, invert, fchigh, fclow, startIdx);