mirror of
https://github.com/Proxmark/proxmark3.git
synced 2025-08-20 13:23:25 -07:00
Merge pull request #278 from marshmellow42/graphwork
Update Graphing Part1
This commit is contained in:
commit
2deb4b6b46
30 changed files with 1171 additions and 267 deletions
127
client/cmddata.c
127
client/cmddata.c
|
@ -28,6 +28,8 @@
|
||||||
uint8_t DemodBuffer[MAX_DEMOD_BUF_LEN];
|
uint8_t DemodBuffer[MAX_DEMOD_BUF_LEN];
|
||||||
uint8_t g_debugMode=0;
|
uint8_t g_debugMode=0;
|
||||||
size_t DemodBufferLen=0;
|
size_t DemodBufferLen=0;
|
||||||
|
int g_DemodStartIdx=0;
|
||||||
|
int g_DemodClock=0;
|
||||||
|
|
||||||
static int CmdHelp(const char *Cmd);
|
static int CmdHelp(const char *Cmd);
|
||||||
|
|
||||||
|
@ -245,7 +247,6 @@ int ASKDemod_ext(const char *Cmd, bool verbose, bool emSearch, uint8_t askType,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (verbose || g_debugMode) PrintAndLog("\nUsing Clock:%d, Invert:%d, Bits Found:%d",clk,invert,BitLen);
|
if (verbose || g_debugMode) PrintAndLog("\nUsing Clock:%d, Invert:%d, Bits Found:%d",clk,invert,BitLen);
|
||||||
|
|
||||||
//output
|
//output
|
||||||
setDemodBuf(BitStream,BitLen,0);
|
setDemodBuf(BitStream,BitLen,0);
|
||||||
setClockGrid(clk, startIdx);
|
setClockGrid(clk, startIdx);
|
||||||
|
@ -295,11 +296,11 @@ int Cmdaskmandemod(const char *Cmd)
|
||||||
}
|
}
|
||||||
bool st = true;
|
bool st = true;
|
||||||
if (Cmd[0]=='s')
|
if (Cmd[0]=='s')
|
||||||
return ASKDemod_ext(Cmd++, true, true, 1, &st);
|
return ASKDemod_ext(Cmd++, true, false, 1, &st);
|
||||||
else if (Cmd[1] == 's')
|
else if (Cmd[1] == 's')
|
||||||
return ASKDemod_ext(Cmd+=2, true, true, 1, &st);
|
return ASKDemod_ext(Cmd+=2, true, false, 1, &st);
|
||||||
else
|
else
|
||||||
return ASKDemod(Cmd, true, true, 1);
|
return ASKDemod(Cmd, true, false, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
//by marshmellow
|
//by marshmellow
|
||||||
|
@ -393,7 +394,7 @@ int CmdBiphaseDecodeRaw(const char *Cmd)
|
||||||
uint8_t BitStream[MAX_DEMOD_BUF_LEN]={0};
|
uint8_t BitStream[MAX_DEMOD_BUF_LEN]={0};
|
||||||
size = sizeof(BitStream);
|
size = sizeof(BitStream);
|
||||||
if ( !getDemodBuf(BitStream, &size) ) return 0;
|
if ( !getDemodBuf(BitStream, &size) ) return 0;
|
||||||
errCnt=BiphaseRawDecode(BitStream, &size, offset, invert);
|
errCnt=BiphaseRawDecode(BitStream, &size, &offset, invert);
|
||||||
if (errCnt<0){
|
if (errCnt<0){
|
||||||
PrintAndLog("Error during decode:%d", errCnt);
|
PrintAndLog("Error during decode:%d", errCnt);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -406,10 +407,12 @@ int CmdBiphaseDecodeRaw(const char *Cmd)
|
||||||
if (errCnt>0){
|
if (errCnt>0){
|
||||||
PrintAndLog("# Errors found during Demod (shown as 7 in bit stream): %d",errCnt);
|
PrintAndLog("# Errors found during Demod (shown as 7 in bit stream): %d",errCnt);
|
||||||
}
|
}
|
||||||
|
|
||||||
PrintAndLog("Biphase Decoded using offset: %d - # invert:%d - data:",offset,invert);
|
PrintAndLog("Biphase Decoded using offset: %d - # invert:%d - data:",offset,invert);
|
||||||
PrintAndLog("%s", sprint_bin_break(BitStream, size, 16));
|
PrintAndLog("%s", sprint_bin_break(BitStream, size, 16));
|
||||||
|
|
||||||
if (offset) setDemodBuf(DemodBuffer,DemodBufferLen-offset, offset); //remove first bit from raw demod
|
if (offset) setDemodBuf(DemodBuffer,DemodBufferLen-offset, offset); //remove first bit from raw demod
|
||||||
|
setClockGrid(g_DemodClock, g_DemodStartIdx + g_DemodClock*offset/2);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -423,15 +426,16 @@ int ASKbiphaseDemod(const char *Cmd, bool verbose)
|
||||||
|
|
||||||
uint8_t BitStream[MAX_GRAPH_TRACE_LEN];
|
uint8_t BitStream[MAX_GRAPH_TRACE_LEN];
|
||||||
size_t size = getFromGraphBuf(BitStream);
|
size_t size = getFromGraphBuf(BitStream);
|
||||||
|
int startIdx = 0;
|
||||||
//invert here inverts the ask raw demoded bits which has no effect on the demod, but we need the pointer
|
//invert here inverts the ask raw demoded bits which has no effect on the demod, but we need the pointer
|
||||||
int errCnt = askdemod(BitStream, &size, &clk, &invert, maxErr, 0, 0);
|
int errCnt = askdemod_ext(BitStream, &size, &clk, &invert, maxErr, 0, 0, &startIdx);
|
||||||
if ( errCnt < 0 || errCnt > maxErr ) {
|
if ( errCnt < 0 || errCnt > maxErr ) {
|
||||||
if (g_debugMode) PrintAndLog("DEBUG: no data or error found %d, clock: %d", errCnt, clk);
|
if (g_debugMode) PrintAndLog("DEBUG: no data or error found %d, clock: %d", errCnt, clk);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//attempt to Biphase decode BitStream
|
//attempt to Biphase decode BitStream
|
||||||
errCnt = BiphaseRawDecode(BitStream, &size, offset, invert);
|
errCnt = BiphaseRawDecode(BitStream, &size, &offset, invert);
|
||||||
if (errCnt < 0){
|
if (errCnt < 0){
|
||||||
if (g_debugMode || verbose) PrintAndLog("Error BiphaseRawDecode: %d", errCnt);
|
if (g_debugMode || verbose) PrintAndLog("Error BiphaseRawDecode: %d", errCnt);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -442,6 +446,7 @@ int ASKbiphaseDemod(const char *Cmd, bool verbose)
|
||||||
}
|
}
|
||||||
//success set DemodBuffer and return
|
//success set DemodBuffer and return
|
||||||
setDemodBuf(BitStream, size, 0);
|
setDemodBuf(BitStream, size, 0);
|
||||||
|
setClockGrid(clk, startIdx + clk*offset/2);
|
||||||
if (g_debugMode || verbose){
|
if (g_debugMode || verbose){
|
||||||
PrintAndLog("Biphase Decoded using offset: %d - clock: %d - # errors:%d - data:",offset,clk,errCnt);
|
PrintAndLog("Biphase Decoded using offset: %d - clock: %d - # errors:%d - data:",offset,clk,errCnt);
|
||||||
printDemodBuff();
|
printDemodBuff();
|
||||||
|
@ -502,45 +507,44 @@ int Cmdaskrawdemod(const char *Cmd)
|
||||||
return ASKDemod(Cmd, true, false, 0);
|
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];
|
static int CorrelBuffer[MAX_GRAPH_TRACE_LEN];
|
||||||
size_t Correlation = 0;
|
size_t Correlation = 0;
|
||||||
int maxSum = 0;
|
int maxSum = 0;
|
||||||
int lastMax = 0;
|
int lastMax = 0;
|
||||||
if (verbose) PrintAndLog("performing %d correlations", GraphTraceLen - window);
|
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;
|
int sum = 0;
|
||||||
for (int j = 0; j < window; ++j) {
|
for (int j = 0; j < window; ++j) {
|
||||||
sum += (GraphBuffer[j]*GraphBuffer[i + j]) / 256;
|
sum += (in[j]*in[i + j]) / 256;
|
||||||
}
|
}
|
||||||
CorrelBuffer[i] = sum;
|
CorrelBuffer[i] = sum;
|
||||||
if (sum >= maxSum-100 && sum <= maxSum+100){
|
if (sum >= maxSum-100 && sum <= maxSum+100) {
|
||||||
//another max
|
//another max
|
||||||
Correlation = i-lastMax;
|
Correlation = i-lastMax;
|
||||||
lastMax = i;
|
lastMax = i;
|
||||||
if (sum > maxSum) maxSum = sum;
|
if (sum > maxSum) maxSum = sum;
|
||||||
} else if (sum > maxSum){
|
} else if (sum > maxSum) {
|
||||||
maxSum=sum;
|
maxSum=sum;
|
||||||
lastMax = i;
|
lastMax = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Correlation==0){
|
if (Correlation==0) {
|
||||||
//try again with wider margin
|
//try again with wider margin
|
||||||
for (int i = 0; i < GraphTraceLen - window; i++){
|
for (int i = 0; i < len - window; i++) {
|
||||||
if (CorrelBuffer[i] >= maxSum-(maxSum*0.05) && CorrelBuffer[i] <= maxSum+(maxSum*0.05)){
|
if (CorrelBuffer[i] >= maxSum-(maxSum*0.05) && CorrelBuffer[i] <= maxSum+(maxSum*0.05)) {
|
||||||
//another max
|
//another max
|
||||||
Correlation = i-lastMax;
|
Correlation = i-lastMax;
|
||||||
lastMax = i;
|
lastMax = i;
|
||||||
//if (CorrelBuffer[i] > maxSum) maxSum = sum;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (verbose && Correlation > 0) PrintAndLog("Possible Correlation: %d samples",Correlation);
|
if (verbose && Correlation > 0) PrintAndLog("Possible Correlation: %d samples",Correlation);
|
||||||
|
|
||||||
if (SaveGrph){
|
if (SaveGrph) {
|
||||||
GraphTraceLen = GraphTraceLen - window;
|
//GraphTraceLen = GraphTraceLen - window;
|
||||||
memcpy(GraphBuffer, CorrelBuffer, GraphTraceLen * sizeof (int));
|
memcpy(out, CorrelBuffer, len * sizeof(int));
|
||||||
RepaintGraphWindow();
|
RepaintGraphWindow();
|
||||||
}
|
}
|
||||||
return Correlation;
|
return Correlation;
|
||||||
|
@ -573,7 +577,7 @@ int CmdAutoCorr(const char *Cmd)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (grph == 'g') updateGrph=true;
|
if (grph == 'g') updateGrph=true;
|
||||||
return AutoCorrelate(window, updateGrph, true);
|
return AutoCorrelate(GraphBuffer, GraphBuffer, GraphTraceLen, window, updateGrph, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
int CmdBitsamples(const char *Cmd)
|
int CmdBitsamples(const char *Cmd)
|
||||||
|
@ -676,6 +680,18 @@ int CmdGraphShiftZero(const char *Cmd)
|
||||||
return 0;
|
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
|
//by marshmellow
|
||||||
//use large jumps in read samples to identify edges of waves and then amplify that wave to max
|
//use large jumps in read samples to identify edges of waves and then amplify that wave to max
|
||||||
//similar to dirtheshold, threshold commands
|
//similar to dirtheshold, threshold commands
|
||||||
|
@ -683,18 +699,12 @@ int CmdGraphShiftZero(const char *Cmd)
|
||||||
int CmdAskEdgeDetect(const char *Cmd)
|
int CmdAskEdgeDetect(const char *Cmd)
|
||||||
{
|
{
|
||||||
int thresLen = 25;
|
int thresLen = 25;
|
||||||
int Last = 0;
|
int ans = 0;
|
||||||
sscanf(Cmd, "%i", &thresLen);
|
sscanf(Cmd, "%i", &thresLen);
|
||||||
|
|
||||||
for(int i = 1; i<GraphTraceLen; i++){
|
ans = AskEdgeDetect(GraphBuffer, GraphBuffer, GraphTraceLen, thresLen);
|
||||||
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;
|
|
||||||
}
|
|
||||||
RepaintGraphWindow();
|
RepaintGraphWindow();
|
||||||
return 0;
|
return ans;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Print our clock rate */
|
/* Print our clock rate */
|
||||||
|
@ -1057,6 +1067,10 @@ int CmdRawDemod(const char *Cmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
void setClockGrid(int clk, int offset) {
|
void setClockGrid(int clk, int offset) {
|
||||||
|
g_DemodStartIdx = offset;
|
||||||
|
g_DemodClock = clk;
|
||||||
|
if (g_debugMode) PrintAndLog("demodoffset %d, clk %d",offset,clk);
|
||||||
|
|
||||||
if (offset > clk) offset %= clk;
|
if (offset > clk) offset %= clk;
|
||||||
if (offset < 0) offset += clk;
|
if (offset < 0) offset += clk;
|
||||||
|
|
||||||
|
@ -1213,6 +1227,7 @@ int getSamples(int n, bool silent)
|
||||||
GraphTraceLen = n;
|
GraphTraceLen = n;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setClockGrid(0,0);
|
||||||
RepaintGraphWindow();
|
RepaintGraphWindow();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1316,6 +1331,7 @@ int CmdLoad(const char *Cmd)
|
||||||
}
|
}
|
||||||
fclose(f);
|
fclose(f);
|
||||||
PrintAndLog("loaded %d samples", GraphTraceLen);
|
PrintAndLog("loaded %d samples", GraphTraceLen);
|
||||||
|
setClockGrid(0,0);
|
||||||
RepaintGraphWindow();
|
RepaintGraphWindow();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1423,6 +1439,34 @@ int CmdScale(const char *Cmd)
|
||||||
return 0;
|
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)
|
int CmdDirectionalThreshold(const char *Cmd)
|
||||||
{
|
{
|
||||||
int8_t upThres = param_get8(Cmd, 0);
|
int8_t upThres = param_get8(Cmd, 0);
|
||||||
|
@ -1430,30 +1474,7 @@ int CmdDirectionalThreshold(const char *Cmd)
|
||||||
|
|
||||||
printf("Applying Up Threshold: %d, Down Threshold: %d\n", upThres, downThres);
|
printf("Applying Up Threshold: %d, Down Threshold: %d\n", upThres, downThres);
|
||||||
|
|
||||||
int lastValue = GraphBuffer[0];
|
directionalThreshold(GraphBuffer, GraphBuffer,GraphTraceLen, upThres, downThres);
|
||||||
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.
|
|
||||||
RepaintGraphWindow();
|
RepaintGraphWindow();
|
||||||
return 0;
|
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 CmdPrintDemodBuff(const char *Cmd);
|
||||||
int Cmdaskrawdemod(const char *Cmd);
|
int Cmdaskrawdemod(const char *Cmd);
|
||||||
int Cmdaskmandemod(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 CmdAutoCorr(const char *Cmd);
|
||||||
int CmdBiphaseDecodeRaw(const char *Cmd);
|
int CmdBiphaseDecodeRaw(const char *Cmd);
|
||||||
int CmdBitsamples(const char *Cmd);
|
int CmdBitsamples(const char *Cmd);
|
||||||
|
@ -65,10 +65,15 @@ int PSKDemod(const char *Cmd, bool verbose);
|
||||||
int NRZrawDemod(const char *Cmd, bool verbose);
|
int NRZrawDemod(const char *Cmd, bool verbose);
|
||||||
int getSamples(int n, bool silent);
|
int getSamples(int n, bool silent);
|
||||||
void setClockGrid(int clk, int offset);
|
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)
|
#define MAX_DEMOD_BUF_LEN (1024*128)
|
||||||
extern uint8_t DemodBuffer[MAX_DEMOD_BUF_LEN];
|
extern uint8_t DemodBuffer[MAX_DEMOD_BUF_LEN];
|
||||||
extern size_t DemodBufferLen;
|
extern size_t DemodBufferLen;
|
||||||
|
extern int g_DemodStartIdx;
|
||||||
|
extern int g_DemodClock;
|
||||||
extern uint8_t g_debugMode;
|
extern uint8_t g_debugMode;
|
||||||
#define BIGBUF_SIZE 40000
|
#define BIGBUF_SIZE 40000
|
||||||
|
|
||||||
|
|
|
@ -1059,14 +1059,14 @@ int CmdLFfind(const char *Cmd)
|
||||||
ans=CheckChipType(cmdp);
|
ans=CheckChipType(cmdp);
|
||||||
//test unknown tag formats (raw mode)0
|
//test unknown tag formats (raw mode)0
|
||||||
PrintAndLog("\nChecking for Unknown tags:\n");
|
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);
|
if (ans > 0) PrintAndLog("Possible Auto Correlation of %d repeating samples",ans);
|
||||||
ans=GetFskClock("",false,false);
|
ans=GetFskClock("",false,false);
|
||||||
if (ans != 0) { //fsk
|
if (ans != 0) { //fsk
|
||||||
ans=FSKrawDemod("",true);
|
ans=FSKrawDemod("",true);
|
||||||
if (ans>0) {
|
if (ans>0) {
|
||||||
PrintAndLog("\nUnknown FSK Modulated Tag Found!");
|
PrintAndLog("\nUnknown FSK Modulated Tag Found!");
|
||||||
return CheckChipType(cmdp);;
|
return CheckChipType(cmdp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bool st = true;
|
bool st = true;
|
||||||
|
@ -1074,14 +1074,14 @@ int CmdLFfind(const char *Cmd)
|
||||||
if (ans>0) {
|
if (ans>0) {
|
||||||
PrintAndLog("\nUnknown ASK Modulated and Manchester encoded Tag Found!");
|
PrintAndLog("\nUnknown ASK Modulated and Manchester encoded Tag Found!");
|
||||||
PrintAndLog("\nif it does not look right it could instead be ASK/Biphase - try 'data rawdemod ab'");
|
PrintAndLog("\nif it does not look right it could instead be ASK/Biphase - try 'data rawdemod ab'");
|
||||||
return CheckChipType(cmdp);;
|
return CheckChipType(cmdp);
|
||||||
}
|
}
|
||||||
ans=CmdPSK1rawDemod("");
|
ans=CmdPSK1rawDemod("");
|
||||||
if (ans>0) {
|
if (ans>0) {
|
||||||
PrintAndLog("Possible unknown PSK1 Modulated Tag Found above!\n\nCould also be PSK2 - try 'data rawdemod p2'");
|
PrintAndLog("Possible unknown PSK1 Modulated Tag Found above!\n\nCould also be PSK2 - try 'data rawdemod p2'");
|
||||||
PrintAndLog("\nCould also be PSK3 - [currently not supported]");
|
PrintAndLog("\nCould also be PSK3 - [currently not supported]");
|
||||||
PrintAndLog("\nCould also be NRZ - try 'data nrzrawdemod'");
|
PrintAndLog("\nCould also be NRZ - try 'data nrzrawdemod'");
|
||||||
return CheckChipType(cmdp);;
|
return CheckChipType(cmdp);
|
||||||
}
|
}
|
||||||
ans = CheckChipType(cmdp);
|
ans = CheckChipType(cmdp);
|
||||||
PrintAndLog("\nNo Data Found!\n");
|
PrintAndLog("\nNo Data Found!\n");
|
||||||
|
|
|
@ -126,6 +126,7 @@ int CmdFSKdemodAWID(const char *Cmd)
|
||||||
uint32_t rawHi = bytebits_to_byte(BitStream+idx+32,32);
|
uint32_t rawHi = bytebits_to_byte(BitStream+idx+32,32);
|
||||||
uint32_t rawHi2 = bytebits_to_byte(BitStream+idx,32);
|
uint32_t rawHi2 = bytebits_to_byte(BitStream+idx,32);
|
||||||
setDemodBuf(BitStream,96,idx);
|
setDemodBuf(BitStream,96,idx);
|
||||||
|
setClockGrid(g_DemodClock, g_DemodStartIdx + (idx*g_DemodClock));
|
||||||
|
|
||||||
size = removeParity(BitStream, idx+8, 4, 1, 88);
|
size = removeParity(BitStream, idx+8, 4, 1, 88);
|
||||||
if (size != 66){
|
if (size != 66){
|
||||||
|
|
|
@ -152,7 +152,9 @@ int AskEm410xDecode(bool verbose, uint32_t *hi, uint64_t *lo )
|
||||||
|
|
||||||
if (Em410xDecode(BitStream, &BitLen, &idx, hi, lo)) {
|
if (Em410xDecode(BitStream, &BitLen, &idx, hi, lo)) {
|
||||||
//set GraphBuffer for clone or sim command
|
//set GraphBuffer for clone or sim command
|
||||||
setDemodBuf(BitStream, BitLen, idx);
|
setDemodBuf(DemodBuffer, (BitLen==40) ? 64 : 128, idx+1);
|
||||||
|
setClockGrid(g_DemodClock, g_DemodStartIdx + ((idx+1)*g_DemodClock));
|
||||||
|
|
||||||
if (g_debugMode) {
|
if (g_debugMode) {
|
||||||
PrintAndLog("DEBUG: idx: %d, Len: %d, Printing Demod Buffer:", idx, BitLen);
|
PrintAndLog("DEBUG: idx: %d, Len: %d, Printing Demod Buffer:", idx, BitLen);
|
||||||
printDemodBuff();
|
printDemodBuff();
|
||||||
|
@ -703,6 +705,8 @@ bool EM4x05testDemodReadData(uint32_t *word, bool readCmd) {
|
||||||
}
|
}
|
||||||
|
|
||||||
setDemodBuf(DemodBuffer, 32, 0);
|
setDemodBuf(DemodBuffer, 32, 0);
|
||||||
|
//setClockGrid(0,0);
|
||||||
|
|
||||||
*word = bytebits_to_byteLSBF(DemodBuffer, 32);
|
*word = bytebits_to_byteLSBF(DemodBuffer, 32);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -159,6 +159,8 @@ int CmdFdxDemod(const char *Cmd){
|
||||||
|
|
||||||
// set and leave DemodBuffer intact
|
// set and leave DemodBuffer intact
|
||||||
setDemodBuf(DemodBuffer, 128, preambleIndex);
|
setDemodBuf(DemodBuffer, 128, preambleIndex);
|
||||||
|
setClockGrid(g_DemodClock, g_DemodStartIdx + (preambleIndex*g_DemodClock));
|
||||||
|
|
||||||
uint8_t bits_no_spacer[117];
|
uint8_t bits_no_spacer[117];
|
||||||
memcpy(bits_no_spacer, DemodBuffer + 11, 117);
|
memcpy(bits_no_spacer, DemodBuffer + 11, 117);
|
||||||
|
|
||||||
|
|
|
@ -83,7 +83,9 @@ int CmdG_Prox_II_Demod(const char *Cmd)
|
||||||
PrintAndLog("Decoded Raw: %s", sprint_hex(ByteStream, 8));
|
PrintAndLog("Decoded Raw: %s", sprint_hex(ByteStream, 8));
|
||||||
}
|
}
|
||||||
PrintAndLog("Raw: %08x%08x%08x", raw1,raw2,raw3);
|
PrintAndLog("Raw: %08x%08x%08x", raw1,raw2,raw3);
|
||||||
setDemodBuf(DemodBuffer+ans, 96, 0);
|
setDemodBuf(DemodBuffer, 96, ans);
|
||||||
|
setClockGrid(g_DemodClock, g_DemodStartIdx + (ans*g_DemodClock));
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
//by marshmellow
|
//by marshmellow
|
||||||
|
|
|
@ -99,6 +99,7 @@ int CmdFSKdemodHID(const char *Cmd)
|
||||||
(unsigned int) fmtLen, (unsigned int) fc, (unsigned int) cardnum);
|
(unsigned int) fmtLen, (unsigned int) fc, (unsigned int) cardnum);
|
||||||
}
|
}
|
||||||
setDemodBuf(BitStream,BitLen,idx);
|
setDemodBuf(BitStream,BitLen,idx);
|
||||||
|
setClockGrid(g_DemodClock, g_DemodStartIdx + (idx*g_DemodClock));
|
||||||
if (g_debugMode){
|
if (g_debugMode){
|
||||||
PrintAndLog("DEBUG: idx: %d, Len: %d, Printing Demod Buffer:", idx, BitLen);
|
PrintAndLog("DEBUG: idx: %d, Len: %d, Printing Demod Buffer:", idx, BitLen);
|
||||||
printDemodBuff();
|
printDemodBuff();
|
||||||
|
|
|
@ -46,6 +46,7 @@ int CmdIndalaDecode(const char *Cmd) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
setDemodBuf(DemodBuffer, size, (size_t)startIdx);
|
setDemodBuf(DemodBuffer, size, (size_t)startIdx);
|
||||||
|
setClockGrid(g_DemodClock, g_DemodStartIdx + (startIdx*g_DemodClock));
|
||||||
if (invert)
|
if (invert)
|
||||||
if (g_debugMode)
|
if (g_debugMode)
|
||||||
PrintAndLog("Had to invert bits");
|
PrintAndLog("Had to invert bits");
|
||||||
|
|
|
@ -119,6 +119,8 @@ int CmdFSKdemodIO(const char *Cmd)
|
||||||
|
|
||||||
PrintAndLog("IO Prox XSF(%02d)%02x:%05d (%08x%08x) [%02x %s]",version,facilitycode,number,code,code2, crc, crcStr);
|
PrintAndLog("IO Prox XSF(%02d)%02x:%05d (%08x%08x) [%02x %s]",version,facilitycode,number,code,code2, crc, crcStr);
|
||||||
setDemodBuf(BitStream,64,idx);
|
setDemodBuf(BitStream,64,idx);
|
||||||
|
setClockGrid(g_DemodClock, g_DemodStartIdx + (idx*g_DemodClock));
|
||||||
|
|
||||||
if (g_debugMode){
|
if (g_debugMode){
|
||||||
PrintAndLog("DEBUG: idx: %d, Len: %d, Printing demod buffer:",idx,64);
|
PrintAndLog("DEBUG: idx: %d, Len: %d, Printing demod buffer:",idx,64);
|
||||||
printDemodBuff();
|
printDemodBuff();
|
||||||
|
|
|
@ -117,8 +117,8 @@ int CmdJablotronDemod(const char *Cmd) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
setDemodBuf(DemodBuffer+ans, 64, 0);
|
setDemodBuf(DemodBuffer, 64, ans);
|
||||||
//setGrid_Clock(64);
|
setClockGrid(g_DemodClock, g_DemodStartIdx + (ans*g_DemodClock));
|
||||||
|
|
||||||
//got a good demod
|
//got a good demod
|
||||||
uint32_t raw1 = bytebits_to_byte(DemodBuffer, 32);
|
uint32_t raw1 = bytebits_to_byte(DemodBuffer, 32);
|
||||||
|
|
|
@ -38,7 +38,8 @@ int CmdPSKNexWatch(const char *Cmd)
|
||||||
}
|
}
|
||||||
if (size != 128) return 0;
|
if (size != 128) return 0;
|
||||||
setDemodBuf(DemodBuffer, size, startIdx+4);
|
setDemodBuf(DemodBuffer, size, startIdx+4);
|
||||||
startIdx = 8+32; //4 = extra i added, 8 = preamble, 32 = reserved bits (always 0)
|
setClockGrid(g_DemodClock, g_DemodStartIdx + ((startIdx+4)*g_DemodClock));
|
||||||
|
startIdx = 8+32; // 8 = preamble, 32 = reserved bits (always 0)
|
||||||
//get ID
|
//get ID
|
||||||
uint32_t ID = 0;
|
uint32_t ID = 0;
|
||||||
for (uint8_t wordIdx=0; wordIdx<4; wordIdx++){
|
for (uint8_t wordIdx=0; wordIdx<4; wordIdx++){
|
||||||
|
|
|
@ -135,6 +135,7 @@ int CmdNoralsyDemod(const char *Cmd) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
setDemodBuf(DemodBuffer, 96, ans);
|
setDemodBuf(DemodBuffer, 96, ans);
|
||||||
|
setClockGrid(g_DemodClock, g_DemodStartIdx + (ans*g_DemodClock));
|
||||||
//setGrid_Clock(32);
|
//setGrid_Clock(32);
|
||||||
|
|
||||||
//got a good demod
|
//got a good demod
|
||||||
|
|
|
@ -63,6 +63,7 @@ int CmdFSKdemodParadox(const char *Cmd)
|
||||||
PrintAndLog("Paradox TAG ID: %x%08x - FC: %d - Card: %d - Checksum: %02x - RAW: %08x%08x%08x",
|
PrintAndLog("Paradox TAG ID: %x%08x - FC: %d - Card: %d - Checksum: %02x - RAW: %08x%08x%08x",
|
||||||
hi>>10, (hi & 0x3)<<26 | (lo>>10), fc, cardnum, (lo>>2) & 0xFF, rawHi2, rawHi, rawLo);
|
hi>>10, (hi & 0x3)<<26 | (lo>>10), fc, cardnum, (lo>>2) & 0xFF, rawHi2, rawHi, rawLo);
|
||||||
setDemodBuf(BitStream,BitLen,idx);
|
setDemodBuf(BitStream,BitLen,idx);
|
||||||
|
setClockGrid(g_DemodClock, g_DemodStartIdx + (idx*g_DemodClock));
|
||||||
if (g_debugMode){
|
if (g_debugMode){
|
||||||
PrintAndLog("DEBUG: idx: %d, len: %d, Printing Demod Buffer:", idx, BitLen);
|
PrintAndLog("DEBUG: idx: %d, len: %d, Printing Demod Buffer:", idx, BitLen);
|
||||||
printDemodBuff();
|
printDemodBuff();
|
||||||
|
|
|
@ -144,7 +144,8 @@ int CmdPrescoDemod(const char *Cmd) {
|
||||||
uint32_t cardid = raw4;
|
uint32_t cardid = raw4;
|
||||||
PrintAndLog("Presco Tag Found: Card ID %08X", cardid);
|
PrintAndLog("Presco Tag Found: Card ID %08X", cardid);
|
||||||
PrintAndLog("Raw: %08X%08X%08X%08X", raw1,raw2,raw3,raw4);
|
PrintAndLog("Raw: %08X%08X%08X%08X", raw1,raw2,raw3,raw4);
|
||||||
setDemodBuf(DemodBuffer+ans, 128, 0);
|
setDemodBuf(DemodBuffer, 128, ans);
|
||||||
|
setClockGrid(g_DemodClock, g_DemodStartIdx + (ans*g_DemodClock));
|
||||||
|
|
||||||
uint32_t sitecode = 0, usercode = 0, fullcode = 0;
|
uint32_t sitecode = 0, usercode = 0, fullcode = 0;
|
||||||
bool Q5=false;
|
bool Q5=false;
|
||||||
|
|
|
@ -152,6 +152,7 @@ int CmdFSKdemodPyramid(const char *Cmd)
|
||||||
uint32_t rawHi2 = bytebits_to_byte(BitStream+idx+32,32);
|
uint32_t rawHi2 = bytebits_to_byte(BitStream+idx+32,32);
|
||||||
uint32_t rawHi3 = bytebits_to_byte(BitStream+idx,32);
|
uint32_t rawHi3 = bytebits_to_byte(BitStream+idx,32);
|
||||||
setDemodBuf(BitStream,128,idx);
|
setDemodBuf(BitStream,128,idx);
|
||||||
|
setClockGrid(g_DemodClock, g_DemodStartIdx + (idx*g_DemodClock));
|
||||||
|
|
||||||
size = removeParity(BitStream, idx+8, 8, 1, 120);
|
size = removeParity(BitStream, idx+8, 8, 1, 120);
|
||||||
if (size != 105){
|
if (size != 105){
|
||||||
|
|
|
@ -64,7 +64,7 @@ int CmdSecurakeyDemod(const char *Cmd) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
setDemodBuf(DemodBuffer, 96, ans);
|
setDemodBuf(DemodBuffer, 96, ans);
|
||||||
//setGrid_Clock(40);
|
setClockGrid(g_DemodClock, g_DemodStartIdx + (ans*g_DemodClock));
|
||||||
|
|
||||||
//got a good demod
|
//got a good demod
|
||||||
uint32_t raw1 = bytebits_to_byte(DemodBuffer , 32);
|
uint32_t raw1 = bytebits_to_byte(DemodBuffer , 32);
|
||||||
|
|
|
@ -73,7 +73,8 @@ int CmdVikingDemod(const char *Cmd) {
|
||||||
uint8_t checksum = bytebits_to_byte(DemodBuffer+ans+32+24, 8);
|
uint8_t checksum = bytebits_to_byte(DemodBuffer+ans+32+24, 8);
|
||||||
PrintAndLog("Viking Tag Found: Card ID %08X, Checksum: %02X", cardid, (unsigned int) checksum);
|
PrintAndLog("Viking Tag Found: Card ID %08X, Checksum: %02X", cardid, (unsigned int) checksum);
|
||||||
PrintAndLog("Raw: %08X%08X", raw1,raw2);
|
PrintAndLog("Raw: %08X%08X", raw1,raw2);
|
||||||
setDemodBuf(DemodBuffer+ans, 64, 0);
|
setDemodBuf(DemodBuffer, 64, ans);
|
||||||
|
setClockGrid(g_DemodClock, g_DemodStartIdx + (ans*g_DemodClock));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -119,7 +119,7 @@ int CmdVisa2kDemod(const char *Cmd) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
setDemodBuf(DemodBuffer, 96, ans);
|
setDemodBuf(DemodBuffer, 96, ans);
|
||||||
//setGrid_Clock(64);
|
setClockGrid(g_DemodClock, g_DemodStartIdx + (ans*g_DemodClock));
|
||||||
|
|
||||||
//got a good demod
|
//got a good demod
|
||||||
uint32_t raw1 = bytebits_to_byte(DemodBuffer, 32);
|
uint32_t raw1 = bytebits_to_byte(DemodBuffer, 32);
|
||||||
|
|
|
@ -18,6 +18,9 @@
|
||||||
|
|
||||||
int GraphBuffer[MAX_GRAPH_TRACE_LEN];
|
int GraphBuffer[MAX_GRAPH_TRACE_LEN];
|
||||||
int GraphTraceLen;
|
int GraphTraceLen;
|
||||||
|
|
||||||
|
int s_Buff[MAX_GRAPH_TRACE_LEN];
|
||||||
|
|
||||||
/* write a manchester bit to the graph */
|
/* write a manchester bit to the graph */
|
||||||
void AppendGraph(int redraw, int clock, int bit)
|
void AppendGraph(int redraw, int clock, int bit)
|
||||||
{
|
{
|
||||||
|
|
|
@ -35,4 +35,6 @@ void DetectHighLowInGraph(int *high, int *low, bool addFuzz);
|
||||||
|
|
||||||
extern int GraphBuffer[MAX_GRAPH_TRACE_LEN];
|
extern int GraphBuffer[MAX_GRAPH_TRACE_LEN];
|
||||||
extern int GraphTraceLen;
|
extern int GraphTraceLen;
|
||||||
|
extern int s_Buff[MAX_GRAPH_TRACE_LEN];
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -12,6 +12,9 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
void ShowGraphWindow(void);
|
void ShowGraphWindow(void);
|
||||||
void HideGraphWindow(void);
|
void HideGraphWindow(void);
|
||||||
void RepaintGraphWindow(void);
|
void RepaintGraphWindow(void);
|
||||||
|
@ -22,12 +25,27 @@ void ExitGraphics(void);
|
||||||
#define MAX_GRAPH_TRACE_LEN (40000*8)
|
#define MAX_GRAPH_TRACE_LEN (40000*8)
|
||||||
extern int GraphBuffer[MAX_GRAPH_TRACE_LEN];
|
extern int GraphBuffer[MAX_GRAPH_TRACE_LEN];
|
||||||
extern int GraphTraceLen;
|
extern int GraphTraceLen;
|
||||||
|
extern int s_Buff[MAX_GRAPH_TRACE_LEN];
|
||||||
|
|
||||||
extern double CursorScaleFactor;
|
extern double CursorScaleFactor;
|
||||||
extern int PlotGridX, PlotGridY, PlotGridXdefault, PlotGridYdefault, CursorCPos, CursorDPos, GridOffset;
|
extern int PlotGridX, PlotGridY, PlotGridXdefault, PlotGridYdefault, CursorCPos, CursorDPos, GridOffset;
|
||||||
extern int CommandFinished;
|
extern int CommandFinished;
|
||||||
extern int offline;
|
extern int offline;
|
||||||
extern bool GridLocked;
|
extern bool GridLocked;
|
||||||
|
|
||||||
|
//Operations defined in data_operations
|
||||||
|
//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);
|
||||||
|
|
||||||
|
#define MAX_DEMOD_BUF_LEN (1024*128)
|
||||||
|
extern uint8_t DemodBuffer[MAX_DEMOD_BUF_LEN];
|
||||||
|
extern size_t DemodBufferLen;
|
||||||
|
extern size_t g_DemodStartIdx;
|
||||||
|
extern bool showDemod;
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -20,7 +20,14 @@
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <QSlider>
|
||||||
|
#include <QHBoxLayout>
|
||||||
|
#include <string.h>
|
||||||
|
#include "proxguiqt.h"
|
||||||
#include "proxgui.h"
|
#include "proxgui.h"
|
||||||
|
#include <QtGui>
|
||||||
|
//#include <ctime>
|
||||||
|
|
||||||
|
|
||||||
int startMax;
|
int startMax;
|
||||||
int PageWidth;
|
int PageWidth;
|
||||||
|
@ -86,6 +93,7 @@ ProxGuiQT::ProxGuiQT(int argc, char **argv) : plotapp(NULL), plotwidget(NULL),
|
||||||
ProxGuiQT::~ProxGuiQT(void)
|
ProxGuiQT::~ProxGuiQT(void)
|
||||||
{
|
{
|
||||||
if (plotwidget) {
|
if (plotwidget) {
|
||||||
|
//plotwidget->close();
|
||||||
delete plotwidget;
|
delete plotwidget;
|
||||||
plotwidget = NULL;
|
plotwidget = NULL;
|
||||||
}
|
}
|
||||||
|
@ -97,15 +105,314 @@ ProxGuiQT::~ProxGuiQT(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProxWidget::paintEvent(QPaintEvent *event)
|
//--------------------
|
||||||
|
void ProxWidget::applyOperation()
|
||||||
|
{
|
||||||
|
printf("ApplyOperation()");
|
||||||
|
save_restoreGB(1);
|
||||||
|
memcpy(GraphBuffer, s_Buff, sizeof(int) * GraphTraceLen);
|
||||||
|
RepaintGraphWindow();
|
||||||
|
|
||||||
|
}
|
||||||
|
void ProxWidget::stickOperation()
|
||||||
|
{
|
||||||
|
save_restoreGB(0);
|
||||||
|
printf("stickOperation()");
|
||||||
|
}
|
||||||
|
void ProxWidget::vchange_autocorr(int 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);
|
||||||
|
printf("vchange_dthr_up(%d)", v);
|
||||||
|
RepaintGraphWindow();
|
||||||
|
|
||||||
|
}
|
||||||
|
void ProxWidget::vchange_dthr_down(int v)
|
||||||
|
{
|
||||||
|
printf("vchange_dthr_down(%d)", v);
|
||||||
|
int up = opsController->horizontalSlider_dirthr_up->value();
|
||||||
|
directionalThreshold(GraphBuffer,s_Buff, GraphTraceLen, v, up);
|
||||||
|
RepaintGraphWindow();
|
||||||
|
|
||||||
|
}
|
||||||
|
ProxWidget::ProxWidget(QWidget *parent, ProxGuiQT *master) : QWidget(parent)
|
||||||
|
{
|
||||||
|
this->master = master;
|
||||||
|
resize(800,500);
|
||||||
|
|
||||||
|
/** Setup the controller widget **/
|
||||||
|
|
||||||
|
QWidget* controlWidget = new QWidget();
|
||||||
|
opsController = new Ui::Form();
|
||||||
|
opsController->setupUi(controlWidget);
|
||||||
|
//Due to quirks in QT Designer, we need to fiddle a bit
|
||||||
|
opsController->horizontalSlider_dirthr_down->setMinimum(-128);
|
||||||
|
opsController->horizontalSlider_dirthr_down->setMaximum(0);
|
||||||
|
opsController->horizontalSlider_dirthr_down->setValue(-20);
|
||||||
|
|
||||||
|
|
||||||
|
QObject::connect(opsController->pushButton_apply, SIGNAL(clicked()), this, SLOT(applyOperation()));
|
||||||
|
QObject::connect(opsController->pushButton_sticky, SIGNAL(clicked()), this, SLOT(stickOperation()));
|
||||||
|
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();
|
||||||
|
|
||||||
|
// Set up the plot widget, which does the actual plotting
|
||||||
|
|
||||||
|
plot = new Plot(this);
|
||||||
|
/*
|
||||||
|
QSlider* slider = new QSlider(Qt::Horizontal);
|
||||||
|
slider->setFocusPolicy(Qt::StrongFocus);
|
||||||
|
slider->setTickPosition(QSlider::TicksBothSides);
|
||||||
|
slider->setTickInterval(10);
|
||||||
|
slider->setSingleStep(1);
|
||||||
|
*/
|
||||||
|
QVBoxLayout *layout = new QVBoxLayout;
|
||||||
|
//layout->addWidget(slider);
|
||||||
|
layout->addWidget(plot);
|
||||||
|
setLayout(layout);
|
||||||
|
printf("Proxwidget Constructor just set layout\r\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//----------- Plotting
|
||||||
|
|
||||||
|
int Plot::xCoordOf(int i, QRect r )
|
||||||
|
{
|
||||||
|
return r.left() + (int)((i - GraphStart)*GraphPixelsPerPoint);
|
||||||
|
}
|
||||||
|
|
||||||
|
int Plot::yCoordOf(int v, QRect r, int maxVal)
|
||||||
|
{
|
||||||
|
int z = (r.bottom() - r.top())/2;
|
||||||
|
return -(z * v) / maxVal + z;
|
||||||
|
}
|
||||||
|
|
||||||
|
int Plot::valueOf_yCoord(int y, QRect r, int maxVal)
|
||||||
|
{
|
||||||
|
int z = (r.bottom() - r.top())/2;
|
||||||
|
return (y-z) * maxVal / z;
|
||||||
|
}
|
||||||
|
static const QColor GREEN = QColor(100,255,100);
|
||||||
|
static const QColor RED = QColor(255,100,100);
|
||||||
|
static const QColor BLUE = QColor(100,100,255);
|
||||||
|
static const QColor GRAY = QColor(240,240,240);
|
||||||
|
|
||||||
|
QColor Plot::getColor(int graphNum)
|
||||||
|
{
|
||||||
|
switch (graphNum) {
|
||||||
|
case 0: return GREEN; //Green
|
||||||
|
case 1: return RED; //Red
|
||||||
|
case 2: return BLUE; //Blue
|
||||||
|
default: return GRAY; //Gray
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Plot::PlotDemod(uint8_t *buffer, size_t len, QRect plotRect, QRect annotationRect, QPainter *painter, int graphNum, int plotOffset)
|
||||||
|
{
|
||||||
|
if (len == 0 || PlotGridX <= 0) return;
|
||||||
|
//clock_t begin = clock();
|
||||||
|
QPainterPath penPath;
|
||||||
|
|
||||||
|
int grid_delta_x = PlotGridX;
|
||||||
|
int first_delta_x = grid_delta_x; //(plotOffset > 0) ? PlotGridX : (PlotGridX +);
|
||||||
|
if (GraphStart > plotOffset) first_delta_x -= (GraphStart-plotOffset);
|
||||||
|
int DemodStart = GraphStart;
|
||||||
|
if (plotOffset > GraphStart) DemodStart = plotOffset;
|
||||||
|
|
||||||
|
int BitStart = 0;
|
||||||
|
// round down
|
||||||
|
if (DemodStart-plotOffset > 0) BitStart = (int)(((DemodStart-plotOffset)+(PlotGridX-1))/PlotGridX)-1;
|
||||||
|
first_delta_x += BitStart * PlotGridX;
|
||||||
|
if (BitStart > len) return;
|
||||||
|
int delta_x = 0;
|
||||||
|
int v = 0;
|
||||||
|
//printf("first_delta_x %i, grid_delta_x %i, DemodStart %i, BitStart %i\n",first_delta_x,grid_delta_x,DemodStart, BitStart);
|
||||||
|
|
||||||
|
painter->setPen(getColor(graphNum));
|
||||||
|
char str[5];
|
||||||
|
int absVMax = (int)(100*1.05+1);
|
||||||
|
int x = xCoordOf(DemodStart, plotRect);
|
||||||
|
int y = yCoordOf((buffer[BitStart]*200-100)*-1,plotRect,absVMax);
|
||||||
|
penPath.moveTo(x, y);
|
||||||
|
delta_x = 0;
|
||||||
|
int clk = first_delta_x;
|
||||||
|
for(int i = BitStart; i < len && xCoordOf(delta_x+DemodStart, plotRect) < plotRect.right(); i++) {
|
||||||
|
for (int ii = 0; ii < (clk) && i < len && xCoordOf(DemodStart+delta_x+ii, plotRect) < plotRect.right() ; ii++ ) {
|
||||||
|
x = xCoordOf(DemodStart+delta_x+ii, plotRect);
|
||||||
|
v = buffer[i]*200-100;
|
||||||
|
|
||||||
|
y = yCoordOf( v, plotRect, absVMax);
|
||||||
|
|
||||||
|
penPath.lineTo(x, y);
|
||||||
|
|
||||||
|
if(GraphPixelsPerPoint > 10) {
|
||||||
|
QRect f(QPoint(x - 3, y - 3),QPoint(x + 3, y + 3));
|
||||||
|
painter->fillRect(f, QColor(100, 255, 100));
|
||||||
|
}
|
||||||
|
if (ii == (int)clk/2) {
|
||||||
|
//print label
|
||||||
|
sprintf(str, "%u",buffer[i]);
|
||||||
|
painter->drawText(x-8, y + ((buffer[i] > 0) ? 18 : -6), str);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
delta_x += clk;
|
||||||
|
clk = grid_delta_x;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Graph annotations
|
||||||
|
painter->drawPath(penPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Plot::PlotGraph(int *buffer, int len, QRect plotRect, QRect annotationRect, QPainter *painter, int graphNum)
|
||||||
|
{
|
||||||
|
if (len == 0) return;
|
||||||
|
//clock_t begin = clock();
|
||||||
|
QPainterPath penPath;
|
||||||
|
|
||||||
|
startMax = (len - (int)((plotRect.right() - plotRect.left() - 40) / GraphPixelsPerPoint));
|
||||||
|
if(startMax < 0) {
|
||||||
|
startMax = 0;
|
||||||
|
}
|
||||||
|
if(GraphStart > startMax) {
|
||||||
|
GraphStart = startMax;
|
||||||
|
}
|
||||||
|
if (GraphStart > len) return;
|
||||||
|
int vMin = INT_MAX, vMax = INT_MIN, vMean = 0, v = 0, absVMax = 0;
|
||||||
|
int sample_index = GraphStart ;
|
||||||
|
for( ; sample_index < len && xCoordOf(sample_index,plotRect) < plotRect.right() ; sample_index++) {
|
||||||
|
|
||||||
|
v = buffer[sample_index];
|
||||||
|
if(v < vMin) vMin = v;
|
||||||
|
if(v > vMax) vMax = v;
|
||||||
|
vMean += v;
|
||||||
|
}
|
||||||
|
|
||||||
|
vMean /= (sample_index - GraphStart);
|
||||||
|
|
||||||
|
if(fabs( (double) vMin) > absVMax) absVMax = (int)fabs( (double) vMin);
|
||||||
|
if(fabs( (double) vMax) > absVMax) absVMax = (int)fabs( (double) vMax);
|
||||||
|
absVMax = (int)(absVMax*1.25 + 1);
|
||||||
|
// number of points that will be plotted
|
||||||
|
int span = (int)((plotRect.right() - plotRect.left()) / GraphPixelsPerPoint);
|
||||||
|
// one label every 100 pixels, let us say
|
||||||
|
int labels = (plotRect.right() - plotRect.left() - 40) / 100;
|
||||||
|
if(labels <= 0) labels = 1;
|
||||||
|
int pointsPerLabel = span / labels;
|
||||||
|
if(pointsPerLabel <= 0) pointsPerLabel = 1;
|
||||||
|
|
||||||
|
int x = xCoordOf(GraphStart, plotRect);
|
||||||
|
int y = yCoordOf(buffer[GraphStart],plotRect,absVMax);
|
||||||
|
penPath.moveTo(x, y);
|
||||||
|
for(int i = GraphStart; i < len && xCoordOf(i, plotRect) < plotRect.right(); i++) {
|
||||||
|
|
||||||
|
x = xCoordOf(i, plotRect);
|
||||||
|
v = buffer[i];
|
||||||
|
|
||||||
|
y = yCoordOf( v, plotRect, absVMax);//(y * (r.top() - r.bottom()) / (2*absYMax)) + zeroHeight;
|
||||||
|
|
||||||
|
penPath.lineTo(x, y);
|
||||||
|
|
||||||
|
if(GraphPixelsPerPoint > 10) {
|
||||||
|
QRect f(QPoint(x - 3, y - 3),QPoint(x + 3, y + 3));
|
||||||
|
painter->fillRect(f, QColor(100, 255, 100));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
painter->setPen(getColor(graphNum));
|
||||||
|
|
||||||
|
//Draw y-axis
|
||||||
|
int xo = 5+(graphNum*40);
|
||||||
|
painter->drawLine(xo, plotRect.top(),xo, plotRect.bottom());
|
||||||
|
|
||||||
|
int vMarkers = (absVMax - (absVMax % 10)) / 5;
|
||||||
|
int minYDist = 40; //Minimum pixel-distance between markers
|
||||||
|
|
||||||
|
char yLbl[20];
|
||||||
|
|
||||||
|
int n = 0;
|
||||||
|
int lasty0 = 65535;
|
||||||
|
|
||||||
|
for(int v = vMarkers; yCoordOf(v,plotRect,absVMax) > plotRect.top() && n < 20; v+= vMarkers ,n++)
|
||||||
|
{
|
||||||
|
int y0 = yCoordOf(v,plotRect,absVMax);
|
||||||
|
int y1 = yCoordOf(-v,plotRect,absVMax);
|
||||||
|
|
||||||
|
if(lasty0 - y0 < minYDist) continue;
|
||||||
|
|
||||||
|
painter->drawLine(xo-5,y0, xo+5, y0);
|
||||||
|
|
||||||
|
sprintf(yLbl, "%d", v);
|
||||||
|
painter->drawText(xo+8,y0+7,yLbl);
|
||||||
|
|
||||||
|
painter->drawLine(xo-5, y1, xo+5, y1);
|
||||||
|
sprintf(yLbl, "%d",-v);
|
||||||
|
painter->drawText(xo+8, y1+5 , yLbl);
|
||||||
|
lasty0 = y0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Graph annotations
|
||||||
|
painter->drawPath(penPath);
|
||||||
|
char str[200];
|
||||||
|
sprintf(str, "max=%d min=%d mean=%d n=%d/%d CursorAVal=[%d] CursorBVal=[%d]",
|
||||||
|
vMax, vMin, vMean, sample_index, len, buffer[CursorAPos], buffer[CursorBPos]);
|
||||||
|
painter->drawText(20, annotationRect.bottom() - 23 - 20 * graphNum, str);
|
||||||
|
|
||||||
|
//clock_t end = clock();
|
||||||
|
//double elapsed_secs = double(end - begin) / CLOCKS_PER_SEC;
|
||||||
|
//printf("Plot time %f\n", elapsed_secs);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Plot::plotGridLines(QPainter* painter,QRect r)
|
||||||
|
{
|
||||||
|
int zeroHeight = r.top() + (r.bottom() - r.top()) / 2;
|
||||||
|
|
||||||
|
int i;
|
||||||
|
int grid_delta_x = (int) (PlotGridX * GraphPixelsPerPoint);
|
||||||
|
int grid_delta_y = (int) (PlotGridY * GraphPixelsPerPoint);
|
||||||
|
if ((PlotGridX > 0) && ((PlotGridX * GraphPixelsPerPoint) > 1)) {
|
||||||
|
for(i = (GridOffset * GraphPixelsPerPoint); i < r.right(); i += grid_delta_x) {
|
||||||
|
painter->drawLine(r.left()+i, r.top(), r.left()+i, r.bottom());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ((PlotGridY > 0) && ((PlotGridY * GraphPixelsPerPoint) > 1)){
|
||||||
|
for(i = 0; i < ((r.top() + r.bottom())>>1); i += grid_delta_y) {
|
||||||
|
painter->drawLine(r.left(),zeroHeight + i,r.right(),zeroHeight + i);
|
||||||
|
painter->drawLine(r.left(),zeroHeight - i,r.right(),zeroHeight - i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#define HEIGHT_INFO 60
|
||||||
|
#define WIDTH_AXES 80
|
||||||
|
|
||||||
|
void Plot::paintEvent(QPaintEvent *event)
|
||||||
{
|
{
|
||||||
QPainter painter(this);
|
QPainter painter(this);
|
||||||
QPainterPath penPath, whitePath, greyPath, lightgreyPath, cursorAPath, cursorBPath, cursorCPath, cursorDPath;
|
//QPainterPath penPath, whitePath, greyPath, lightgreyPath, cursorAPath, cursorBPath, cursorCPath, cursorDPath;
|
||||||
QRect r;
|
//QRect r;
|
||||||
QBrush brush(QColor(100, 255, 100));
|
QBrush brush(QColor(100, 255, 100));
|
||||||
QPen pen(QColor(100, 255, 100));
|
QPen pen(QColor(100, 255, 100));
|
||||||
|
|
||||||
painter.setFont(QFont("Arial", 10));
|
painter.setFont(QFont("Courier New", 10));
|
||||||
|
|
||||||
if(GraphStart < 0) {
|
if(GraphStart < 0) {
|
||||||
GraphStart = 0;
|
GraphStart = 0;
|
||||||
|
@ -120,176 +427,65 @@ void ProxWidget::paintEvent(QPaintEvent *event)
|
||||||
if(CursorDPos > GraphTraceLen)
|
if(CursorDPos > GraphTraceLen)
|
||||||
CursorDPos= 0;
|
CursorDPos= 0;
|
||||||
|
|
||||||
r = rect();
|
QRect plotRect(WIDTH_AXES, 0, width()-WIDTH_AXES, height()-HEIGHT_INFO);
|
||||||
|
QRect infoRect(0, height()-HEIGHT_INFO, width(), HEIGHT_INFO);
|
||||||
|
|
||||||
painter.fillRect(r, QColor(0, 0, 0));
|
//Grey background
|
||||||
|
painter.fillRect(rect(), QColor(60, 60, 60));
|
||||||
|
//Black foreground
|
||||||
|
painter.fillRect(plotRect, QColor(0, 0, 0));
|
||||||
|
|
||||||
whitePath.moveTo(r.left() + 40, r.top());
|
// center line
|
||||||
whitePath.lineTo(r.left() + 40, r.bottom());
|
int zeroHeight = plotRect.top() + (plotRect.bottom() - plotRect.top()) / 2;
|
||||||
|
|
||||||
int zeroHeight = r.top() + (r.bottom() - r.top()) / 2;
|
|
||||||
|
|
||||||
greyPath.moveTo(r.left(), zeroHeight);
|
|
||||||
greyPath.lineTo(r.right(), zeroHeight);
|
|
||||||
painter.setPen(QColor(100, 100, 100));
|
painter.setPen(QColor(100, 100, 100));
|
||||||
painter.drawPath(greyPath);
|
painter.drawLine(plotRect.left(), zeroHeight, plotRect.right(), zeroHeight);
|
||||||
|
|
||||||
PageWidth= (int)((r.right() - r.left() - 40) / GraphPixelsPerPoint);
|
|
||||||
|
|
||||||
// plot X and Y grid lines
|
// plot X and Y grid lines
|
||||||
int i;
|
plotGridLines(&painter, plotRect);
|
||||||
if ((PlotGridX > 0) && ((PlotGridX * GraphPixelsPerPoint) > 1)) {
|
|
||||||
for(i = 40 + (GridOffset * GraphPixelsPerPoint); i < r.right(); i += (int)(PlotGridX * GraphPixelsPerPoint)) {
|
|
||||||
//SelectObject(hdc, GreyPenLite);
|
|
||||||
//MoveToEx(hdc, r.left + i, r.top, NULL);
|
|
||||||
//LineTo(hdc, r.left + i, r.bottom);
|
|
||||||
lightgreyPath.moveTo(r.left()+i,r.top());
|
|
||||||
lightgreyPath.lineTo(r.left()+i,r.bottom());
|
|
||||||
painter.drawPath(lightgreyPath);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ((PlotGridY > 0) && ((PlotGridY * GraphPixelsPerPoint) > 1)){
|
|
||||||
for(i = 0; i < ((r.top() + r.bottom())>>1); i += (int)(PlotGridY * GraphPixelsPerPoint)) {
|
|
||||||
lightgreyPath.moveTo(r.left() + 40,zeroHeight + i);
|
|
||||||
lightgreyPath.lineTo(r.right(),zeroHeight + i);
|
|
||||||
painter.drawPath(lightgreyPath);
|
|
||||||
lightgreyPath.moveTo(r.left() + 40,zeroHeight - i);
|
|
||||||
lightgreyPath.lineTo(r.right(),zeroHeight - i);
|
|
||||||
painter.drawPath(lightgreyPath);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
startMax = (GraphTraceLen - (int)((r.right() - r.left() - 40) / GraphPixelsPerPoint));
|
//Start painting graph
|
||||||
if(startMax < 0) {
|
if (showDemod && DemodBufferLen > 8) {
|
||||||
startMax = 0;
|
PlotDemod(DemodBuffer, DemodBufferLen,plotRect,infoRect,&painter,2,g_DemodStartIdx);
|
||||||
}
|
|
||||||
if(GraphStart > startMax) {
|
|
||||||
GraphStart = startMax;
|
|
||||||
}
|
}
|
||||||
|
PlotGraph(s_Buff, GraphTraceLen,plotRect,infoRect,&painter,1);
|
||||||
|
PlotGraph(GraphBuffer, GraphTraceLen,plotRect,infoRect,&painter,0);
|
||||||
|
// End graph drawing
|
||||||
|
|
||||||
int absYMax = 1;
|
//Draw the cursors
|
||||||
|
if(CursorAPos > GraphStart && xCoordOf(CursorAPos, plotRect) < plotRect.right())
|
||||||
for(i = GraphStart; ; i++) {
|
{
|
||||||
if(i >= GraphTraceLen) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if(fabs((double)GraphBuffer[i]) > absYMax) {
|
|
||||||
absYMax = (int)fabs((double)GraphBuffer[i]);
|
|
||||||
}
|
|
||||||
int x = 40 + (int)((i - GraphStart)*GraphPixelsPerPoint);
|
|
||||||
if(x > r.right()) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
absYMax = (int)(absYMax*1.2 + 1);
|
|
||||||
|
|
||||||
// number of points that will be plotted
|
|
||||||
int span = (int)((r.right() - r.left()) / GraphPixelsPerPoint);
|
|
||||||
// one label every 100 pixels, let us say
|
|
||||||
int labels = (r.right() - r.left() - 40) / 100;
|
|
||||||
if(labels <= 0) labels = 1;
|
|
||||||
int pointsPerLabel = span / labels;
|
|
||||||
if(pointsPerLabel <= 0) pointsPerLabel = 1;
|
|
||||||
|
|
||||||
int yMin = INT_MAX;
|
|
||||||
int yMax = INT_MIN;
|
|
||||||
int yMean = 0;
|
|
||||||
int n = 0;
|
|
||||||
|
|
||||||
for(i = GraphStart; ; i++) {
|
|
||||||
if(i >= GraphTraceLen) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
int x = 40 + (int)((i - GraphStart)*GraphPixelsPerPoint);
|
|
||||||
if(x > r.right() + GraphPixelsPerPoint) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
int y = GraphBuffer[i];
|
|
||||||
if(y < yMin) {
|
|
||||||
yMin = y;
|
|
||||||
}
|
|
||||||
if(y > yMax) {
|
|
||||||
yMax = y;
|
|
||||||
}
|
|
||||||
yMean += y;
|
|
||||||
n++;
|
|
||||||
|
|
||||||
y = (y * (r.top() - r.bottom()) / (2*absYMax)) + zeroHeight;
|
|
||||||
if(i == GraphStart) {
|
|
||||||
penPath.moveTo(x, y);
|
|
||||||
} else {
|
|
||||||
penPath.lineTo(x, y);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(GraphPixelsPerPoint > 10) {
|
|
||||||
QRect f(QPoint(x - 3, y - 3),QPoint(x + 3, y + 3));
|
|
||||||
painter.fillRect(f, brush);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(((i - GraphStart) % pointsPerLabel == 0) && i != GraphStart) {
|
|
||||||
whitePath.moveTo(x, zeroHeight - 3);
|
|
||||||
whitePath.lineTo(x, zeroHeight + 3);
|
|
||||||
|
|
||||||
char str[100];
|
|
||||||
sprintf(str, "+%d", (i - GraphStart));
|
|
||||||
|
|
||||||
painter.setPen(QColor(255, 255, 255));
|
|
||||||
QRect size;
|
|
||||||
QFontMetrics metrics(painter.font());
|
|
||||||
size = metrics.boundingRect(str);
|
|
||||||
painter.drawText(x - (size.right() - size.left()), zeroHeight + 9, str);
|
|
||||||
|
|
||||||
penPath.moveTo(x,y);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(i == CursorAPos || i == CursorBPos || i == CursorCPos || i == CursorDPos) {
|
|
||||||
QPainterPath *cursorPath;
|
|
||||||
|
|
||||||
if(i == CursorAPos) {
|
|
||||||
cursorPath = &cursorAPath;
|
|
||||||
} else if (i == CursorBPos) {
|
|
||||||
cursorPath = &cursorBPath;
|
|
||||||
} else if (i == CursorCPos) {
|
|
||||||
cursorPath = &cursorCPath;
|
|
||||||
} else {
|
|
||||||
cursorPath = &cursorDPath;
|
|
||||||
}
|
|
||||||
cursorPath->moveTo(x, r.top());
|
|
||||||
cursorPath->lineTo(x, r.bottom());
|
|
||||||
penPath.moveTo(x, y);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(n != 0) {
|
|
||||||
yMean /= n;
|
|
||||||
}
|
|
||||||
|
|
||||||
painter.setPen(QColor(255, 255, 255));
|
|
||||||
painter.drawPath(whitePath);
|
|
||||||
painter.setPen(pen);
|
|
||||||
painter.drawPath(penPath);
|
|
||||||
painter.setPen(QColor(255, 255, 0));
|
painter.setPen(QColor(255, 255, 0));
|
||||||
painter.drawPath(cursorAPath);
|
painter.drawLine(xCoordOf(CursorAPos, plotRect),plotRect.top(),xCoordOf(CursorAPos, plotRect),plotRect.bottom());
|
||||||
|
}
|
||||||
|
if(CursorBPos > GraphStart && xCoordOf(CursorBPos, plotRect) < plotRect.right())
|
||||||
|
{
|
||||||
painter.setPen(QColor(255, 0, 255));
|
painter.setPen(QColor(255, 0, 255));
|
||||||
painter.drawPath(cursorBPath);
|
painter.drawLine(xCoordOf(CursorBPos, plotRect),plotRect.top(),xCoordOf(CursorBPos, plotRect),plotRect.bottom());
|
||||||
|
}
|
||||||
|
if(CursorCPos > GraphStart && xCoordOf(CursorCPos, plotRect) < plotRect.right())
|
||||||
|
{
|
||||||
painter.setPen(QColor(255, 153, 0)); //orange
|
painter.setPen(QColor(255, 153, 0)); //orange
|
||||||
painter.drawPath(cursorCPath);
|
painter.drawLine(xCoordOf(CursorCPos, plotRect),plotRect.top(),xCoordOf(CursorCPos, plotRect),plotRect.bottom());
|
||||||
|
}
|
||||||
|
if(CursorDPos > GraphStart && xCoordOf(CursorDPos, plotRect) < plotRect.right())
|
||||||
|
{
|
||||||
painter.setPen(QColor(0, 0, 205)); //light blue
|
painter.setPen(QColor(0, 0, 205)); //light blue
|
||||||
painter.drawPath(cursorDPath);
|
painter.drawLine(xCoordOf(CursorDPos, plotRect),plotRect.top(),xCoordOf(CursorDPos, plotRect),plotRect.bottom());
|
||||||
|
}
|
||||||
|
|
||||||
|
//Draw annotations
|
||||||
char str[200];
|
char str[200];
|
||||||
sprintf(str, "@%d max=%d min=%d mean=%d n=%d/%d dt=%d [%.3f] zoom=%.3f CursorA=%d [%d] CursorB=%d [%d] GridX=%d GridY=%d (%s)",
|
sprintf(str, "@%d dt=%d [%2.2f] zoom=%2.2f CursorAPos=%d CursorBPos=%d GridX=%d GridY=%d (%s) GridXoffset=%d",
|
||||||
GraphStart, yMax, yMin, yMean, n, GraphTraceLen,
|
GraphStart, CursorBPos - CursorAPos, (CursorBPos - CursorAPos)/CursorScaleFactor,
|
||||||
CursorBPos - CursorAPos, (CursorBPos - CursorAPos)/CursorScaleFactor,GraphPixelsPerPoint,CursorAPos,GraphBuffer[CursorAPos],CursorBPos,GraphBuffer[CursorBPos],PlotGridXdefault,PlotGridYdefault,GridLocked?"Locked":"Unlocked");
|
GraphPixelsPerPoint,CursorAPos,CursorBPos,PlotGridXdefault,PlotGridYdefault,GridLocked?"Locked":"Unlocked",GridOffset);
|
||||||
|
|
||||||
painter.setPen(QColor(255, 255, 255));
|
painter.setPen(QColor(255, 255, 255));
|
||||||
painter.drawText(50, r.bottom() - 20, str);
|
painter.drawText(20, infoRect.bottom() - 3, str);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ProxWidget::ProxWidget(QWidget *parent) : QWidget(parent), GraphStart(0), GraphPixelsPerPoint(1)
|
Plot::Plot(QWidget *parent) : QWidget(parent), GraphStart(0), GraphPixelsPerPoint(1)
|
||||||
{
|
{
|
||||||
|
//Need to set this, otherwise we don't receive keypress events
|
||||||
|
setFocusPolicy( Qt::StrongFocus);
|
||||||
resize(600, 300);
|
resize(600, 300);
|
||||||
|
|
||||||
QPalette palette(QColor(0,0,0,0));
|
QPalette palette(QColor(0,0,0,0));
|
||||||
|
@ -300,18 +496,20 @@ ProxWidget::ProxWidget(QWidget *parent) : QWidget(parent), GraphStart(0), GraphP
|
||||||
setAutoFillBackground(true);
|
setAutoFillBackground(true);
|
||||||
CursorAPos = 0;
|
CursorAPos = 0;
|
||||||
CursorBPos = 0;
|
CursorBPos = 0;
|
||||||
|
|
||||||
|
setWindowTitle(tr("Sliders"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProxWidget::closeEvent(QCloseEvent *event)
|
void Plot::closeEvent(QCloseEvent *event)
|
||||||
{
|
{
|
||||||
event->ignore();
|
event->ignore();
|
||||||
this->hide();
|
this->hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProxWidget::mouseMoveEvent(QMouseEvent *event)
|
void Plot::mouseMoveEvent(QMouseEvent *event)
|
||||||
{
|
{
|
||||||
int x = event->x();
|
int x = event->x();
|
||||||
x -= 40;
|
x -= WIDTH_AXES;
|
||||||
x = (int)(x / GraphPixelsPerPoint);
|
x = (int)(x / GraphPixelsPerPoint);
|
||||||
x += GraphStart;
|
x += GraphStart;
|
||||||
if((event->buttons() & Qt::LeftButton)) {
|
if((event->buttons() & Qt::LeftButton)) {
|
||||||
|
@ -324,7 +522,7 @@ void ProxWidget::mouseMoveEvent(QMouseEvent *event)
|
||||||
this->update();
|
this->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProxWidget::keyPressEvent(QKeyEvent *event)
|
void Plot::keyPressEvent(QKeyEvent *event)
|
||||||
{
|
{
|
||||||
int offset;
|
int offset;
|
||||||
int gridchanged;
|
int gridchanged;
|
||||||
|
|
|
@ -13,26 +13,67 @@
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
|
#include <QtGui>
|
||||||
|
|
||||||
class ProxWidget : public QWidget
|
#include "ui/ui_overlays.h"
|
||||||
|
/**
|
||||||
|
* @brief The actual plot, black area were we paint the graph
|
||||||
|
*/
|
||||||
|
class Plot: public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT;
|
private:
|
||||||
|
|
||||||
private:
|
|
||||||
int GraphStart;
|
int GraphStart;
|
||||||
double GraphPixelsPerPoint;
|
double GraphPixelsPerPoint;
|
||||||
int CursorAPos;
|
int CursorAPos;
|
||||||
int CursorBPos;
|
int CursorBPos;
|
||||||
|
void PlotGraph(int *buffer, int len, QRect r,QRect r2, QPainter* painter, int graphNum);
|
||||||
|
void PlotDemod(uint8_t *buffer, size_t len, QRect r,QRect r2, QPainter* painter, int graphNum, int plotOffset);
|
||||||
|
void plotGridLines(QPainter* painter,QRect r);
|
||||||
|
int xCoordOf(int i, QRect r );
|
||||||
|
int yCoordOf(int v, QRect r, int maxVal);
|
||||||
|
int valueOf_yCoord(int y, QRect r, int maxVal);
|
||||||
|
QColor getColor(int graphNum);
|
||||||
|
public:
|
||||||
|
Plot(QWidget *parent = 0);
|
||||||
|
|
||||||
public:
|
protected:
|
||||||
ProxWidget(QWidget *parent = 0);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
void paintEvent(QPaintEvent *event);
|
void paintEvent(QPaintEvent *event);
|
||||||
void closeEvent(QCloseEvent *event);
|
void closeEvent(QCloseEvent *event);
|
||||||
void mouseMoveEvent(QMouseEvent *event);
|
void mouseMoveEvent(QMouseEvent *event);
|
||||||
void mousePressEvent(QMouseEvent *event) { mouseMoveEvent(event); }
|
void mousePressEvent(QMouseEvent *event) { mouseMoveEvent(event); }
|
||||||
void keyPressEvent(QKeyEvent *event);
|
void keyPressEvent(QKeyEvent *event);
|
||||||
|
|
||||||
|
};
|
||||||
|
class ProxGuiQT;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The window with plot and controls
|
||||||
|
*/
|
||||||
|
class ProxWidget : public QWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT;
|
||||||
|
|
||||||
|
private:
|
||||||
|
Plot *plot;
|
||||||
|
Ui::Form *opsController;
|
||||||
|
ProxGuiQT *master;
|
||||||
|
|
||||||
|
public:
|
||||||
|
ProxWidget(QWidget *parent = 0, ProxGuiQT *master = NULL);
|
||||||
|
|
||||||
|
//protected:
|
||||||
|
// void paintEvent(QPaintEvent *event);
|
||||||
|
// void closeEvent(QCloseEvent *event);
|
||||||
|
// void mouseMoveEvent(QMouseEvent *event);
|
||||||
|
// void mousePressEvent(QMouseEvent *event) { mouseMoveEvent(event); }
|
||||||
|
// void keyPressEvent(QKeyEvent *event);
|
||||||
|
public slots:
|
||||||
|
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);
|
||||||
};
|
};
|
||||||
|
|
||||||
class ProxGuiQT : public QObject
|
class ProxGuiQT : public QObject
|
||||||
|
|
|
@ -19,11 +19,12 @@
|
||||||
#include "ui.h"
|
#include "ui.h"
|
||||||
|
|
||||||
double CursorScaleFactor = 1;
|
double CursorScaleFactor = 1;
|
||||||
int PlotGridX, PlotGridY, PlotGridXdefault= 64, PlotGridYdefault= 64, CursorCPos= 0, CursorDPos= 0;
|
int PlotGridX=0, PlotGridY=0, PlotGridXdefault= 64, PlotGridYdefault= 64, CursorCPos= 0, CursorDPos= 0;
|
||||||
int offline;
|
int offline;
|
||||||
int flushAfterWrite = 0; //buzzy
|
int flushAfterWrite = 0; //buzzy
|
||||||
int GridOffset = 0;
|
int GridOffset = 0;
|
||||||
bool GridLocked = false;
|
bool GridLocked = false;
|
||||||
|
bool showDemod = true;
|
||||||
|
|
||||||
extern pthread_mutex_t print_lock;
|
extern pthread_mutex_t print_lock;
|
||||||
|
|
||||||
|
|
|
@ -25,5 +25,6 @@ extern int PlotGridX, PlotGridY, PlotGridXdefault, PlotGridYdefault, CursorCPos,
|
||||||
extern int offline;
|
extern int offline;
|
||||||
extern int flushAfterWrite; //buzzy
|
extern int flushAfterWrite; //buzzy
|
||||||
extern bool GridLocked;
|
extern bool GridLocked;
|
||||||
|
extern bool showDemod;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
340
client/ui/overlays.ui
Normal file
340
client/ui/overlays.ui
Normal file
|
@ -0,0 +1,340 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>Form</class>
|
||||||
|
<widget class="QWidget" name="Form">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>614</width>
|
||||||
|
<height>286</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Overlays</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
|
<item>
|
||||||
|
<widget class="QTabWidget" name="tabWidget_overlays">
|
||||||
|
<property name="currentIndex">
|
||||||
|
<number>1</number>
|
||||||
|
</property>
|
||||||
|
<widget class="QWidget" name="tab">
|
||||||
|
<property name="focusPolicy">
|
||||||
|
<enum>Qt::StrongFocus</enum>
|
||||||
|
</property>
|
||||||
|
<attribute name="title">
|
||||||
|
<string>Autocorrelate</string>
|
||||||
|
</attribute>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
|
<item>
|
||||||
|
<layout class="QFormLayout" name="formLayout">
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QLabel" name="label_5">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</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>
|
||||||
|
<widget class="QSlider" name="horizontalSlider_window">
|
||||||
|
<property name="minimum">
|
||||||
|
<number>10</number>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>10000</number>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<number>2000</number>
|
||||||
|
</property>
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="verticalSpacer">
|
||||||
|
<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_3">
|
||||||
|
<attribute name="title">
|
||||||
|
<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">
|
||||||
|
<string>Dirthreshold</string>
|
||||||
|
</attribute>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<layout class="QFormLayout" name="formLayout_2">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="text">
|
||||||
|
<string>Up</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QLabel" name="label_6">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QSlider" name="horizontalSlider_dirthr_up">
|
||||||
|
<property name="maximum">
|
||||||
|
<number>128</number>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<number>20</number>
|
||||||
|
</property>
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QFormLayout" name="formLayout_3">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="label_3">
|
||||||
|
<property name="text">
|
||||||
|
<string>Down</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QLabel" name="label_7">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QSlider" name="horizontalSlider_dirthr_down">
|
||||||
|
<property name="maximum">
|
||||||
|
<number>127</number>
|
||||||
|
</property>
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="verticalSpacer_2">
|
||||||
|
<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>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButton_apply">
|
||||||
|
<property name="text">
|
||||||
|
<string>Apply</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButton_sticky">
|
||||||
|
<property name="text">
|
||||||
|
<string>Restore</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_4">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections>
|
||||||
|
<connection>
|
||||||
|
<sender>horizontalSlider_window</sender>
|
||||||
|
<signal>valueChanged(int)</signal>
|
||||||
|
<receiver>label_4</receiver>
|
||||||
|
<slot>setNum(int)</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>46</x>
|
||||||
|
<y>118</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>597</x>
|
||||||
|
<y>257</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>horizontalSlider_window</sender>
|
||||||
|
<signal>valueChanged(int)</signal>
|
||||||
|
<receiver>label_5</receiver>
|
||||||
|
<slot>setNum(int)</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>170</x>
|
||||||
|
<y>118</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>161</x>
|
||||||
|
<y>69</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>horizontalSlider_dirthr_up</sender>
|
||||||
|
<signal>valueChanged(int)</signal>
|
||||||
|
<receiver>label_6</receiver>
|
||||||
|
<slot>setNum(int)</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>70</x>
|
||||||
|
<y>118</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>68</x>
|
||||||
|
<y>67</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>horizontalSlider_dirthr_down</sender>
|
||||||
|
<signal>valueChanged(int)</signal>
|
||||||
|
<receiver>label_7</receiver>
|
||||||
|
<slot>setNum(int)</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>201</x>
|
||||||
|
<y>185</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>149</x>
|
||||||
|
<y>135</y>
|
||||||
|
</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>
|
264
client/ui/ui_overlays.h
Normal file
264
client/ui/ui_overlays.h
Normal file
|
@ -0,0 +1,264 @@
|
||||||
|
/********************************************************************************
|
||||||
|
** Form generated from reading UI file 'overlays.ui'
|
||||||
|
**
|
||||||
|
** 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 UI_OVERLAYS_H
|
||||||
|
#define UI_OVERLAYS_H
|
||||||
|
|
||||||
|
#include <QtCore/QVariant>
|
||||||
|
#include <QAction>
|
||||||
|
#include <QApplication>
|
||||||
|
#include <QButtonGroup>
|
||||||
|
#include <QFormLayout>
|
||||||
|
#include <QHBoxLayout>
|
||||||
|
#include <QHeaderView>
|
||||||
|
#include <QLabel>
|
||||||
|
#include <QPushButton>
|
||||||
|
#include <QSlider>
|
||||||
|
#include <QSpacerItem>
|
||||||
|
#include <QTabWidget>
|
||||||
|
#include <QVBoxLayout>
|
||||||
|
#include <QWidget>
|
||||||
|
|
||||||
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
class Ui_Form
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
QVBoxLayout *verticalLayout_3;
|
||||||
|
QTabWidget *tabWidget_overlays;
|
||||||
|
QWidget *tab;
|
||||||
|
QVBoxLayout *verticalLayout_2;
|
||||||
|
QFormLayout *formLayout;
|
||||||
|
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;
|
||||||
|
QLabel *label_2;
|
||||||
|
QLabel *label_6;
|
||||||
|
QSlider *horizontalSlider_dirthr_up;
|
||||||
|
QFormLayout *formLayout_3;
|
||||||
|
QLabel *label_3;
|
||||||
|
QLabel *label_7;
|
||||||
|
QSlider *horizontalSlider_dirthr_down;
|
||||||
|
QSpacerItem *verticalSpacer_2;
|
||||||
|
QHBoxLayout *horizontalLayout;
|
||||||
|
QPushButton *pushButton_apply;
|
||||||
|
QPushButton *pushButton_sticky;
|
||||||
|
QSpacerItem *horizontalSpacer;
|
||||||
|
QLabel *label_4;
|
||||||
|
|
||||||
|
void setupUi(QWidget *Form)
|
||||||
|
{
|
||||||
|
if (Form->objectName().isEmpty())
|
||||||
|
Form->setObjectName(QStringLiteral("Form"));
|
||||||
|
Form->resize(614, 286);
|
||||||
|
verticalLayout_3 = new QVBoxLayout(Form);
|
||||||
|
verticalLayout_3->setObjectName(QStringLiteral("verticalLayout_3"));
|
||||||
|
tabWidget_overlays = new QTabWidget(Form);
|
||||||
|
tabWidget_overlays->setObjectName(QStringLiteral("tabWidget_overlays"));
|
||||||
|
tab = new QWidget();
|
||||||
|
tab->setObjectName(QStringLiteral("tab"));
|
||||||
|
tab->setFocusPolicy(Qt::StrongFocus);
|
||||||
|
verticalLayout_2 = new QVBoxLayout(tab);
|
||||||
|
verticalLayout_2->setObjectName(QStringLiteral("verticalLayout_2"));
|
||||||
|
formLayout = new QFormLayout();
|
||||||
|
formLayout->setObjectName(QStringLiteral("formLayout"));
|
||||||
|
label_5 = new QLabel(tab);
|
||||||
|
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(QStringLiteral("horizontalSlider_window"));
|
||||||
|
horizontalSlider_window->setMinimum(10);
|
||||||
|
horizontalSlider_window->setMaximum(10000);
|
||||||
|
horizontalSlider_window->setValue(2000);
|
||||||
|
horizontalSlider_window->setOrientation(Qt::Horizontal);
|
||||||
|
|
||||||
|
verticalLayout_2->addWidget(horizontalSlider_window);
|
||||||
|
|
||||||
|
verticalSpacer = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding);
|
||||||
|
|
||||||
|
verticalLayout_2->addItem(verticalSpacer);
|
||||||
|
|
||||||
|
tabWidget_overlays->addTab(tab, QString());
|
||||||
|
tab_3 = new QWidget();
|
||||||
|
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(QStringLiteral("tab_2"));
|
||||||
|
verticalLayout = new QVBoxLayout(tab_2);
|
||||||
|
verticalLayout->setObjectName(QStringLiteral("verticalLayout"));
|
||||||
|
formLayout_2 = new QFormLayout();
|
||||||
|
formLayout_2->setObjectName(QStringLiteral("formLayout_2"));
|
||||||
|
label_2 = new QLabel(tab_2);
|
||||||
|
label_2->setObjectName(QStringLiteral("label_2"));
|
||||||
|
|
||||||
|
formLayout_2->setWidget(0, QFormLayout::LabelRole, label_2);
|
||||||
|
|
||||||
|
label_6 = new QLabel(tab_2);
|
||||||
|
label_6->setObjectName(QStringLiteral("label_6"));
|
||||||
|
|
||||||
|
formLayout_2->setWidget(0, QFormLayout::FieldRole, label_6);
|
||||||
|
|
||||||
|
|
||||||
|
verticalLayout->addLayout(formLayout_2);
|
||||||
|
|
||||||
|
horizontalSlider_dirthr_up = new QSlider(tab_2);
|
||||||
|
horizontalSlider_dirthr_up->setObjectName(QStringLiteral("horizontalSlider_dirthr_up"));
|
||||||
|
horizontalSlider_dirthr_up->setMaximum(128);
|
||||||
|
horizontalSlider_dirthr_up->setValue(20);
|
||||||
|
horizontalSlider_dirthr_up->setOrientation(Qt::Horizontal);
|
||||||
|
|
||||||
|
verticalLayout->addWidget(horizontalSlider_dirthr_up);
|
||||||
|
|
||||||
|
formLayout_3 = new QFormLayout();
|
||||||
|
formLayout_3->setObjectName(QStringLiteral("formLayout_3"));
|
||||||
|
label_3 = new QLabel(tab_2);
|
||||||
|
label_3->setObjectName(QStringLiteral("label_3"));
|
||||||
|
|
||||||
|
formLayout_3->setWidget(0, QFormLayout::LabelRole, label_3);
|
||||||
|
|
||||||
|
label_7 = new QLabel(tab_2);
|
||||||
|
label_7->setObjectName(QStringLiteral("label_7"));
|
||||||
|
|
||||||
|
formLayout_3->setWidget(0, QFormLayout::FieldRole, label_7);
|
||||||
|
|
||||||
|
|
||||||
|
verticalLayout->addLayout(formLayout_3);
|
||||||
|
|
||||||
|
horizontalSlider_dirthr_down = new QSlider(tab_2);
|
||||||
|
horizontalSlider_dirthr_down->setObjectName(QStringLiteral("horizontalSlider_dirthr_down"));
|
||||||
|
horizontalSlider_dirthr_down->setMaximum(127);
|
||||||
|
horizontalSlider_dirthr_down->setOrientation(Qt::Horizontal);
|
||||||
|
|
||||||
|
verticalLayout->addWidget(horizontalSlider_dirthr_down);
|
||||||
|
|
||||||
|
verticalSpacer_2 = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding);
|
||||||
|
|
||||||
|
verticalLayout->addItem(verticalSpacer_2);
|
||||||
|
|
||||||
|
tabWidget_overlays->addTab(tab_2, QString());
|
||||||
|
|
||||||
|
verticalLayout_3->addWidget(tabWidget_overlays);
|
||||||
|
|
||||||
|
horizontalLayout = new QHBoxLayout();
|
||||||
|
horizontalLayout->setObjectName(QStringLiteral("horizontalLayout"));
|
||||||
|
pushButton_apply = new QPushButton(Form);
|
||||||
|
pushButton_apply->setObjectName(QStringLiteral("pushButton_apply"));
|
||||||
|
|
||||||
|
horizontalLayout->addWidget(pushButton_apply);
|
||||||
|
|
||||||
|
pushButton_sticky = new QPushButton(Form);
|
||||||
|
pushButton_sticky->setObjectName(QStringLiteral("pushButton_sticky"));
|
||||||
|
|
||||||
|
horizontalLayout->addWidget(pushButton_sticky);
|
||||||
|
|
||||||
|
horizontalSpacer = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
|
||||||
|
|
||||||
|
horizontalLayout->addItem(horizontalSpacer);
|
||||||
|
|
||||||
|
label_4 = new QLabel(Form);
|
||||||
|
label_4->setObjectName(QStringLiteral("label_4"));
|
||||||
|
|
||||||
|
horizontalLayout->addWidget(label_4);
|
||||||
|
|
||||||
|
|
||||||
|
verticalLayout_3->addLayout(horizontalLayout);
|
||||||
|
|
||||||
|
|
||||||
|
retranslateUi(Form);
|
||||||
|
QObject::connect(horizontalSlider_window, SIGNAL(valueChanged(int)), label_4, SLOT(setNum(int)));
|
||||||
|
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(1);
|
||||||
|
|
||||||
|
|
||||||
|
QMetaObject::connectSlotsByName(Form);
|
||||||
|
} // setupUi
|
||||||
|
|
||||||
|
void retranslateUi(QWidget *Form)
|
||||||
|
{
|
||||||
|
Form->setWindowTitle(QApplication::translate("Form", "Overlays", 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));
|
||||||
|
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", "Restore", 0));
|
||||||
|
label_4->setText(QString());
|
||||||
|
} // retranslateUi
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class Form: public Ui_Form {};
|
||||||
|
} // namespace Ui
|
||||||
|
|
||||||
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
|
#endif // UI_OVERLAYS_H
|
|
@ -1130,10 +1130,10 @@ int millerRawDecode(uint8_t *BitStream, size_t *size, int invert) {
|
||||||
//take 01 or 10 = 1 and 11 or 00 = 0
|
//take 01 or 10 = 1 and 11 or 00 = 0
|
||||||
//check for phase errors - should never have 111 or 000 should be 01001011 or 10110100 for 1010
|
//check for phase errors - should never have 111 or 000 should be 01001011 or 10110100 for 1010
|
||||||
//decodes biphase or if inverted it is AKA conditional dephase encoding AKA differential manchester encoding
|
//decodes biphase or if inverted it is AKA conditional dephase encoding AKA differential manchester encoding
|
||||||
int BiphaseRawDecode(uint8_t *BitStream, size_t *size, int offset, int invert) {
|
int BiphaseRawDecode(uint8_t *BitStream, size_t *size, int *offset, int invert) {
|
||||||
uint16_t bitnum = 0;
|
uint16_t bitnum = 0;
|
||||||
uint16_t errCnt = 0;
|
uint16_t errCnt = 0;
|
||||||
size_t i = offset;
|
size_t i = *offset;
|
||||||
uint16_t MaxBits=512;
|
uint16_t MaxBits=512;
|
||||||
//if not enough samples - error
|
//if not enough samples - error
|
||||||
if (*size < 51) return -1;
|
if (*size < 51) return -1;
|
||||||
|
@ -1143,8 +1143,8 @@ int BiphaseRawDecode(uint8_t *BitStream, size_t *size, int offset, int invert) {
|
||||||
if (BitStream[i+1]==BitStream[i+2]) offsetA=0;
|
if (BitStream[i+1]==BitStream[i+2]) offsetA=0;
|
||||||
if (BitStream[i+2]==BitStream[i+3]) offsetB=0;
|
if (BitStream[i+2]==BitStream[i+3]) offsetB=0;
|
||||||
}
|
}
|
||||||
if (!offsetA && offsetB) offset++;
|
if (!offsetA && offsetB) *offset+=1;
|
||||||
for (i=offset; i<*size-3; i+=2){
|
for (i=*offset; i<*size-3; i+=2){
|
||||||
//check for phase error
|
//check for phase error
|
||||||
if (BitStream[i+1]==BitStream[i+2]) {
|
if (BitStream[i+1]==BitStream[i+2]) {
|
||||||
BitStream[bitnum++]=7;
|
BitStream[bitnum++]=7;
|
||||||
|
@ -1490,6 +1490,7 @@ size_t aggregate_bits(uint8_t *dest, size_t size, uint8_t rfLen, uint8_t invert,
|
||||||
//by marshmellow (from holiman's base)
|
//by marshmellow (from holiman's base)
|
||||||
// full fsk demod from GraphBuffer wave to decoded 1s and 0s (no mandemod)
|
// 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) {
|
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;
|
||||||
// FSK demodulator
|
// FSK demodulator
|
||||||
size = fsk_wave_demod(dest, size, fchigh, fclow, startIdx);
|
size = fsk_wave_demod(dest, size, fchigh, fclow, startIdx);
|
||||||
size = aggregate_bits(dest, size, rfLen, invert, fchigh, fclow, startIdx);
|
size = aggregate_bits(dest, size, rfLen, invert, fchigh, fclow, startIdx);
|
||||||
|
@ -1631,8 +1632,6 @@ int AWIDdemodFSK(uint8_t *dest, size_t *size) {
|
||||||
//make sure buffer has enough data
|
//make sure buffer has enough data
|
||||||
if (*size < 96*50) return -1;
|
if (*size < 96*50) return -1;
|
||||||
|
|
||||||
if (justNoise(dest, *size)) return -2;
|
|
||||||
|
|
||||||
// FSK demodulator
|
// FSK demodulator
|
||||||
*size = fskdemod(dest, *size, 50, 1, 10, 8); // fsk2a RF/50
|
*size = fskdemod(dest, *size, 50, 1, 10, 8); // fsk2a RF/50
|
||||||
if (*size < 96) return -3; //did we get a good demod?
|
if (*size < 96) return -3; //did we get a good demod?
|
||||||
|
@ -1717,8 +1716,6 @@ int gProxII_Demod(uint8_t BitStream[], size_t *size) {
|
||||||
|
|
||||||
// loop to get raw HID waveform then FSK demodulate the TAG ID from it
|
// loop to get raw HID waveform then FSK demodulate the TAG ID from it
|
||||||
int HIDdemodFSK(uint8_t *dest, size_t *size, uint32_t *hi2, uint32_t *hi, uint32_t *lo) {
|
int HIDdemodFSK(uint8_t *dest, size_t *size, uint32_t *hi2, uint32_t *hi, uint32_t *lo) {
|
||||||
if (justNoise(dest, *size)) return -1;
|
|
||||||
|
|
||||||
size_t numStart=0, size2=*size, startIdx=0;
|
size_t numStart=0, size2=*size, startIdx=0;
|
||||||
// FSK demodulator
|
// FSK demodulator
|
||||||
*size = fskdemod(dest, size2,50,1,10,8); //fsk2a
|
*size = fskdemod(dest, size2,50,1,10,8); //fsk2a
|
||||||
|
@ -1747,7 +1744,6 @@ int HIDdemodFSK(uint8_t *dest, size_t *size, uint32_t *hi2, uint32_t *hi, uint32
|
||||||
}
|
}
|
||||||
|
|
||||||
int IOdemodFSK(uint8_t *dest, size_t size) {
|
int IOdemodFSK(uint8_t *dest, size_t size) {
|
||||||
if (justNoise(dest, size)) return -1;
|
|
||||||
//make sure buffer has data
|
//make sure buffer has data
|
||||||
if (size < 66*64) return -2;
|
if (size < 66*64) return -2;
|
||||||
// FSK demodulator
|
// FSK demodulator
|
||||||
|
@ -1797,8 +1793,6 @@ int indala26decode(uint8_t *bitStream, size_t *size, uint8_t *invert) {
|
||||||
|
|
||||||
// loop to get raw paradox waveform then FSK demodulate the TAG ID from it
|
// loop to get raw paradox waveform then FSK demodulate the TAG ID from it
|
||||||
int ParadoxdemodFSK(uint8_t *dest, size_t *size, uint32_t *hi2, uint32_t *hi, uint32_t *lo) {
|
int ParadoxdemodFSK(uint8_t *dest, size_t *size, uint32_t *hi2, uint32_t *hi, uint32_t *lo) {
|
||||||
if (justNoise(dest, *size)) return -1;
|
|
||||||
|
|
||||||
size_t numStart=0, size2=*size, startIdx=0;
|
size_t numStart=0, size2=*size, startIdx=0;
|
||||||
// FSK demodulator
|
// FSK demodulator
|
||||||
*size = fskdemod(dest, size2,50,1,10,8); //fsk2a
|
*size = fskdemod(dest, size2,50,1,10,8); //fsk2a
|
||||||
|
@ -1845,9 +1839,6 @@ int PyramiddemodFSK(uint8_t *dest, size_t *size) {
|
||||||
//make sure buffer has data
|
//make sure buffer has data
|
||||||
if (*size < 128*50) return -5;
|
if (*size < 128*50) return -5;
|
||||||
|
|
||||||
//test samples are not just noise
|
|
||||||
if (justNoise(dest, *size)) return -1;
|
|
||||||
|
|
||||||
// FSK demodulator
|
// FSK demodulator
|
||||||
*size = fskdemod(dest, *size, 50, 1, 10, 8); // fsk2a RF/50
|
*size = fskdemod(dest, *size, 50, 1, 10, 8); // fsk2a RF/50
|
||||||
if (*size < 128) return -2; //did we get a good demod?
|
if (*size < 128) return -2; //did we get a good demod?
|
||||||
|
|
|
@ -21,7 +21,7 @@ extern size_t addParity(uint8_t *BitSource, uint8_t *dest, uint8_t sourceLen,
|
||||||
extern int askdemod(uint8_t *BinStream, size_t *size, int *clk, int *invert, int maxErr, uint8_t amp, uint8_t askType);
|
extern int askdemod(uint8_t *BinStream, size_t *size, int *clk, int *invert, int maxErr, uint8_t amp, uint8_t askType);
|
||||||
extern int askdemod_ext(uint8_t *BinStream, size_t *size, int *clk, int *invert, int maxErr, uint8_t amp, uint8_t askType, int *startIdx);
|
extern int askdemod_ext(uint8_t *BinStream, size_t *size, int *clk, int *invert, int maxErr, uint8_t amp, uint8_t askType, int *startIdx);
|
||||||
extern void askAmp(uint8_t *BitStream, size_t size);
|
extern void askAmp(uint8_t *BitStream, size_t size);
|
||||||
extern int BiphaseRawDecode(uint8_t * BitStream, size_t *size, int offset, int invert);
|
extern int BiphaseRawDecode(uint8_t * BitStream, size_t *size, int *offset, int invert);
|
||||||
extern uint32_t bytebits_to_byte(uint8_t* src, size_t numbits);
|
extern uint32_t bytebits_to_byte(uint8_t* src, size_t numbits);
|
||||||
extern uint32_t bytebits_to_byteLSBF(uint8_t* src, size_t numbits);
|
extern uint32_t bytebits_to_byteLSBF(uint8_t* src, size_t numbits);
|
||||||
extern uint16_t countFC(uint8_t *BitStream, size_t size, uint8_t fskAdj);
|
extern uint16_t countFC(uint8_t *BitStream, size_t size, uint8_t fskAdj);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue