mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-02-28 18:14:39 +08:00
plot trim: adjust demod graph and cursors when possible
This commit is contained in:
parent
30cc0b4b48
commit
fd3b440eea
3 changed files with 14 additions and 2 deletions
|
@ -30,7 +30,7 @@
|
|||
|
||||
uint8_t DemodBuffer[MAX_DEMOD_BUF_LEN];
|
||||
size_t DemodBufferLen = 0;
|
||||
size_t g_DemodStartIdx = 0;
|
||||
int32_t g_DemodStartIdx = 0;
|
||||
int g_DemodClock = 0;
|
||||
|
||||
static int CmdHelp(const char *Cmd);
|
||||
|
@ -1789,6 +1789,7 @@ int CmdLtrim(const char *Cmd) {
|
|||
GraphBuffer[i - ds] = GraphBuffer[i];
|
||||
|
||||
GraphTraceLen -= ds;
|
||||
g_DemodStartIdx -= ds;
|
||||
RepaintGraphWindow();
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
|
|
|
@ -86,7 +86,7 @@ extern uint8_t DemodBuffer[MAX_DEMOD_BUF_LEN];
|
|||
extern size_t DemodBufferLen;
|
||||
|
||||
extern int g_DemodClock;
|
||||
extern size_t g_DemodStartIdx;
|
||||
extern int32_t g_DemodStartIdx;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -703,6 +703,16 @@ void Plot::Trim(void) {
|
|||
if ((CursorAPos == 0) || (CursorBPos == 0)) { // if we don't have both cursors set
|
||||
lref = GraphStart;
|
||||
rref = GraphStop;
|
||||
if (CursorAPos >= lref) {
|
||||
CursorAPos -= lref;
|
||||
} else {
|
||||
CursorAPos = 0;
|
||||
}
|
||||
if (CursorBPos >= lref) {
|
||||
CursorBPos -= lref;
|
||||
} else {
|
||||
CursorBPos = 0;
|
||||
}
|
||||
} else {
|
||||
lref = CursorAPos < CursorBPos ? CursorAPos : CursorBPos;
|
||||
rref = CursorAPos < CursorBPos ? CursorBPos : CursorAPos;
|
||||
|
@ -715,6 +725,7 @@ void Plot::Trim(void) {
|
|||
CursorAPos -= lref;
|
||||
CursorBPos -= lref;
|
||||
}
|
||||
g_DemodStartIdx -= lref;
|
||||
for (uint32_t i = lref; i < rref; ++i)
|
||||
GraphBuffer[i - lref] = GraphBuffer[i];
|
||||
GraphTraceLen = rref - lref;
|
||||
|
|
Loading…
Reference in a new issue