From 50160cc0b4261b3467fc547fa3abc4f59754bf38 Mon Sep 17 00:00:00 2001 From: Jens True Date: Wed, 10 Nov 2021 10:19:03 +0000 Subject: [PATCH] Fix warnings --- .drone.yml | 2 +- Doxyfile | 2 +- include/config.h | 36 +++++++++++++++++++------- lib/DisplayProxy/DisplayProxyMAX7456.h | 4 +-- src/main.cpp | 16 ++++++++++++ 5 files changed, 47 insertions(+), 13 deletions(-) diff --git a/.drone.yml b/.drone.yml index 98b7b01..0dc5e33 100644 --- a/.drone.yml +++ b/.drone.yml @@ -7,7 +7,7 @@ steps: commands: - pip install platformio - pio run - - pio check --skip-packages > StaticCodeAnalysisReport.txt + - pio check --skip-packages --fail-on-defect medium > StaticCodeAnalysisReport.txt - name: docs image: corentinaltepe/doxygen commands: diff --git a/Doxyfile b/Doxyfile index 6221ab7..155587a 100644 --- a/Doxyfile +++ b/Doxyfile @@ -1,6 +1,6 @@ PROJECT_NAME = "MinimOSD-JSON" OUTPUT_DIRECTORY = "docs/" -INPUT = "README.md" "src" "lib" +INPUT = "README.md" "src" "lib" "include" RECURSIVE = YES WARNINGS = YES GENERATE_LATEX = NO diff --git a/include/config.h b/include/config.h index 3989213..175ce0a 100644 --- a/include/config.h +++ b/include/config.h @@ -1,20 +1,38 @@ +/** + * @file config.h + * @author Jens True (jens.chr.true@gmail.com) + * @brief Global configuration + * @version 0.1 + * @date 2021-11-10 + * + * @copyright Copyright (c) 2021 + * + */ #ifndef CONFIG_H #define CONFIG_H +/** + * Helper for joining strings + */ #define STR_HELPER(x) #x +/** + * Stringify macro defines + */ #define STR(x) STR_HELPER(x) -#define PROJECT_NAME "MinimOSD-JSON" -#define VERSION_MAJOR 0 -#define VERSION_MINOR 1 -#define VERSION_BUILD 1 + +#define PROJECT_NAME "MinimOSD-JSON" /**< Project name */ +#define VERSION_MAJOR 0 /**< Major version number */ +#define VERSION_MINOR 1 /**< Minor version number */ +#define VERSION_BUILD 1 /**< Build number */ +/** + * Semver style version number + */ #define VERSION_STRING STR(VERSION_MAJOR) "." STR(VERSION_MINOR) "." STR(VERSION_BUILD) -#define VERSION_DATE __DATE__ - -#define BAUDRATE 115200 -#define DISP_OFFSET_X 49 -#define DISP_OFFSET_Y 27 +#define BAUDRATE 115200 /**< Serial baudrate */ +#define DISP_OFFSET_X 49 /**< Display offset along the X-axis. Varies from display to display. */ +#define DISP_OFFSET_Y 27 /**< Display offset along the Y-axis. Varies from display to display. */ #endif /* CONFIG_H */ diff --git a/lib/DisplayProxy/DisplayProxyMAX7456.h b/lib/DisplayProxy/DisplayProxyMAX7456.h index 44ca5ec..a15497c 100644 --- a/lib/DisplayProxy/DisplayProxyMAX7456.h +++ b/lib/DisplayProxy/DisplayProxyMAX7456.h @@ -41,11 +41,11 @@ public: /** * OSD on, external video left untouched. */ - bool on(); + bool on() override; /** * OSD off, external video off. */ - bool off(); + bool off() override; /** * Depending on the font loaded into the Max7456 the output might not be ASCII compatible. */ diff --git a/src/main.cpp b/src/main.cpp index 0ed27a9..9b1c55b 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -67,4 +67,20 @@ void loop() String input = Serial.readStringUntil('\n'); cmd_handler.parseJSON(input.c_str()); } +} + +/** + * @brief Wrapper around arduino setup/loop functions + * + * This mitigates static code analysis warnings. + * + * @return int + */ +int main() +{ + setup(); + while(1) + { + loop(); + } } \ No newline at end of file