Skip to content

Commit

Permalink
dont draw outside of the LED box
Browse files Browse the repository at this point in the history
  • Loading branch information
chinenual committed Apr 28, 2024
1 parent 87f1f06 commit f48a377
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Harp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,11 @@ namespace Harp {
currDegree = 6;
}

if (currDegree < 0 || currDegree >= noteRange) {
// don't draw outside the box if something goes haywire
return;
}

#define STRIP_LED_Y_OFFSET 5.0
float height = (box.getHeight()-(2.f*STRIP_LED_Y_OFFSET)) / noteRange;
float x = STRIP_LED_X_OFFSET;
Expand Down

0 comments on commit f48a377

Please sign in to comment.