Skip to content

Commit

Permalink
Changes from pull request Chysn#51
Browse files Browse the repository at this point in the history
  • Loading branch information
suit4 committed Jun 17, 2022
1 parent 7a5c0da commit bc8bc61
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
8 changes: 8 additions & 0 deletions software/o_c_REV/HEM_ADSREG.ino
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,15 @@ public:
}

void View() {
int adsr[4] = {attack, decay, sustain, release};
const char *labels[] = {"Attack","Decay","Sustain","Release"};

gfxHeader(applet_name());
gfxPos(1, 15);
gfxPrint(labels[edit_stage]);
gfxPrint(45 + 18 - digitCount(adsr[edit_stage]) * 6, 15, adsr[edit_stage]);
gfxCursor(46, 23, 17);

DrawIndicator();
DrawADSR();
}
Expand Down
9 changes: 9 additions & 0 deletions software/o_c_REV/HemisphereApplet.h
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,15 @@ class HemisphereApplet {
return padding;
}

int digitCount(int n) {
int count = 0;
while (n != 0) {
n /= 10; // n = n/10
++count;
}
return count;
}

//////////////// Hemisphere-specific graphics methods
////////////////////////////////////////////////////////////////////////////////

Expand Down

0 comments on commit bc8bc61

Please sign in to comment.