2 Commits

4 changed files with 13 additions and 14 deletions
Unified View
  1. +3
    -3
      Singleshot_Graph.ino
  2. +1
    -2
      resources/Graph.h
  3. +8
    -8
      resources/Modifier.h
  4. +1
    -1
      resources/Screen.h

+ 3
- 3
Singleshot_Graph.ino View File

@ -19,7 +19,7 @@ void setup(){
screen.createMenu(128, 13); //Menu 0 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("Multiplier", &multiplier, 5, 1, 1); //Modifier 0
screen.createModifier("Samples number", &samples, 1000, 500, 10); //Modifier 1 screen.createModifier("Samples number", &samples, 1000, 500, 10); //Modifier 1
@ -50,8 +50,8 @@ void loop(){
} }
while(screen.getCurrentScreen() == 0 && screen.getContentType() == 1){ 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(); keyboard.control();
delay(REFRESH); delay(REFRESH);
} }
}
}

+ 1
- 2
resources/Graph.h View File

@ -18,7 +18,7 @@ class Graph{ //ContentType (1)
double yStepSize; //For: Vertical Bar Cartesian double yStepSize; //For: Vertical Bar Cartesian
double xStepSize; //For: Horizontal Bar Cartesian double xStepSize; //For: Horizontal Bar Cartesian
int digit; //For: Vertical Bar Horizontal Bar Cartesian int digit; //For: Vertical Bar Horizontal Bar Cartesian
int * maximum;
int * maximum; //For: Cartesian
double x; double x;
double yrange; double yrange;
double xrange; double xrange;
@ -164,7 +164,6 @@ class Graph{ //ContentType (1)
display.setTextColor(SSD1306_WHITE, SSD1306_BLACK); display.setTextColor(SSD1306_WHITE, SSD1306_BLACK);
for ( i = this->yminimum; i <= this->ymaximum; i += this->yStepSize) { for ( i = this->yminimum; i <= this->ymaximum; i += this->yStepSize) {
// compute the transform // 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; temp = (i - this->yminimum) * (- this->height) / (this->ymaximum - this->yminimum) + this->ypos;
if (i == 0) { if (i == 0) {
display.drawFastHLine(this->xpos - 3, temp, this->width + 3, SSD1306_WHITE); display.drawFastHLine(this->xpos - 3, temp, this->width + 3, SSD1306_WHITE);


+ 8
- 8
resources/Modifier.h View File

@ -1,11 +1,11 @@
class Modifier{ //ContentType (2) class Modifier{ //ContentType (2)
private: 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 previousScreen = 0;
int previousContentType = 0; int previousContentType = 0;
@ -20,7 +20,7 @@ class Modifier{ //ContentType (2)
this->step = step; this->step = step;
} }
void drawModifier(){
void drawModifier(){ //Draws or redraws the screen
display.clearDisplay(); display.clearDisplay();
display.fillRect(0, 0, 127 , 16, SSD1306_WHITE); display.fillRect(0, 0, 127 , 16, SSD1306_WHITE);
display.setTextColor(SSD1306_BLACK, SSD1306_WHITE); display.setTextColor(SSD1306_BLACK, SSD1306_WHITE);
@ -38,13 +38,13 @@ class Modifier{ //ContentType (2)
display.setTextSize(1); display.setTextSize(1);
} }
void increaseValue(){
void increaseValue(){ //Increases the value of the variable
if((*this->value + this->step) <= this->max){ if((*this->value + this->step) <= this->max){
*this->value += this->step; *this->value += this->step;
} }
} }
void decreaseValue(){
void decreaseValue(){ //Decreases the value of the variable
if((*this->value - this->step) >= this->min){ if((*this->value - this->step) >= this->min){
*this->value -= this->step; *this->value -= this->step;
} }


+ 1
- 1
resources/Screen.h View File

@ -7,7 +7,7 @@ class Screen{
int counterM = 0; //Number of menus created int counterM = 0; //Number of menus created
int counterG = 0; //Number of graphs 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 bool redraw = true; //Redraw interface for when there is a change of screen
int currentScreen = 0; int currentScreen = 0;
int contentType = 0; int contentType = 0;


Loading…
Cancel
Save