More documentation cleanup
	
		
			
	
		
	
	
		
	
		
			All checks were successful
		
		
	
	
		
			
				
	
				continuous-integration/drone/push Build is passing
				
			
		
		
	
	
				
					
				
			
		
			All checks were successful
		
		
	
	continuous-integration/drone/push Build is passing
				
			This commit is contained in:
		| @@ -1,39 +0,0 @@ | ||||
|  | ||||
| This directory is intended for project header files. | ||||
|  | ||||
| A header file is a file containing C declarations and macro definitions | ||||
| to be shared between several project source files. You request the use of a | ||||
| header file in your project source file (C, C++, etc) located in `src` folder | ||||
| by including it, with the C preprocessing directive `#include'. | ||||
|  | ||||
| ```src/main.c | ||||
|  | ||||
| #include "header.h" | ||||
|  | ||||
| int main (void) | ||||
| { | ||||
|  ... | ||||
| } | ||||
| ``` | ||||
|  | ||||
| Including a header file produces the same results as copying the header file | ||||
| into each source file that needs it. Such copying would be time-consuming | ||||
| and error-prone. With a header file, the related declarations appear | ||||
| in only one place. If they need to be changed, they can be changed in one | ||||
| place, and programs that include the header file will automatically use the | ||||
| new version when next recompiled. The header file eliminates the labor of | ||||
| finding and changing all the copies as well as the risk that a failure to | ||||
| find one copy will result in inconsistencies within a program. | ||||
|  | ||||
| In C, the usual convention is to give header files names that end with `.h'. | ||||
| It is most portable to use only letters, digits, dashes, and underscores in | ||||
| header file names, and at most one dot. | ||||
|  | ||||
| Read more about using header files in official GCC documentation: | ||||
|  | ||||
| * Include Syntax | ||||
| * Include Operation | ||||
| * Once-Only Headers | ||||
| * Computed Includes | ||||
|  | ||||
| https://gcc.gnu.org/onlinedocs/cpp/Header-Files.html | ||||
| @@ -12,8 +12,8 @@ bool CommandHandler::parseJSON(const char *cmd) | ||||
| { | ||||
|     Serial.print("Handling: "); | ||||
|     Serial.println(cmd); | ||||
|     StaticJsonDocument<32> doc; | ||||
|     DeserializationError error = deserializeJson(doc, cmd); | ||||
|     StaticJsonDocument<32> json; | ||||
|     DeserializationError error = deserializeJson(json, cmd); | ||||
|  | ||||
|     // Test if parsing succeeds. | ||||
|     if (error) | ||||
| @@ -23,12 +23,12 @@ bool CommandHandler::parseJSON(const char *cmd) | ||||
|         return false; | ||||
|     } | ||||
|  | ||||
|     const char *command = doc["cmd"]; | ||||
|     if (strcmp("write", command) == 0 && doc["text"].is<const char*>() && doc["x"].is<int>() && doc["y"].is<int>()) | ||||
|     const char *command = json["cmd"]; | ||||
|     if (strcmp("write", command) == 0 && json["text"].is<const char*>() && json["x"].is<int>() && json["y"].is<int>()) | ||||
|     { | ||||
|         const char *text = doc["text"]; | ||||
|         int x = doc["x"]; | ||||
|         int y = doc["y"]; | ||||
|         const char *text = json["text"]; | ||||
|         int x = json["x"]; | ||||
|         int y = json["y"]; | ||||
|  | ||||
|         this->debugWrite(x, y, text); | ||||
|         this->display->write(x, y, text); | ||||
| @@ -42,8 +42,9 @@ bool CommandHandler::parseJSON(const char *cmd) | ||||
|  | ||||
|     if (strcmp("offset", command) == 0) | ||||
|     { | ||||
|         int x = doc["x"]; | ||||
|         int y = doc["y"]; | ||||
|         int x = json["x"]; | ||||
|         int y = json["y"]; | ||||
|         debugWrite(x,y,"offset unhandled"); | ||||
|         //this->display->setOffset(x, y); | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -1,8 +1,8 @@ | ||||
| #include "DisplayProxyMAX7456.h" | ||||
|  | ||||
| DisplayProxyMAX7456::DisplayProxyMAX7456(Max7456 *osd) | ||||
| DisplayProxyMAX7456::DisplayProxyMAX7456() | ||||
| { | ||||
|     this->osd = osd; | ||||
|     this->osd = new Max7456(); | ||||
|     this->osd->init(6); | ||||
|     clear(); | ||||
|     this->osd->setBlinkParams(_8fields, _BT_3BT); | ||||
| @@ -11,7 +11,6 @@ DisplayProxyMAX7456::DisplayProxyMAX7456(Max7456 *osd) | ||||
|     onScreenDisplay(true); | ||||
| } | ||||
|  | ||||
|  | ||||
| bool DisplayProxyMAX7456::on() | ||||
| { | ||||
|     onScreenDisplay(true); | ||||
| @@ -25,8 +24,6 @@ bool DisplayProxyMAX7456::off() | ||||
|     return true; | ||||
| } | ||||
|  | ||||
|  | ||||
|  | ||||
| bool DisplayProxyMAX7456::write(int x, int y, const char *text) | ||||
| { | ||||
|     this->osd->print(text, x, y); | ||||
| @@ -39,7 +36,6 @@ bool DisplayProxyMAX7456::clear() | ||||
|     return true; | ||||
| } | ||||
|  | ||||
|  | ||||
| bool DisplayProxyMAX7456::setOffset(int x, int y) | ||||
| { | ||||
|     this->osd->setDisplayOffsets(x, y); | ||||
|   | ||||
| @@ -19,14 +19,14 @@ class DisplayProxyMAX7456 : public DisplayProxy | ||||
| { | ||||
| public: | ||||
|     /** | ||||
|      * Initalize a Max7456 Style display | ||||
|      * Initalize a MAX7456 Style display | ||||
|      * - Initialize with CS on Pin 6. | ||||
|      * - Clear the display | ||||
|      * - Initialize blinking frequency. | ||||
|      * - Disable external video | ||||
|      * - Enable OSD. | ||||
|      */ | ||||
|     explicit DisplayProxyMAX7456(Max7456 *osd); | ||||
|     explicit DisplayProxyMAX7456(); | ||||
|  | ||||
|     /** | ||||
|      * OSD on, external video left untouched. | ||||
|   | ||||
							
								
								
									
										46
									
								
								lib/README
									
									
									
									
									
								
							
							
						
						
									
										46
									
								
								lib/README
									
									
									
									
									
								
							| @@ -1,46 +0,0 @@ | ||||
|  | ||||
| This directory is intended for project specific (private) libraries. | ||||
| PlatformIO will compile them to static libraries and link into executable file. | ||||
|  | ||||
| The source code of each library should be placed in a an own separate directory | ||||
| ("lib/your_library_name/[here are source files]"). | ||||
|  | ||||
| For example, see a structure of the following two libraries `Foo` and `Bar`: | ||||
|  | ||||
| |--lib | ||||
| |  | | ||||
| |  |--Bar | ||||
| |  |  |--docs | ||||
| |  |  |--examples | ||||
| |  |  |--src | ||||
| |  |     |- Bar.c | ||||
| |  |     |- Bar.h | ||||
| |  |  |- library.json (optional, custom build options, etc) https://docs.platformio.org/page/librarymanager/config.html | ||||
| |  | | ||||
| |  |--Foo | ||||
| |  |  |- Foo.c | ||||
| |  |  |- Foo.h | ||||
| |  | | ||||
| |  |- README --> THIS FILE | ||||
| | | ||||
| |- platformio.ini | ||||
| |--src | ||||
|    |- main.c | ||||
|  | ||||
| and a contents of `src/main.c`: | ||||
| ``` | ||||
| #include <Foo.h> | ||||
| #include <Bar.h> | ||||
|  | ||||
| int main (void) | ||||
| { | ||||
|   ... | ||||
| } | ||||
|  | ||||
| ``` | ||||
|  | ||||
| PlatformIO Library Dependency Finder will find automatically dependent | ||||
| libraries scanning project source files. | ||||
|  | ||||
| More information about PlatformIO Library Dependency Finder | ||||
| - https://docs.platformio.org/page/librarymanager/ldf.html | ||||
							
								
								
									
										13
									
								
								src/main.cpp
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								src/main.cpp
									
									
									
									
									
								
							| @@ -1,13 +1,16 @@ | ||||
| /** | ||||
|  * \file main.cpp | ||||
|  * Main application entry point. | ||||
|  * Arduino Style but still a .cpp file | ||||
|  */ | ||||
|  | ||||
| #include "Arduino.h" | ||||
| #include <SPI.h> | ||||
|  | ||||
| #include "config.h" | ||||
| #include "CommandHandler.h" | ||||
| #include "DisplayProxyMAX7456.h" | ||||
| #include "max7456.h" | ||||
|  | ||||
| Max7456 osd; | ||||
| DisplayProxyMAX7456 display(&osd); | ||||
| DisplayProxyMAX7456 display; | ||||
| CommandHandler cmd_handler(&display); | ||||
|  | ||||
| /** | ||||
| @@ -25,7 +28,7 @@ void setup() | ||||
|     Serial.println("Built:    " __DATE__ ", " __TIME__); | ||||
|     Serial.println("================================================================================"); | ||||
|     Serial.println("Initialize..."); | ||||
|   SPI.begin(); | ||||
|  | ||||
|     display.setOffset(DISP_OFFSET_X, DISP_OFFSET_Y); | ||||
|  | ||||
|     display.write(0, 0, "=========================="); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user