@marshmellow42 's fix the AskEdgeDetect cleaning tool. de53156e1e

This commit is contained in:
iceman1001 2016-06-20 13:26:45 +02:00
parent 9686a8d4d5
commit 180ec86ef0

View file

@ -877,13 +877,16 @@ int CmdGraphShiftZero(const char *Cmd)
int CmdAskEdgeDetect(const char *Cmd) int CmdAskEdgeDetect(const char *Cmd)
{ {
int thresLen = 25; int thresLen = 25;
int last = 0;
sscanf(Cmd, "%i", &thresLen); sscanf(Cmd, "%i", &thresLen);
for(int i = 1; i<GraphTraceLen; i++){ for(int i = 1; i < GraphTraceLen; ++i){
if (GraphBuffer[i]-GraphBuffer[i-1]>=thresLen) //large jump up if (GraphBuffer[i] - GraphBuffer[i-1] >= thresLen) //large jump up
GraphBuffer[i-1] = 127; last = 127;
else if(GraphBuffer[i]-GraphBuffer[i-1]<=-1*thresLen) //large jump down else if(GraphBuffer[i] - GraphBuffer[i-1] <= -1 * thresLen) //large jump down
GraphBuffer[i-1] = -127; last = -127;
GraphBuffer[i-1] = last;
} }
RepaintGraphWindow(); RepaintGraphWindow();
return 0; return 0;