From bc8bc6101e729a35643ede27da8e98686b6129cf Mon Sep 17 00:00:00 2001 From: Nils Clark-Bernhard Date: Fri, 17 Jun 2022 19:50:51 +0200 Subject: [PATCH] Changes from pull request https://github.com/Chysn/O_C-HemisphereSuite/pull/51 --- software/o_c_REV/HEM_ADSREG.ino | 8 ++++++++ software/o_c_REV/HemisphereApplet.h | 9 +++++++++ 2 files changed, 17 insertions(+) diff --git a/software/o_c_REV/HEM_ADSREG.ino b/software/o_c_REV/HEM_ADSREG.ino index 5922ed9b4..4a9df3922 100644 --- a/software/o_c_REV/HEM_ADSREG.ino +++ b/software/o_c_REV/HEM_ADSREG.ino @@ -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(); } diff --git a/software/o_c_REV/HemisphereApplet.h b/software/o_c_REV/HemisphereApplet.h index 0a64d681d..a47a425de 100644 --- a/software/o_c_REV/HemisphereApplet.h +++ b/software/o_c_REV/HemisphereApplet.h @@ -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 ////////////////////////////////////////////////////////////////////////////////