Skip to content

Commit

Permalink
Show vertical line on actual changed value instead of overwriting
Browse files Browse the repository at this point in the history
previous dot (so 0-1023 is represented by dot-vertical line instead of
starting with a vertical line).
  • Loading branch information
laurb9 committed Feb 25, 2015
1 parent e0b629a commit 57993bd
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions scope.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,14 @@ void Scope::renderGraph(uint16_t *data, uint16_t rangemV, unsigned samples){
for (i=0; i<samples; i++, data++){
x = map(i, 0, samples-1, minX, maxX);
y = map(*data, 0, rangemV, minY, maxY);
if (abs(lastY-y)>1){
if (y>lastY){
display.drawFastVLine(x-1,lastY,y-lastY+1,WHITE);
} else {
display.drawFastVLine(x-1,y,lastY-y+1,WHITE);
}
};
if (y > lastY+1 && x){
display.drawFastVLine(x,lastY,y-lastY+1,WHITE);
} else if (lastY > y+1 && x){
display.drawFastVLine(x,y,lastY-y+1,WHITE);
} else {
display.drawPixel(x, y, WHITE);
}
lastY=y;
display.drawPixel(x, y, WHITE);
}
}

Expand Down

0 comments on commit 57993bd

Please sign in to comment.