State machine

Dependencies:   mbed Adafruit_GFX BioroboticsMotorControl MODSERIAL BioroboticsEMGFilter

Revision:
25:cc81f2120eda
Parent:
24:e1092f95c82b
Child:
42:cafa56da9ed2
--- a/Screen.h	Thu Nov 01 08:40:10 2018 +0000
+++ b/Screen.h	Thu Nov 01 09:10:21 2018 +0000
@@ -61,25 +61,39 @@
     }
     
     void display_up_down_arrow(bool is_up) {
-        int size = 40;
-        int x_start = oled.width() - size;
-        int x_end = x_start + size;
-        int y_start = oled.height() - size;
-        int y_end = y_start + size;
-        oled.fillRect(x_start, y_start, size, size, BLACK);
-        oled.fillTriangle(x_start, y_start, x_start + size/2, y_end, x_end, y_start,  WHITE);
+        int size_x = 20;
+        int size_y = 10;
+        int x_start = oled.width() - size_x;
+        int x_end = x_start + size_x;
+        int y_start = oled.height() - size_y;
+        int y_end = y_start + size_y;
+        
+        oled.fillRect(x_start, y_start, size_x, size_y, BLACK);
+        
+        if (is_up) {
+            oled.fillTriangle(x_start, y_end, x_end, y_end, x_start + size_x/2, y_start, WHITE);
+        } else {
+            oled.fillTriangle(x_start + size_x/2, y_end, x_start, y_start, x_end, y_start, WHITE);
+        }
         
         display();
     }
     
-        void display_left_right_arrow(bool is_right) {
-        int size = 40;
-        int x_start = oled.width() - (size * 2);
-        int x_end = x_start + size;
-        int y_start = oled.height() - size;
-        int y_end = y_start + size;
-        oled.fillRect(x_start, y_start, size, size, BLACK);
-        oled.fillTriangle(x_start, y_start, x_start + size/2, y_end, x_end, y_start,  WHITE);
+    void display_left_right_arrow(bool is_right) {
+        int size_x = 20;
+        int size_y = 10;
+        int x_start = oled.width() - size_x * 2;
+        int x_end = x_start + size_x;
+        int y_start = oled.height() - size_y;
+        int y_end = y_start + size_y;
+        
+        oled.fillRect(x_start, y_start, size_x, size_y, BLACK);
+        
+        if (is_right) {
+            oled.fillTriangle(x_start, y_end, x_end, y_start + size_y/2, x_start, y_start, WHITE);
+        } else {
+            oled.fillTriangle(x_end, y_start, x_start, y_start + size_y/2, x_end, y_end, WHITE);
+        }
         
         display();
     }