Display Class for BaseMachine

Revision:
9:a8adc9b9b3d8
Parent:
8:2a06c35302e7
Child:
10:699beb99effe
--- a/ST7565_SequencerDisplay.h	Fri Sep 09 03:13:57 2016 +0000
+++ b/ST7565_SequencerDisplay.h	Fri Sep 09 04:19:13 2016 +0000
@@ -20,22 +20,24 @@
         gLCD(_gLCD),
         runningStep(0) {};
         
-protected:
-    virtual void displayWhileStop(int step) {
+protected:    
+    void drawRunningStep(int step) {
+        gLCD->fillrect(step * 7, 3, 8, 2, 1);
+    }
+    
+    void drawSequenceGrid(int step) {
         int x, y;
         int i;
-
-        gLCD->clear();
-
-        // Pos Indicator Grid
+        
+        // Step Indicator Grid
         for (x = 0; x <= 16; x++) {
-            gLCD->drawline(x * 7, 0, x * 7, 3, 1);
+            gLCD->drawline(x * 7, 0, x * 7, 2, 1);
         }
         for (y = 0; y <= 1; y++) {
-            gLCD->drawline(0, y * 3, 112, y * 3, 1);
+            gLCD->drawline(0, y * 2, 112, y * 2, 1);
         }
 
-        gLCD->fillrect(step * 7, 1, 7, 2, 1);
+        gLCD->fillrect(step * 7, 1, 7, 1, 1);
 
         // Sequence Grid
         for (x = 0; x <= 16; x++) {
@@ -56,8 +58,11 @@
             if ((this->getOctave() + 1 == noteOctave) && (pitchInOctave == 0)) {
                 gLCD->fillrect(i * 7, 5, 7, 4, 1);
             }
-        } 
-
+        }
+    }
+        
+    void drawNoteGrid() {
+        int x, i;
         // NoteOn & Tie Grid
         for (x = 0; x <= 16; x++) {
             gLCD->drawline(x * 7, 57, x * 7, 63, 1);
@@ -79,51 +84,35 @@
                 }
             }
         }
-        
+    }
+    
+    void drawOctave() {
         char buff[32];
         sprintf(buff, "%2d", this->getOctave());
         gLCD->drawstring(115, 0, "OC");
         gLCD->drawstring(115, 1, buff);
+    }
+    
+    virtual void displayWhileStop(int editingStep, int runningStep) {
+        gLCD->clear();
         
-        #if (DISPLAY_PARAMS_ON_LCD)    
-        char* s;
-        switch (waveShape) {
-        case 0:
-            s = "SQ";
-            break;
-        case 1:
-            s = "SW";
-            break;
-        }
-        gLCD->drawstring(115, 2, s);
-        
-        gLCD->drawstring(115, 3, "MN");
-        sprintf(buff, "%2d", this->getModNumber());
-        gLCD->drawstring(115, 4, buff);
-        
-        sprintf(buff, "%3d", this->getBpm());
-        gLCD->drawstring(109, 5, "BPM");
-        gLCD->drawstring(109, 6, buff);
-        #endif // DISPLAY_PARAMS_ON_LCD
+        drawSequenceGrid(editingStep);
+        drawNoteGrid();
+        drawRunningStep(runningStep);
+        drawOctave();       
 
         gLCD->display();
     };
     
-    virtual void displayWhileRun(int step) {
-        /*
-        //gLCD->clear();
-        gLCD->fillrect(runningStep * 7, 1, 7, 1, 0);    // 前回のrunningStepインディケータを消去
-        gLCD->fillrect(step * 7, 1, 7, 1, 1);
-        runningStep = step;
-        //gLCD->display();
+    virtual void displayWhileRun(int editingStep, int runningStep) {
+        gLCD->clear();
         
-        //char buff[32];
-        //sprintf(buff, "%d ", step);
-        //gLCD->clear();
-        //gLCD->drawstring(0, 0, buff);
+        drawSequenceGrid(editingStep);
+        drawNoteGrid();
+        drawRunningStep(runningStep);
+        drawOctave();
+        
         gLCD->display();
-        */
-        displayWhileStop(step);
     }
     
     void displayParams(int step) {