mirror of
https://github.com/Proxmark/proxmark3.git
synced 2025-03-12 04:35:36 -07:00
combine autocorr, dirth functions
fix lfdemod bug add askedge to overlays (remove askdemod)
This commit is contained in:
parent
9fe4507c03
commit
c4f51073fc
102
client/cmddata.c
102
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<len; i++) {
|
||||
if (in[i]-in[i-1] >= 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<GraphTraceLen; i++){
|
||||
if (GraphBuffer[i]-GraphBuffer[i-1]>=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,6 +1438,34 @@ int CmdScale(const char *Cmd)
|
||||
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;
|
||||
}
|
||||
|
||||
int CmdDirectionalThreshold(const char *Cmd)
|
||||
{
|
||||
int8_t upThres = param_get8(Cmd, 0);
|
||||
@ -1440,30 +1473,7 @@ int CmdDirectionalThreshold(const char *Cmd)
|
||||
|
||||
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.
|
||||
|
||||
for (int i = 1; i < GraphTraceLen; ++i) {
|
||||
// Apply first threshold to samples heading up
|
||||
if (GraphBuffer[i] >= upThres && GraphBuffer[i] > lastValue)
|
||||
{
|
||||
lastValue = GraphBuffer[i]; // Buffer last value as we overwrite it.
|
||||
GraphBuffer[i] = 127;
|
||||
}
|
||||
// Apply second threshold to samples heading down
|
||||
else if (GraphBuffer[i] <= downThres && GraphBuffer[i] < lastValue)
|
||||
{
|
||||
lastValue = GraphBuffer[i]; // Buffer last value as we overwrite it.
|
||||
GraphBuffer[i] = -127;
|
||||
}
|
||||
else
|
||||
{
|
||||
lastValue = GraphBuffer[i]; // Buffer last value as we overwrite it.
|
||||
GraphBuffer[i] = GraphBuffer[i-1];
|
||||
|
||||
}
|
||||
}
|
||||
GraphBuffer[0] = GraphBuffer[1]; // Aline with first edited sample.
|
||||
directionalThreshold(GraphBuffer, GraphBuffer,GraphTraceLen, upThres, downThres);
|
||||
RepaintGraphWindow();
|
||||
return 0;
|
||||
}
|
||||
|
@ -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];
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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");
|
||||
}
|
||||
|
||||
|
||||
|
@ -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);
|
||||
};
|
||||
|
@ -17,7 +17,7 @@
|
||||
<item>
|
||||
<widget class="QTabWidget" name="tabWidget_overlays">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
<number>1</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab">
|
||||
<property name="focusPolicy">
|
||||
@ -29,13 +29,6 @@
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Window size</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
@ -43,6 +36,13 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Window size</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
@ -78,8 +78,60 @@
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_3">
|
||||
<attribute name="title">
|
||||
<string>Askdemod</string>
|
||||
<string>AskEdge</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout_4">
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
<string>Edge Jump Threshold</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSlider" name="horizontalSlider_askedge">
|
||||
<property name="minimum">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>80</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>20</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_2">
|
||||
<attribute name="title">
|
||||
@ -174,7 +226,7 @@
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_sticky">
|
||||
<property name="text">
|
||||
<string>Sticky</string>
|
||||
<string>Restore</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -194,7 +246,7 @@
|
||||
<item>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -211,8 +263,8 @@
|
||||
<slot>setNum(int)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>29</x>
|
||||
<y>90</y>
|
||||
<x>46</x>
|
||||
<y>118</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>597</x>
|
||||
@ -227,8 +279,8 @@
|
||||
<slot>setNum(int)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>153</x>
|
||||
<y>84</y>
|
||||
<x>170</x>
|
||||
<y>118</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>161</x>
|
||||
@ -243,8 +295,8 @@
|
||||
<slot>setNum(int)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>53</x>
|
||||
<y>92</y>
|
||||
<x>70</x>
|
||||
<y>118</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>68</x>
|
||||
@ -259,8 +311,8 @@
|
||||
<slot>setNum(int)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>184</x>
|
||||
<y>161</y>
|
||||
<x>201</x>
|
||||
<y>185</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>149</x>
|
||||
@ -268,5 +320,21 @@
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>horizontalSlider_askedge</sender>
|
||||
<signal>valueChanged(int)</signal>
|
||||
<receiver>label_9</receiver>
|
||||
<slot>setNum(int)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>149</x>
|
||||
<y>102</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>250</x>
|
||||
<y>70</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
|
@ -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 <QtCore/QVariant>
|
||||
#include <QAction>
|
||||
@ -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
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user