From 61c17b2c80ec7fbc06e8ad9ab3b16156a2edf0b0 Mon Sep 17 00:00:00 2001 From: Ancyker Date: Mon, 27 Jan 2025 13:41:57 -0500 Subject: [PATCH] Add more sanity checks to OSCR.h --- Cart_Reader/OSCR.h | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/Cart_Reader/OSCR.h b/Cart_Reader/OSCR.h index b42b247..30f6a01 100644 --- a/Cart_Reader/OSCR.h +++ b/Cart_Reader/OSCR.h @@ -15,10 +15,16 @@ #include "Config.h" /*==== SANITY CHECKS ==============================================*/ +// Error if no hardware version is enabled # if !(defined(HW1) || defined(HW2) || defined(HW3) || defined(HW4) || defined(HW5) || defined(SERIAL_MONITOR)) # error !!! PLEASE CHOOSE HARDWARE VERSION IN CONFIG.H !!! # endif +// Error if more than one hardware version is enabled +# if (defined(HW1) + defined(HW2) + defined(HW3) + defined(HW4) + defined(HW5) + defined(SERIAL_MONITOR)) > 1 +# error !!! PLEASE CHOOSE ONLY ONE HARDWARE VERSION IN CONFIG.H !!! +# endif + // Let user know unsafe configs are allowed # if defined(ALLOW_UNSAFE_CONFIG) // Error if defined during GitHub CI tests. This should not happen unless someone accidentally committed their Config.h @@ -67,6 +73,26 @@ # endif /* ENABLE_VSELECT */ +// ENABLE_SERIAL && ENABLE_3V3FIX are incompatible options +# if defined(ENABLE_SERIAL) && defined(ENABLE_3V3FIX) +# if defined(ALLOW_UNSAFE_CONFIG) +# warning Using a configuration with ENABLE_SERIAL and ENABLE_3V3FIX is incompatible. +# else /* !defined(ALLOW_UNSAFE_CONFIG) */ +# error Using a configuration with ENABLE_SERIAL and ENABLE_3V3FIX is incompatible. \ + If you are a developer trying to make this work you can define ALLOW_UNSAFE_CONFIG in Config.h to allow compiling. +# endif /* ALLOW_UNSAFE_CONFIG */ +# endif /* ENABLE_SERIAL && ENABLE_3V3FIX */ + +// ENABLE_SERIAL && ENABLE_UPDATER are incompatible options +# if defined(ENABLE_SERIAL) && defined(ENABLE_UPDATER) +# if defined(ALLOW_UNSAFE_CONFIG) +# warning Using a configuration with ENABLE_SERIAL and ENABLE_UPDATER is incompatible. +# else /* !defined(ALLOW_UNSAFE_CONFIG) */ +# error Using a configuration with ENABLE_SERIAL and ENABLE_UPDATER is incompatible. \ + If you are a developer trying to make this work you can define ALLOW_UNSAFE_CONFIG in Config.h to allow compiling. +# endif /* ALLOW_UNSAFE_CONFIG */ +# endif /* ENABLE_SERIAL && ENABLE_UPDATER */ + /*==== CONSTANTS ==================================================*/ /** * String Constants