mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-22 06:13:51 -07:00
fix demod plot on first sample, remove spurious vertical line
This commit is contained in:
parent
f65bc9af36
commit
6e3eff356b
1 changed files with 7 additions and 16 deletions
|
@ -443,9 +443,6 @@ void ProxWidget::resizeEvent(QResizeEvent *event) {
|
||||||
//----------- Plotting
|
//----------- Plotting
|
||||||
|
|
||||||
int Plot::xCoordOf(int i, QRect r) {
|
int Plot::xCoordOf(int i, QRect r) {
|
||||||
if (i < 0) {
|
|
||||||
i = 0;
|
|
||||||
}
|
|
||||||
return r.left() + (int)((i - GraphStart) * GraphPixelsPerPoint);
|
return r.left() + (int)((i - GraphStart) * GraphPixelsPerPoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -536,25 +533,19 @@ void Plot::PlotDemod(uint8_t *buffer, size_t len, QRect plotRect, QRect annotati
|
||||||
painter->setPen(getColor(graphNum));
|
painter->setPen(getColor(graphNum));
|
||||||
char str[5];
|
char str[5];
|
||||||
int absVMax = (int)(100 * 1.05 + 1);
|
int absVMax = (int)(100 * 1.05 + 1);
|
||||||
int x = xCoordOf(DemodStart, plotRect);
|
|
||||||
int y = 0;
|
|
||||||
if (DemodStart >= 0) {
|
|
||||||
y = yCoordOf((buffer[BitStart] * 200 - 100) * -1, plotRect, absVMax);
|
|
||||||
} else {
|
|
||||||
y = yCoordOf(0, plotRect, absVMax);
|
|
||||||
}
|
|
||||||
penPath.moveTo(x, y);
|
|
||||||
delta_x = 0;
|
delta_x = 0;
|
||||||
int clk = first_delta_x;
|
int clk = first_delta_x;
|
||||||
for (int i = BitStart; i < (int)len && xCoordOf(delta_x + DemodStart, plotRect) < plotRect.right(); i++) {
|
for (int i = BitStart; i < (int)len && xCoordOf(delta_x + DemodStart, plotRect) < plotRect.right(); i++) {
|
||||||
for (int j = 0; j < (clk) && i < (int)len && xCoordOf(DemodStart + delta_x + j, plotRect) < plotRect.right() ; j++) {
|
for (int j = 0; j < (clk) && i < (int)len && xCoordOf(DemodStart + delta_x + j, plotRect) < plotRect.right() ; j++) {
|
||||||
x = xCoordOf(DemodStart + delta_x + j, plotRect);
|
int x = xCoordOf(DemodStart + delta_x + j, plotRect);
|
||||||
int v = buffer[i] * 200 - 100;
|
int v = buffer[i] * 200 - 100;
|
||||||
|
|
||||||
y = yCoordOf(v, plotRect, absVMax);
|
int y = yCoordOf(v, plotRect, absVMax);
|
||||||
|
if ((i == BitStart) && (j == 0)) { // First point
|
||||||
|
penPath.moveTo(x, y);
|
||||||
|
} else {
|
||||||
penPath.lineTo(x, y);
|
penPath.lineTo(x, y);
|
||||||
|
}
|
||||||
if (GraphPixelsPerPoint > 10) {
|
if (GraphPixelsPerPoint > 10) {
|
||||||
QRect f(QPoint(x - 3, y - 3), QPoint(x + 3, y + 3));
|
QRect f(QPoint(x - 3, y - 3), QPoint(x + 3, y + 3));
|
||||||
painter->fillRect(f, getColor(graphNum));
|
painter->fillRect(f, getColor(graphNum));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue