From 0b316de60295115a0aee3bacb36089108608b2ac Mon Sep 17 00:00:00 2001 From: Gregg Date: Sat, 26 Dec 2020 16:46:36 -0600 Subject: [PATCH] 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 --- src/Settings.h | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/Settings.h b/src/Settings.h index 2f61049..8df7684 100644 --- a/src/Settings.h +++ b/src/Settings.h @@ -32,8 +32,24 @@ ////////////////////////////////////////////////////// // 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 //