int GraphBuffer[MAX_GRAPH_TRACE_LEN];
int GraphTraceLen;
double CursorScaleFactor;
+int PlotGridX, PlotGridY;
int CommandFinished;
int offline;
extern int GraphBuffer[MAX_GRAPH_TRACE_LEN];
extern int GraphTraceLen;
extern double CursorScaleFactor;
+extern int PlotGridX, PlotGridY;
extern int CommandFinished;
extern int offline;
void ProxWidget::paintEvent(QPaintEvent *event)
{
QPainter painter(this);
- QPainterPath penPath, whitePath, greyPath, cursorAPath, cursorBPath;
+ QPainterPath penPath, whitePath, greyPath, lightgreyPath, cursorAPath, cursorBPath;
QRect r;
QBrush brush(QColor(100, 255, 100));
QPen pen(QColor(100, 255, 100));
greyPath.lineTo(r.right(), zeroHeight);
painter.setPen(QColor(100, 100, 100));
painter.drawPath(greyPath);
+
+ // plot X and Y grid lines
+ int i;
+ if ((PlotGridX > 0) && ((PlotGridX * GraphPixelsPerPoint) > 1)) {
+ for(i = GraphStart; 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(),zeroHeight + i);
+ lightgreyPath.lineTo(r.right(),zeroHeight + i);
+ painter.drawPath(lightgreyPath);
+ lightgreyPath.moveTo(r.left(),zeroHeight - i);
+ lightgreyPath.lineTo(r.right(),zeroHeight - i);
+ painter.drawPath(lightgreyPath);
+ }
+ }
int startMax =
(GraphTraceLen - (int)((r.right() - r.left() - 40) / GraphPixelsPerPoint));
int absYMax = 1;
- int i;
for(i = GraphStart; ; i++) {
if(i >= GraphTraceLen) {
break;
\r
static void CmdGrid(char *str)\r
{\r
- int x = 0, y = 0;\r
- sscanf(str, "%i %i", &x, &y);\r
- SetGraphGrid(x, y);\r
+ sscanf(str, "%i %i", &PlotGridX, &PlotGridY);\r
RepaintGraphWindow();\r
}\r
\r
{"flexdemod", CmdFlexdemod, 1, "Demodulate samples for FlexPass"},\r
{"fpgaoff", CmdFPGAOff, 0, "Set FPGA off"},\r
{"fskdemod", CmdFSKdemod, 1, "Demodulate graph window as a HID FSK"},\r
- {"grid", CmdGrid, 1, "grid x y, overlay grid on graph window, use zero value to turn off either"},\r
+ {"grid", CmdGrid, 1, "<x> <y> -- overlay grid on graph window, use zero value to turn off either"},\r
{"hexsamples", CmdHexsamples, 0, "<blocks> -- Dump big buffer as hex bytes"},\r
{"hi14alist", CmdHi14alist, 0, "List ISO 14443a history"},\r
{"hi14areader", CmdHi14areader, 0, "Act like an ISO14443 Type A reader"},\r
int CommandFinished;\r
int offset = 64;\r
\r
-void SetGraphGrid(int x, int y)\r
-{\r
- PlotGridX = x;\r
- PlotGridY = y;\r
-}\r
-\r
static void ResizeCommandWindow(void)\r
{\r
int w, h;\r
void HideGraphWindow(void);\r
void ShowGraphWindow(void);\r
void RepaintGraphWindow(void);\r
-void SetGraphGrid(int x, int y);\r
void PrintToScrollback(char *fmt, ...);\r
#define MAX_GRAPH_TRACE_LEN (1024*128)\r
extern int GraphBuffer[MAX_GRAPH_TRACE_LEN];\r
extern int GraphTraceLen;\r
extern double CursorScaleFactor;\r
+extern int PlotGridX, PlotGridY;\r
extern int CommandFinished;\r
extern int offline;\r
\r