mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-04-02 02:19:57 +08:00
Some debugstatements
This commit is contained in:
parent
722d8b2cdb
commit
3911c0a13e
2 changed files with 33 additions and 63 deletions
client
|
@ -1092,7 +1092,7 @@ bool setDemodBufferEM(uint32_t *word, size_t idx){
|
||||||
uint8_t parity[45] = {0};
|
uint8_t parity[45] = {0};
|
||||||
memcpy( parity, DemodBuffer, 45);
|
memcpy( parity, DemodBuffer, 45);
|
||||||
if (!EMwordparitytest(parity) ){
|
if (!EMwordparitytest(parity) ){
|
||||||
PrintAndLog("DEBUG: Error - EM Parity tests failed");
|
if (g_debugMode) PrintAndLog("DEBUG: Error - EM Parity tests failed");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,28 +34,23 @@ int startMax;
|
||||||
int PageWidth;
|
int PageWidth;
|
||||||
int unlockStart = 0;
|
int unlockStart = 0;
|
||||||
|
|
||||||
void ProxGuiQT::ShowGraphWindow(void)
|
void ProxGuiQT::ShowGraphWindow(void) {
|
||||||
{
|
|
||||||
emit ShowGraphWindowSignal();
|
emit ShowGraphWindowSignal();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProxGuiQT::RepaintGraphWindow(void)
|
void ProxGuiQT::RepaintGraphWindow(void) {
|
||||||
{
|
|
||||||
emit RepaintGraphWindowSignal();
|
emit RepaintGraphWindowSignal();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProxGuiQT::HideGraphWindow(void)
|
void ProxGuiQT::HideGraphWindow(void) {
|
||||||
{
|
|
||||||
emit HideGraphWindowSignal();
|
emit HideGraphWindowSignal();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProxGuiQT::Exit(void)
|
void ProxGuiQT::Exit(void) {
|
||||||
{
|
|
||||||
emit ExitSignal();
|
emit ExitSignal();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProxGuiQT::_ShowGraphWindow(void)
|
void ProxGuiQT::_ShowGraphWindow(void) {
|
||||||
{
|
|
||||||
if(!plotapp)
|
if(!plotapp)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -65,16 +60,14 @@ void ProxGuiQT::_ShowGraphWindow(void)
|
||||||
plotwidget->show();
|
plotwidget->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProxGuiQT::_RepaintGraphWindow(void)
|
void ProxGuiQT::_RepaintGraphWindow(void) {
|
||||||
{
|
|
||||||
if (!plotapp || !plotwidget)
|
if (!plotapp || !plotwidget)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
plotwidget->update();
|
plotwidget->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProxGuiQT::_HideGraphWindow(void)
|
void ProxGuiQT::_HideGraphWindow(void) {
|
||||||
{
|
|
||||||
if (!plotapp || !plotwidget)
|
if (!plotapp || !plotwidget)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -85,8 +78,7 @@ void ProxGuiQT::_Exit(void) {
|
||||||
delete this;
|
delete this;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProxGuiQT::MainLoop()
|
void ProxGuiQT::MainLoop() {
|
||||||
{
|
|
||||||
plotapp = new QApplication(argc, argv);
|
plotapp = new QApplication(argc, argv);
|
||||||
|
|
||||||
connect(this, SIGNAL(ShowGraphWindowSignal()), this, SLOT(_ShowGraphWindow()));
|
connect(this, SIGNAL(ShowGraphWindowSignal()), this, SLOT(_ShowGraphWindow()));
|
||||||
|
@ -99,68 +91,52 @@ void ProxGuiQT::MainLoop()
|
||||||
|
|
||||||
ProxGuiQT::ProxGuiQT(int argc, char **argv) : plotapp(NULL), plotwidget(NULL), argc(argc), argv(argv) {}
|
ProxGuiQT::ProxGuiQT(int argc, char **argv) : plotapp(NULL), plotwidget(NULL), argc(argc), argv(argv) {}
|
||||||
|
|
||||||
ProxGuiQT::~ProxGuiQT(void)
|
ProxGuiQT::~ProxGuiQT(void) {
|
||||||
{
|
|
||||||
//if (plotwidget) {
|
|
||||||
//plotwidget->destroy(true,true);
|
|
||||||
// delete plotwidget;
|
|
||||||
// plotwidget = NULL;
|
|
||||||
//}
|
|
||||||
if (plotapp) {
|
if (plotapp) {
|
||||||
plotapp->quit();
|
plotapp->quit();
|
||||||
// delete plotapp;
|
|
||||||
plotapp = NULL;
|
plotapp = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------
|
//--------------------
|
||||||
void ProxWidget::applyOperation()
|
void ProxWidget::applyOperation() {
|
||||||
{
|
|
||||||
//printf("ApplyOperation()");
|
//printf("ApplyOperation()");
|
||||||
save_restoreGB(GRAPH_SAVE);
|
save_restoreGB(GRAPH_SAVE);
|
||||||
memcpy(GraphBuffer, s_Buff, sizeof(int) * GraphTraceLen);
|
memcpy(GraphBuffer, s_Buff, sizeof(int) * GraphTraceLen);
|
||||||
RepaintGraphWindow();
|
RepaintGraphWindow();
|
||||||
}
|
}
|
||||||
void ProxWidget::stickOperation()
|
void ProxWidget::stickOperation() {
|
||||||
{
|
|
||||||
save_restoreGB(GRAPH_RESTORE);
|
save_restoreGB(GRAPH_RESTORE);
|
||||||
//printf("stickOperation()");
|
//printf("stickOperation()");
|
||||||
}
|
}
|
||||||
void ProxWidget::vchange_autocorr(int v)
|
void ProxWidget::vchange_autocorr(int v) {
|
||||||
{
|
int ans = AutoCorrelate(GraphBuffer, s_Buff, GraphTraceLen, v, true, false);
|
||||||
int ans;
|
|
||||||
ans = AutoCorrelate(GraphBuffer, s_Buff, GraphTraceLen, v, true, false);
|
|
||||||
if (g_debugMode) printf("vchange_autocorr(w:%d): %d\n", v, ans);
|
if (g_debugMode) printf("vchange_autocorr(w:%d): %d\n", v, ans);
|
||||||
g_useOverlays = true;
|
g_useOverlays = true;
|
||||||
RepaintGraphWindow();
|
RepaintGraphWindow();
|
||||||
}
|
}
|
||||||
void ProxWidget::vchange_askedge(int v)
|
void ProxWidget::vchange_askedge(int v) {
|
||||||
{
|
|
||||||
int ans;
|
|
||||||
//extern int AskEdgeDetect(const int *in, int *out, int len, int threshold);
|
//extern int AskEdgeDetect(const int *in, int *out, int len, int threshold);
|
||||||
ans = AskEdgeDetect(GraphBuffer, s_Buff, GraphTraceLen, v);
|
int ans = AskEdgeDetect(GraphBuffer, s_Buff, GraphTraceLen, v);
|
||||||
if (g_debugMode) printf("vchange_askedge(w:%d)%d\n", v, ans);
|
if (g_debugMode) printf("vchange_askedge(w:%d)%d\n", v, ans);
|
||||||
g_useOverlays = true;
|
g_useOverlays = true;
|
||||||
RepaintGraphWindow();
|
RepaintGraphWindow();
|
||||||
}
|
}
|
||||||
void ProxWidget::vchange_dthr_up(int v)
|
void ProxWidget::vchange_dthr_up(int v) {
|
||||||
{
|
|
||||||
int down = opsController->horizontalSlider_dirthr_down->value();
|
int down = opsController->horizontalSlider_dirthr_down->value();
|
||||||
directionalThreshold(GraphBuffer, s_Buff, GraphTraceLen, v, down);
|
directionalThreshold(GraphBuffer, s_Buff, GraphTraceLen, v, down);
|
||||||
//printf("vchange_dthr_up(%d)", v);
|
//printf("vchange_dthr_up(%d)", v);
|
||||||
g_useOverlays = true;
|
g_useOverlays = true;
|
||||||
RepaintGraphWindow();
|
RepaintGraphWindow();
|
||||||
}
|
}
|
||||||
void ProxWidget::vchange_dthr_down(int v)
|
void ProxWidget::vchange_dthr_down(int v) {
|
||||||
{
|
|
||||||
//printf("vchange_dthr_down(%d)", v);
|
//printf("vchange_dthr_down(%d)", v);
|
||||||
int up = opsController->horizontalSlider_dirthr_up->value();
|
int up = opsController->horizontalSlider_dirthr_up->value();
|
||||||
directionalThreshold(GraphBuffer,s_Buff, GraphTraceLen, v, up);
|
directionalThreshold(GraphBuffer,s_Buff, GraphTraceLen, v, up);
|
||||||
g_useOverlays = true;
|
g_useOverlays = true;
|
||||||
RepaintGraphWindow();
|
RepaintGraphWindow();
|
||||||
}
|
}
|
||||||
ProxWidget::ProxWidget(QWidget *parent, ProxGuiQT *master) : QWidget(parent)
|
ProxWidget::ProxWidget(QWidget *parent, ProxGuiQT *master) : QWidget(parent) {
|
||||||
{
|
|
||||||
this->master = master;
|
this->master = master;
|
||||||
resize(800,500);
|
resize(800,500);
|
||||||
|
|
||||||
|
@ -208,8 +184,7 @@ ProxWidget::ProxWidget(QWidget *parent, ProxGuiQT *master) : QWidget(parent)
|
||||||
|
|
||||||
// not 100% sure what i need in this block
|
// not 100% sure what i need in this block
|
||||||
// feel free to fix - marshmellow...
|
// feel free to fix - marshmellow...
|
||||||
ProxWidget::~ProxWidget(void)
|
ProxWidget::~ProxWidget(void) {
|
||||||
{
|
|
||||||
if (controlWidget) {
|
if (controlWidget) {
|
||||||
controlWidget->close();
|
controlWidget->close();
|
||||||
delete controlWidget;
|
delete controlWidget;
|
||||||
|
@ -227,8 +202,7 @@ ProxWidget::~ProxWidget(void)
|
||||||
plot = NULL;
|
plot = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void ProxWidget::closeEvent(QCloseEvent *event)
|
void ProxWidget::closeEvent(QCloseEvent *event) {
|
||||||
{
|
|
||||||
event->ignore();
|
event->ignore();
|
||||||
this->hide();
|
this->hide();
|
||||||
g_useOverlays = false;
|
g_useOverlays = false;
|
||||||
|
@ -244,22 +218,20 @@ void ProxWidget::showEvent(QShowEvent *event) {
|
||||||
|
|
||||||
//----------- Plotting
|
//----------- Plotting
|
||||||
|
|
||||||
int Plot::xCoordOf(int i, QRect r )
|
int Plot::xCoordOf(int i, QRect r ) {
|
||||||
{
|
|
||||||
return r.left() + (int)((i - GraphStart)*GraphPixelsPerPoint);
|
return r.left() + (int)((i - GraphStart)*GraphPixelsPerPoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Plot::yCoordOf(int v, QRect r, int maxVal)
|
int Plot::yCoordOf(int v, QRect r, int maxVal) {
|
||||||
{
|
|
||||||
int z = (r.bottom() - r.top())/2;
|
int z = (r.bottom() - r.top())/2;
|
||||||
return -(z * v) / maxVal + z;
|
return -(z * v) / maxVal + z;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Plot::valueOf_yCoord(int y, QRect r, int maxVal)
|
int Plot::valueOf_yCoord(int y, QRect r, int maxVal) {
|
||||||
{
|
|
||||||
int z = (r.bottom() - r.top())/2;
|
int z = (r.bottom() - r.top())/2;
|
||||||
return (y-z) * maxVal / z;
|
return (y-z) * maxVal / z;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const QColor GREEN = QColor(100,255,100);
|
static const QColor GREEN = QColor(100,255,100);
|
||||||
static const QColor RED = QColor(255,100,100);
|
static const QColor RED = QColor(255,100,100);
|
||||||
static const QColor BLUE = QColor(100,100,255);
|
static const QColor BLUE = QColor(100,100,255);
|
||||||
|
@ -357,8 +329,7 @@ void Plot::PlotDemod(uint8_t *buffer, size_t len, QRect plotRect, QRect annotati
|
||||||
painter->drawPath(penPath);
|
painter->drawPath(penPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Plot::PlotGraph(int *buffer, int len, QRect plotRect, QRect annotationRect, QPainter *painter, int graphNum)
|
void Plot::PlotGraph(int *buffer, int len, QRect plotRect, QRect annotationRect, QPainter *painter, int graphNum) {
|
||||||
{
|
|
||||||
if (len == 0) return;
|
if (len == 0) return;
|
||||||
// clock_t begin = clock();
|
// clock_t begin = clock();
|
||||||
QPainterPath penPath;
|
QPainterPath penPath;
|
||||||
|
@ -430,8 +401,7 @@ void Plot::PlotGraph(int *buffer, int len, QRect plotRect, QRect annotationRect,
|
||||||
//printf("Plot time %f\n", elapsed_secs);
|
//printf("Plot time %f\n", elapsed_secs);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Plot::plotGridLines(QPainter* painter,QRect r)
|
void Plot::plotGridLines(QPainter* painter,QRect r) {
|
||||||
{
|
|
||||||
// set GridOffset
|
// set GridOffset
|
||||||
if (PlotGridX <= 0) return;
|
if (PlotGridX <= 0) return;
|
||||||
int offset = GridOffset;
|
int offset = GridOffset;
|
||||||
|
|
Loading…
Add table
Reference in a new issue