Browse Source

„Readme.md“ ändern

master
parent
commit
af8bcb329f
1 changed files with 103 additions and 2 deletions
  1. +103
    -2
      Readme.md

+ 103
- 2
Readme.md View File

@ -34,6 +34,10 @@ Macros are defined to help use the library easily, making possible to modify the
* **DISP_WIDTH** and **DISP_HEIGHT** are hardware specific (SSD1306), it's possible to modify this values in the case that it's required to employ a different kind of display.
* **REFRESH** is the time in milliseconds the interface will take in refreshing (this time affects the loop, keep that in mind)
## Content types
## Classes
In this section, the created classes are discussed, to better understand how each of them works.
@ -90,7 +94,7 @@ Methods accessed by others from Screen class. These return and integer correspon
With this method, an option is drawn. This is another method that shouldn't be called directly, as there are other methods in the next classes that call it for all the options in a menu.
This function requires the parameters shown in its prototype:
void drawopt(int page, int pos, int optPPage)
void drawOpt(int page, int pos, int optPPage)
These parameters are obtained automatically from the method drawMenu in Menu that draws all the options within it. In this method, if the option is selected, then it will be printed in a filled rectangle, otherwise, it will appear as a black rectangle.
@ -156,11 +160,108 @@ Both methods are used to get the integers corresponding to the destination of th
##### drawMenu()
**drawMenu()** is used to draw all the options in the menu.
**drawMenu()** is used to draw all the options in the menu. It draws only the options that have been configured, thus ignores those within the array **opt** that haven't been used. To draw the options, it is important to provide the parameters for the drawOpt() method in Option, which are page, pos and optPPage, so first we get the page by getting the options per page, optPPage is calculated according to **sizey**, defined at the creation of the menu (this calculation takes into account the macro DISP_HEIGHT, discussed previously), pos is the attribute of the menu, which stores the current position of the cursor (option to display as selected by user). All the above is shown in the next lines:
void drawMenu(){
display.clearDisplay();
this->page = pos/this->optPPage;
for(int i = 0; i < options; i++){
this->opt[i].drawopt(this->page, this->pos, this->optPPage);
}
display.display();
}
In configure():
this->optPPage = DISP_HEIGHT / this->sizey;
##### extractPos() and extractOptNumber()
These methods are only used to extract values from the attributes of the objects of Menu. These data will be useful for knowing where the cursor is in regards to the number of options in the menu. That way, it's possible to prevent the cursor from moving beyond the options in the menu. These will be used in another method from Screen.
##### increasePos() and decreasePos()
These methods are accessed by Screen in order to increase or decrease the position of the cursor, since Screen serves as the controller of the whole interface, and keyboard interacts directly with its methods.
##### Previous screen storing
In order to store the previous screen, it's necessary to store the values that lead to it, both, index and type of content, thus four methods are implemented for that, two of them retrieve the values of the actual screen before changing to the new menu, the other two methods are called to store them in the latter, modifying the attributes **previousScreen** and **previousContentType**.
**setPreviousScreen(int previousIndex)** and **setPreviousScreenType(int previousScreenType)** store the values of the previous screen passed from a Screen object, making it possible to go to the next menu and update the current Screen attributes, without losing the data of the previous screen.
**getPreviousScreen()** and **getPreviousScreenType()** retrieve the data from **previousScreen** and **previousScreenType**, allowing the transition to a previous menu.
### Graph class
This class is for the creation of graphs. It allows the ploting of three types of graphs: vertical bar, horizontal bar and cartesian chart.
#### Attributes
To achieve the above stated the following attributes are used:
private:
String title;
char graphType; //'a' Vertical Bar, 'b' Horizontal Bar, 'c' Cartesian Graph
//Assign whatever value in "configure(..." if a parameter is not required for the specified graphType
double value; //For: Vertical Bar Horizontal Bar Cartesian
double xpos; //For: Vertical Bar Horizontal Bar Cartesian
double ypos; //For: Vertical Bar Horizontal Bar Cartesian
double height; //For: Vertical Bar Horizontal Bar Cartesian
double width; //For: Vertical Bar Horizontal Bar Cartesian
double yminimum; //For: Vertical Bar Cartesian
double ymaximum; //For: Vertical Bar Cartesian
double xminimum; //For: Horizontal Bar Cartesian
double xmaximum; //For: Horizontal Bar Cartesian
double yStepSize; //For: Vertical Bar Cartesian
double xStepSize; //For: Horizontal Bar Cartesian
int digit; //For: Vertical Bar Horizontal Bar Cartesian
double x;
double yrange;
double xrange;
double ox;
double oy;
double count;
double graphScale;
bool redraw = true;
int previousScreen = 0;
int previousContentType = 0;
* **title**: This string allocates the name of the graph to be displayed at the top of the display.
* **graphType**: The type of graph created 'a' means a vertical graph, 'b' a horizontal graph and 'c' a cartesian chart.
* **value**: It's the value to pass to the graph, there is method for that. This attribute is used by all types of graphs.
* **xpos**: This is the position in x of the bottom left corner of the graph. Required by all graph types.
* **ypos**: This is the position in y of the bottom left corner of the graph. Required by all graph types.
* **height**: Height of the graph (pixels).
* **width**: Width of the graph(pixels).
* **yminimum**: This is the minimum value to be graphed in the y axis. Required only for vertical graph and cartesian chart.
* **ymaximum**: Maximum value to graph in the y axis. Required only for vertical graph and cartesian chart.
* **xminimum**: This is the minimum value to be graphed in the x axis. Required only for horizontal graph and cartesian chart.
* **xmaximum**: Maximum value to graph in the x axis. Required only for horizontal graph and cartesian chart.
* **yStepSize**: Size of the step in the y axis. This is the interval in which the axis is going to be split. Required only for vertical graph and cartesian chart.
* **xStepSize**: Size of the step in the x axis. This is the interval in which the axis is going to be split. Required only for horizontal graph and cartesian chart.
* **digit**: Number of decimal digits to display in the axis labels.
* **x**: This is used to know the ending point of a line in the cartesian chart.
* **yrange**: Range in the y axis, depends on the maximum and minimum of this axis.
* **xrange**: Range in the x axis, depends on the maximum and minimum of this axis.
* **ox**: Starting point in x of a line to plot in the cartesian chart (Previous *x* value).
* **oy**: Starting point in y of a line to plot in the cartesian chart (Previous value received).
* **count**: Last iteration of the cartesian chart, in the x axis.
* **graphScale**: Scale of the graph (vertical or horizontal), according to its minimum and maximum.
* **redraw**: This boolean should only be true then the whole screen was cleared. It redraws the axes or the bars respectively.
* **previousScreen** and **previousContentType**: These integers keep the values of the screen that led to this graph, to make it possible to return to that screen. This values are assigned from a method in Graph, called from another one in Screen, which is used to control the interaction with the interface. This will be discussed later in this document, see Screen class.
#### Methods
The following methods are applied to manage data from Graph.
##### configure()
This method sets up the new graph, its main attributes are defined here. The parameters passed in this case include all the attributes required for any kind of graph, however, as stated in some other methods, this one should not be called, there are some methods in Screen that call for this method and only require the parameters necessary for a certain type of graph (**createVGraph()**, **createHGraph()**, **createCGraph()**), these will be explained later.
### Screen class
### Keyboard class


Loading…
Cancel
Save