mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2024-09-22 16:26:14 +08:00
fix demod plot on first sample, remove spurious vertical line
This commit is contained in:
parent
f65bc9af36
commit
6e3eff356b
|
@ -443,9 +443,6 @@ void ProxWidget::resizeEvent(QResizeEvent *event) {
|
|||
//----------- Plotting
|
||||
|
||||
int Plot::xCoordOf(int i, QRect r) {
|
||||
if (i < 0) {
|
||||
i = 0;
|
||||
}
|
||||
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));
|
||||
char str[5];
|
||||
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;
|
||||
int clk = first_delta_x;
|
||||
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++) {
|
||||
x = xCoordOf(DemodStart + delta_x + j, plotRect);
|
||||
int x = xCoordOf(DemodStart + delta_x + j, plotRect);
|
||||
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);
|
||||
|
||||
}
|
||||
if (GraphPixelsPerPoint > 10) {
|
||||
QRect f(QPoint(x - 3, y - 3), QPoint(x + 3, y + 3));
|
||||
painter->fillRect(f, getColor(graphNum));
|
||||
|
|
Loading…
Reference in a new issue