From fac94abbd31cd39a2658540df051bba132700ec1 Mon Sep 17 00:00:00 2001 From: aquazx20 Date: Sun, 28 May 2023 20:23:57 -0600 Subject: [PATCH] Documentation updated. Comments added and corrected. --- Singleshot_Graph.ino | 6 +++--- resources/Graph.h | 3 +-- resources/Modifier.h | 16 ++++++++-------- resources/Screen.h | 2 +- 4 files changed, 13 insertions(+), 14 deletions(-) diff --git a/Singleshot_Graph.ino b/Singleshot_Graph.ino index f560fe2..f309d99 100644 --- a/Singleshot_Graph.ino +++ b/Singleshot_Graph.ino @@ -19,7 +19,7 @@ void setup(){ screen.createMenu(128, 13); //Menu 0 - screen.createCGraph("Test", 30, 50, 75, 30, 0, 100, 0, 1000, 25, 250, 0); //Graph 0 + screen.createCGraph("Test", 30, 50, 75, 30, 0, 100, 0, 25, 250, 0, &samples); //Graph 0 screen.createModifier("Multiplier", &multiplier, 5, 1, 1); //Modifier 0 screen.createModifier("Samples number", &samples, 1000, 500, 10); //Modifier 1 @@ -50,8 +50,8 @@ void loop(){ } while(screen.getCurrentScreen() == 0 && screen.getContentType() == 1){ - screen.control(); //Controls the screen and redraws if needed while not in the test's graph + screen.control(); //Controls the screen and redraws if needed while in the test's graph keyboard.control(); delay(REFRESH); } -} \ No newline at end of file +} diff --git a/resources/Graph.h b/resources/Graph.h index e055f39..f605403 100644 --- a/resources/Graph.h +++ b/resources/Graph.h @@ -18,7 +18,7 @@ class Graph{ //ContentType (1) double yStepSize; //For: Vertical Bar Cartesian double xStepSize; //For: Horizontal Bar Cartesian int digit; //For: Vertical Bar Horizontal Bar Cartesian - int * maximum; + int * maximum; //For: Cartesian double x; double yrange; double xrange; @@ -164,7 +164,6 @@ class Graph{ //ContentType (1) display.setTextColor(SSD1306_WHITE, SSD1306_BLACK); for ( i = this->yminimum; i <= this->ymaximum; i += this->yStepSize) { // compute the transform - // note my transform funcition is the same as the map function, except the map uses long and we need doubles temp = (i - this->yminimum) * (- this->height) / (this->ymaximum - this->yminimum) + this->ypos; if (i == 0) { display.drawFastHLine(this->xpos - 3, temp, this->width + 3, SSD1306_WHITE); diff --git a/resources/Modifier.h b/resources/Modifier.h index bafbc7c..773b499 100644 --- a/resources/Modifier.h +++ b/resources/Modifier.h @@ -1,11 +1,11 @@ class Modifier{ //ContentType (2) private: - String title; - int *value; - int max; - int min; - int step; + String title; //Title of the modifier + int *value; //Pointer to the value to modify + int max; //Highest value to set + int min; //Lowest value to set + int step; //Size of the step int previousScreen = 0; int previousContentType = 0; @@ -20,7 +20,7 @@ class Modifier{ //ContentType (2) this->step = step; } - void drawModifier(){ + void drawModifier(){ //Draws or redraws the screen display.clearDisplay(); display.fillRect(0, 0, 127 , 16, SSD1306_WHITE); display.setTextColor(SSD1306_BLACK, SSD1306_WHITE); @@ -38,13 +38,13 @@ class Modifier{ //ContentType (2) display.setTextSize(1); } - void increaseValue(){ + void increaseValue(){ //Increases the value of the variable if((*this->value + this->step) <= this->max){ *this->value += this->step; } } - void decreaseValue(){ + void decreaseValue(){ //Decreases the value of the variable if((*this->value - this->step) >= this->min){ *this->value -= this->step; } diff --git a/resources/Screen.h b/resources/Screen.h index 28bbe32..40ee345 100644 --- a/resources/Screen.h +++ b/resources/Screen.h @@ -7,7 +7,7 @@ class Screen{ int counterM = 0; //Number of menus created int counterG = 0; //Number of graphs created - int counterMod = 0; + int counterMod = 0; //Number of modifiers created bool redraw = true; //Redraw interface for when there is a change of screen int currentScreen = 0; int contentType = 0;