mirror of
https://github.com/Proxmark/proxmark3.git
synced 2025-08-19 04:49:38 -07:00
Add plot window keystroke help
Add grid display/lock commands to plot window
This commit is contained in:
parent
7e67e42f7e
commit
7ddb990032
5 changed files with 59 additions and 7 deletions
|
@ -388,6 +388,8 @@ int CmdFSKdemod(const char *Cmd)
|
||||||
int CmdGrid(const char *Cmd)
|
int CmdGrid(const char *Cmd)
|
||||||
{
|
{
|
||||||
sscanf(Cmd, "%i %i", &PlotGridX, &PlotGridY);
|
sscanf(Cmd, "%i %i", &PlotGridX, &PlotGridY);
|
||||||
|
PlotGridXdefault= PlotGridX;
|
||||||
|
PlotGridYdefault= PlotGridY;
|
||||||
RepaintGraphWindow();
|
RepaintGraphWindow();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -874,7 +876,7 @@ static command_t CommandTable[] =
|
||||||
{"mandemod", CmdManchesterDemod, 1, "[i] [clock rate] -- Manchester demodulate binary stream (option 'i' to invert output)"},
|
{"mandemod", CmdManchesterDemod, 1, "[i] [clock rate] -- Manchester demodulate binary stream (option 'i' to invert output)"},
|
||||||
{"manmod", CmdManchesterMod, 1, "[clock rate] -- Manchester modulate a binary stream"},
|
{"manmod", CmdManchesterMod, 1, "[clock rate] -- Manchester modulate a binary stream"},
|
||||||
{"norm", CmdNorm, 1, "Normalize max/min to +/-500"},
|
{"norm", CmdNorm, 1, "Normalize max/min to +/-500"},
|
||||||
{"plot", CmdPlot, 1, "Show graph window"},
|
{"plot", CmdPlot, 1, "Show graph window (hit 'h' in window for keystroke help)"},
|
||||||
{"samples", CmdSamples, 0, "[128 - 16000] -- Get raw samples for graph window"},
|
{"samples", CmdSamples, 0, "[128 - 16000] -- Get raw samples for graph window"},
|
||||||
{"save", CmdSave, 1, "<filename> -- Save trace (from graph window)"},
|
{"save", CmdSave, 1, "<filename> -- Save trace (from graph window)"},
|
||||||
{"scale", CmdScale, 1, "<int> -- Set cursor display scale"},
|
{"scale", CmdScale, 1, "<int> -- Set cursor display scale"},
|
||||||
|
|
|
@ -23,7 +23,7 @@ void ExitGraphics(void);
|
||||||
extern int GraphBuffer[MAX_GRAPH_TRACE_LEN];
|
extern int GraphBuffer[MAX_GRAPH_TRACE_LEN];
|
||||||
extern int GraphTraceLen;
|
extern int GraphTraceLen;
|
||||||
extern double CursorScaleFactor;
|
extern double CursorScaleFactor;
|
||||||
extern int PlotGridX, PlotGridY;
|
extern int PlotGridX, PlotGridY, PlotGridXdefault, PlotGridYdefault;
|
||||||
extern int CommandFinished;
|
extern int CommandFinished;
|
||||||
extern int offline;
|
extern int offline;
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,10 @@
|
||||||
#include "proxguiqt.h"
|
#include "proxguiqt.h"
|
||||||
#include "proxgui.h"
|
#include "proxgui.h"
|
||||||
|
|
||||||
|
int GridOffset= 0;
|
||||||
|
bool GridLocked= 0;
|
||||||
|
int startMax;
|
||||||
|
|
||||||
void ProxGuiQT::ShowGraphWindow(void)
|
void ProxGuiQT::ShowGraphWindow(void)
|
||||||
{
|
{
|
||||||
emit ShowGraphWindowSignal();
|
emit ShowGraphWindowSignal();
|
||||||
|
@ -130,7 +134,7 @@ void ProxWidget::paintEvent(QPaintEvent *event)
|
||||||
// plot X and Y grid lines
|
// plot X and Y grid lines
|
||||||
int i;
|
int i;
|
||||||
if ((PlotGridX > 0) && ((PlotGridX * GraphPixelsPerPoint) > 1)) {
|
if ((PlotGridX > 0) && ((PlotGridX * GraphPixelsPerPoint) > 1)) {
|
||||||
for(i = 40; i < r.right(); i += (int)(PlotGridX * GraphPixelsPerPoint)) {
|
for(i = 40 + GridOffset; i < r.right(); i += (int)(PlotGridX * GraphPixelsPerPoint)) {
|
||||||
//SelectObject(hdc, GreyPenLite);
|
//SelectObject(hdc, GreyPenLite);
|
||||||
//MoveToEx(hdc, r.left + i, r.top, NULL);
|
//MoveToEx(hdc, r.left + i, r.top, NULL);
|
||||||
//LineTo(hdc, r.left + i, r.bottom);
|
//LineTo(hdc, r.left + i, r.bottom);
|
||||||
|
@ -150,8 +154,7 @@ void ProxWidget::paintEvent(QPaintEvent *event)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int startMax =
|
startMax = (GraphTraceLen - (int)((r.right() - r.left() - 40) / GraphPixelsPerPoint));
|
||||||
(GraphTraceLen - (int)((r.right() - r.left() - 40) / GraphPixelsPerPoint));
|
|
||||||
if(startMax < 0) {
|
if(startMax < 0) {
|
||||||
startMax = 0;
|
startMax = 0;
|
||||||
}
|
}
|
||||||
|
@ -323,18 +326,65 @@ void ProxWidget::keyPressEvent(QKeyEvent *event)
|
||||||
|
|
||||||
case Qt::Key_Right:
|
case Qt::Key_Right:
|
||||||
if(GraphPixelsPerPoint < 20) {
|
if(GraphPixelsPerPoint < 20) {
|
||||||
|
if (GridLocked && GraphStart < startMax)
|
||||||
|
GridOffset -= (int)(20 / GraphPixelsPerPoint);
|
||||||
GraphStart += (int)(20 / GraphPixelsPerPoint);
|
GraphStart += (int)(20 / GraphPixelsPerPoint);
|
||||||
} else {
|
} else {
|
||||||
GraphStart++;
|
GraphStart++;
|
||||||
|
if (GridLocked && GraphStart < startMax)
|
||||||
|
GridOffset--;
|
||||||
}
|
}
|
||||||
|
if(GridOffset < 0)
|
||||||
|
GridOffset += PlotGridX;
|
||||||
|
if (PlotGridX)
|
||||||
|
GridOffset %= PlotGridX;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Qt::Key_Left:
|
case Qt::Key_Left:
|
||||||
if(GraphPixelsPerPoint < 20) {
|
if(GraphPixelsPerPoint < 20) {
|
||||||
|
if (GridLocked && GraphStart > 0)
|
||||||
|
GridOffset += (int)(20 / GraphPixelsPerPoint);
|
||||||
GraphStart -= (int)(20 / GraphPixelsPerPoint);
|
GraphStart -= (int)(20 / GraphPixelsPerPoint);
|
||||||
} else {
|
} else {
|
||||||
GraphStart--;
|
GraphStart--;
|
||||||
|
if (GridLocked && GraphStart > 0)
|
||||||
|
GridOffset++;
|
||||||
}
|
}
|
||||||
|
if (PlotGridX)
|
||||||
|
GridOffset %= PlotGridX;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Qt::Key_G:
|
||||||
|
if(PlotGridX || PlotGridY) {
|
||||||
|
PlotGridX= 0;
|
||||||
|
PlotGridY= 0;
|
||||||
|
} else {
|
||||||
|
PlotGridX= PlotGridXdefault;
|
||||||
|
PlotGridY= PlotGridYdefault;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Qt::Key_H:
|
||||||
|
puts("Plot Window Keystrokes:\n");
|
||||||
|
puts(" Key Action\n");
|
||||||
|
puts(" DOWN Zoom in");
|
||||||
|
puts(" G Toggle grid display");
|
||||||
|
puts(" H Show help");
|
||||||
|
puts(" LEFT Move left");
|
||||||
|
puts(" L Toggle lock grid relative to samples");
|
||||||
|
puts(" Q Hide window");
|
||||||
|
puts(" RIGHT Move right");
|
||||||
|
puts(" UP Zoom out");
|
||||||
|
puts("");
|
||||||
|
puts("Use client window 'data help' for more plot commands\n");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Qt::Key_L:
|
||||||
|
GridLocked= !GridLocked;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Qt::Key_Q:
|
||||||
|
this->hide();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
#include "ui.h"
|
#include "ui.h"
|
||||||
|
|
||||||
double CursorScaleFactor;
|
double CursorScaleFactor;
|
||||||
int PlotGridX, PlotGridY;
|
int PlotGridX, PlotGridY, PlotGridXdefault= 64, PlotGridYdefault= 64;
|
||||||
int offline;
|
int offline;
|
||||||
|
|
||||||
static char *logfilename = "proxmark3.log";
|
static char *logfilename = "proxmark3.log";
|
||||||
|
|
|
@ -19,7 +19,7 @@ void PrintAndLog(char *fmt, ...);
|
||||||
void SetLogFilename(char *fn);
|
void SetLogFilename(char *fn);
|
||||||
|
|
||||||
extern double CursorScaleFactor;
|
extern double CursorScaleFactor;
|
||||||
extern int PlotGridX, PlotGridY;
|
extern int PlotGridX, PlotGridY, PlotGridXdefault, PlotGridYdefault;
|
||||||
extern int offline;
|
extern int offline;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue