Added REQUIRED Macro

User can specifiy a REQUIRED minimum version on the HomeSpan Library for the sketch to compile.  If the library version is older, the pre-processor will halt the compilation with a #error output
This commit is contained in:
Gregg 2020-12-26 16:46:36 -06:00
parent 3af65a5774
commit 0b316de602
1 changed files with 17 additions and 1 deletions

View File

@ -32,8 +32,24 @@
////////////////////////////////////////////////////// //////////////////////////////////////////////////////
// HomeSpan Version // // HomeSpan Version //
#define HOMESPAN_VERSION "1.1.1" #define HS_MAJOR 1
#define HS_MINOR 1
#define HS_PATCH 1
#define STRINGIFY(x) _STR(x)
#define _STR(x) #x
#define HOMESPAN_VERSION STRINGIFY(HS_MAJOR) "." STRINGIFY(HS_MINOR) "." STRINGIFY(HS_PATCH)
#define VERSION(major,minor,patch) major*10000+minor*100+patch
#ifndef REQUIRED
#define REQUIRED 0
#endif
#if (REQUIRED>VERSION(HS_MAJOR,HS_MINOR,HS_PATCH))
#error THIS SKETCH REQUIRES A LATER VERISON OF THE HOMESPAN LIBRARY
#endif
////////////////////////////////////////////////////// //////////////////////////////////////////////////////
// DEFAULT SETTINGS // // DEFAULT SETTINGS //