mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-19 21:03:48 -07:00
plot: allow float values for grid
This commit is contained in:
parent
984b0d4803
commit
1e37d548c2
4 changed files with 9 additions and 9 deletions
|
@ -1448,7 +1448,7 @@ void setClockGrid(uint32_t clk, int offset) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int CmdGrid(const char *Cmd) {
|
int CmdGrid(const char *Cmd) {
|
||||||
sscanf(Cmd, "%i %i", &PlotGridX, &PlotGridY);
|
sscanf(Cmd, "%lf %lf", &PlotGridX, &PlotGridY);
|
||||||
PlotGridXdefault = PlotGridX;
|
PlotGridXdefault = PlotGridX;
|
||||||
PlotGridYdefault = PlotGridY;
|
PlotGridYdefault = PlotGridY;
|
||||||
RepaintGraphWindow();
|
RepaintGraphWindow();
|
||||||
|
|
|
@ -28,7 +28,7 @@ void ExitGraphics(void);
|
||||||
|
|
||||||
extern double CursorScaleFactor;
|
extern double CursorScaleFactor;
|
||||||
extern char CursorScaleFactorUnit[11];
|
extern char CursorScaleFactorUnit[11];
|
||||||
extern int PlotGridX, PlotGridY, PlotGridXdefault, PlotGridYdefault, GridOffset;
|
extern double PlotGridX, PlotGridY, PlotGridXdefault, PlotGridYdefault, GridOffset;
|
||||||
extern uint32_t CursorCPos, CursorDPos;
|
extern uint32_t CursorCPos, CursorDPos;
|
||||||
extern int CommandFinished;
|
extern int CommandFinished;
|
||||||
extern int offline;
|
extern int offline;
|
||||||
|
|
|
@ -503,13 +503,13 @@ void Plot::plotGridLines(QPainter *painter, QRect r) {
|
||||||
// set GridOffset
|
// set GridOffset
|
||||||
if (PlotGridX <= 0) return;
|
if (PlotGridX <= 0) return;
|
||||||
|
|
||||||
int offset = GridOffset;
|
double offset = GridOffset;
|
||||||
if (GridLocked && PlotGridX) {
|
if (GridLocked && PlotGridX) {
|
||||||
offset = GridOffset + PlotGridX - (GraphStart % PlotGridX);
|
offset = GridOffset + PlotGridX - fmod(GraphStart, PlotGridX);
|
||||||
} else if (!GridLocked && GraphStart > 0 && PlotGridX) {
|
} else if (!GridLocked && GraphStart > 0 && PlotGridX) {
|
||||||
offset = PlotGridX - ((GraphStart - offset) % PlotGridX) + GraphStart - unlockStart;
|
offset = PlotGridX - fmod(GraphStart - offset, PlotGridX) + GraphStart - unlockStart;
|
||||||
}
|
}
|
||||||
offset %= PlotGridX;
|
offset = fmod(offset, PlotGridX);
|
||||||
if (offset < 0) offset += PlotGridX;
|
if (offset < 0) offset += PlotGridX;
|
||||||
|
|
||||||
double i;
|
double i;
|
||||||
|
@ -610,7 +610,7 @@ void Plot::paintEvent(QPaintEvent *event) {
|
||||||
sprintf(scalestr, "[%2.2f %s] ", ((int32_t)(CursorBPos - CursorAPos)) / CursorScaleFactor, CursorScaleFactorUnit);
|
sprintf(scalestr, "[%2.2f %s] ", ((int32_t)(CursorBPos - CursorAPos)) / CursorScaleFactor, CursorScaleFactorUnit);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sprintf(str, "@%u..%u dt=%i %szoom=%2.2f CursorAPos=%u CursorBPos=%u GridX=%d GridY=%d (%s) GridXoffset=%d",
|
sprintf(str, "@%u..%u dt=%i %szoom=%2.2f CursorAPos=%u CursorBPos=%u GridX=%lf GridY=%lf (%s) GridXoffset=%lf",
|
||||||
GraphStart,
|
GraphStart,
|
||||||
GraphStop,
|
GraphStop,
|
||||||
CursorBPos - CursorAPos,
|
CursorBPos - CursorAPos,
|
||||||
|
@ -790,7 +790,7 @@ void Plot::keyPressEvent(QKeyEvent *event) {
|
||||||
|
|
||||||
if (event->modifiers() & Qt::ShiftModifier) {
|
if (event->modifiers() & Qt::ShiftModifier) {
|
||||||
if (PlotGridX)
|
if (PlotGridX)
|
||||||
offset = PageWidth - (PageWidth % PlotGridX);
|
offset = PageWidth - fmod(PageWidth, PlotGridX);
|
||||||
else
|
else
|
||||||
offset = PageWidth;
|
offset = PageWidth;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -39,7 +39,7 @@ session_arg_t session;
|
||||||
|
|
||||||
double CursorScaleFactor = 1;
|
double CursorScaleFactor = 1;
|
||||||
char CursorScaleFactorUnit[11] = {0};
|
char CursorScaleFactorUnit[11] = {0};
|
||||||
int PlotGridX = 0, PlotGridY = 0, PlotGridXdefault = 64, PlotGridYdefault = 64;
|
double PlotGridX = 0, PlotGridY = 0, PlotGridXdefault = 64, PlotGridYdefault = 64;
|
||||||
uint32_t CursorCPos = 0, CursorDPos = 0;
|
uint32_t CursorCPos = 0, CursorDPos = 0;
|
||||||
double GraphPixelsPerPoint = 1.f; // How many visual pixels are between each sample point (x axis)
|
double GraphPixelsPerPoint = 1.f; // How many visual pixels are between each sample point (x axis)
|
||||||
static bool flushAfterWrite = 0;
|
static bool flushAfterWrite = 0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue