So with suggestion from @profezzorn to create enum & switch, help from @ryryog25 to initiate enum & switch, and suggestion from @NoSloppy to use help from ChatGPT, I came up with this (with a lot of ChatGPT input and/or output):
This is my CONFIG_PROP
#ifdef CONFIG_PROP
#include "../props/multi_prop.h"
#include "../props/saber_fett263_buttons.h"
#include "../props/blaster.h"
//#include "../props/detonator.h" //detonator is commented out because it gives me even more errors.
#undef PROP_TYPE
#define PROP_TYPE MultiProp <Saber, Blaster>//, Detonator
#endif
This is my multi_prop.h
Edit: I am deleting it.
Which gives me these compile errors:
"I cropped the top part as it did not have errors there"
Compiling sketch...
"C:\\Users\\Olivier\\AppData\\Local\\Arduino15\\packages\\proffieboard\\tools\\arm-none-eabi-gcc\\9-2020-q2-update/bin/arm-none-eabi-g++" -mcpu=cortex-m4 -mthumb -c -g -Os -w -std=gnu++11 -ffunction-sections -fdata-sections -fno-threadsafe-statics -nostdlib -fno-rtti -fno-exceptions -MMD -flto -fdevirtualize-at-ltrans -D_SYSTEM_CORE_CLOCK_=80000000L -DARDUINO=10819 -DARDUINO_PROFFIEBOARD_V3 -DARDUINO_ARCH_STM32L4 -DSTM32L452xx -DPROFFIEBOARD_VERSION=3 -D__FPU_PRESENT=1 -march=armv7e-m -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -mabi=aapcs -mslow-flash-data -fsingle-precision-constant -felide-constructors -ffast-math -DUSB_VID=0x1209 -DUSB_PID=0x6668 -DUSB_DID=0xffff "-DUSB_MANUFACTURER=\"hubbe.net\"" "-DUSB_PRODUCT=\"Proffieboard\"" -DUSB_TYPE=USB_TYPE_CDC_MSC_WEBUSB -DDOSFS_SDCARD=3 -DDOSFS_SFLASH=0 "-IC:\\Users\\Olivier\\AppData\\Local\\Arduino15\\packages\\proffieboard\\hardware\\stm32l4\\3.6/system/CMSIS/Include" "-IC:\\Users\\Olivier\\AppData\\Local\\Arduino15\\packages\\proffieboard\\hardware\\stm32l4\\3.6/system/CMSIS/Device/ST/STM32L4xx/Include" "-IC:\\Users\\Olivier\\AppData\\Local\\Arduino15\\packages\\proffieboard\\hardware\\stm32l4\\3.6/system/STM32L4xx/Include" "-IC:\\Users\\Olivier\\AppData\\Local\\Arduino15\\packages\\proffieboard\\hardware\\stm32l4\\3.6\\cores\\stm32l4" "-IC:\\Users\\Olivier\\AppData\\Local\\Arduino15\\packages\\proffieboard\\hardware\\stm32l4\\3.6\\variants\\STM32L452RE-ProffieboardV3" "-IC:\\Users\\Olivier\\AppData\\Local\\Arduino15\\packages\\proffieboard\\hardware\\stm32l4\\3.6\\libraries\\Wire\\src" "C:\\Users\\Olivier\\AppData\\Local\\Temp\\arduino_build_37787\\sketch\\ProffieOS_7.14.ino.cpp" -o "C:\\Users\\Olivier\\AppData\\Local\\Temp\\arduino_build_37787\\sketch\\ProffieOS_7.14.ino.cpp.o"
In file included from C:\Users\Olivier\Desktop\Lego Manuals\LightSabers\$Oli\ProffieOS_7.14\ProffieOS_7.14.ino:625:
C:\Users\Olivier\Desktop\Lego Manuals\LightSabers\$Oli\ProffieOS_7.14\config\olicomplex1.4.8_test_multi_prop.h:344:19: error: 'MultiProp' does not name a type; did you mean 'MultiPropClass'?
344 | #define PROP_TYPE MultiProp <Saber, Blaster>//, Detonator
| ^~~~~~~~~
C:\Users\Olivier\Desktop\Lego Manuals\LightSabers\$Oli\ProffieOS_7.14\ProffieOS_7.14.ino:632:1: note: in expansion of macro 'PROP_TYPE'
632 | PROP_TYPE prop;
| ^~~~~~~~~
In file included from C:\Users\Olivier\Desktop\Lego Manuals\LightSabers\$Oli\ProffieOS_7.14\ProffieOS_7.14.ino:651:
C:\Users\Olivier\Desktop\Lego Manuals\LightSabers\$Oli\ProffieOS_7.14\buttons\latching_button.h: In member function 'void LatchingButtonTemplate<BASE>::Loop()':
C:\Users\Olivier\Desktop\Lego Manuals\LightSabers\$Oli\ProffieOS_7.14\buttons\latching_button.h:33:7: error: 'prop' was not declared in this scope
33 | prop.Event(button_, EVENT_LATCH_ON);
| ^~~~
C:\Users\Olivier\Desktop\Lego Manuals\LightSabers\$Oli\ProffieOS_7.14\buttons\latching_button.h: In member function 'bool LatchingButtonTemplate<BASE>::Parse(const char*, const char*)':
C:\Users\Olivier\Desktop\Lego Manuals\LightSabers\$Oli\ProffieOS_7.14\buttons\latching_button.h:43:9: error: 'prop' was not declared in this scope
43 | prop.Event(button_, EVENT_LATCH_ON);
| ^~~~
C:\Users\Olivier\Desktop\Lego Manuals\LightSabers\$Oli\ProffieOS_7.14\buttons\latching_button.h:45:9: error: 'prop' was not declared in this scope
45 | prop.Event(button_, EVENT_LATCH_OFF);
| ^~~~
In file included from C:\Users\Olivier\Desktop\Lego Manuals\LightSabers\$Oli\ProffieOS_7.14\buttons\button.h:4,
from C:\Users\Olivier\Desktop\Lego Manuals\LightSabers\$Oli\ProffieOS_7.14\ProffieOS_7.14.ino:652:
C:\Users\Olivier\Desktop\Lego Manuals\LightSabers\$Oli\ProffieOS_7.14\buttons\button_base.h: In member function 'bool ButtonBase::Send(uint32_t)':
C:\Users\Olivier\Desktop\Lego Manuals\LightSabers\$Oli\ProffieOS_7.14\buttons\button_base.h:51:10: error: 'prop' was not declared in this scope
51 | if (!prop.Event(button_, (EVENT)(event + (EVENT_SECOND_PRESSED - EVENT_FIRST_PRESSED) * press_count_))) {
| ^~~~
In file included from C:\Users\Olivier\Desktop\Lego Manuals\LightSabers\$Oli\ProffieOS_7.14\ProffieOS_7.14.ino:659:
C:\Users\Olivier\Desktop\Lego Manuals\LightSabers\$Oli\ProffieOS_7.14\buttons\rotary.h: In member function 'virtual void ChangePresetRotaryReceiver::Update(int)':
C:\Users\Olivier\Desktop\Lego Manuals\LightSabers\$Oli\ProffieOS_7.14\buttons\rotary.h:12:21: error: 'prop' was not declared in this scope
12 | if (delta == 1) prop.next_preset();
| ^~~~
C:\Users\Olivier\Desktop\Lego Manuals\LightSabers\$Oli\ProffieOS_7.14\buttons\rotary.h:13:22: error: 'prop' was not declared in this scope
13 | if (delta == -1) prop.previous_preset();
| ^~~~
In file included from C:\Users\Olivier\Desktop\Lego Manuals\LightSabers\$Oli\ProffieOS_7.14\ProffieOS_7.14.ino:1412:
C:\Users\Olivier\Desktop\Lego Manuals\LightSabers\$Oli\ProffieOS_7.14\display\ssd1306.h: In member function 'int WriteBulletCountOp<x, y, digits>::Controller<Width, col_t>::FillFrameBuffer(bool)':
C:\Users\Olivier\Desktop\Lego Manuals\LightSabers\$Oli\ProffieOS_7.14\display\ssd1306.h:205:12: error: 'prop' was not declared in this scope
205 | itoa(prop.GetBulletCount(), tmp+digits, 10);
| ^~~~
C:\Users\Olivier\Desktop\Lego Manuals\LightSabers\$Oli\ProffieOS_7.14\display\ssd1306.h: In member function 'void StandardDisplayController<Width, col_t>::SB_Effect2(EffectType, float)':
C:\Users\Olivier\Desktop\Lego Manuals\LightSabers\$Oli\ProffieOS_7.14\display\ssd1306.h:512:19: error: 'prop' was not declared in this scope
512 | } else if (prop.current_preset_name()) {
| ^~~~
In file included from C:\Users\Olivier\Desktop\Lego Manuals\LightSabers\$Oli\ProffieOS_7.14\ProffieOS_7.14.ino:1418:
C:\Users\Olivier\Desktop\Lego Manuals\LightSabers\$Oli\ProffieOS_7.14\motion\mpu6050.h: In member function 'virtual void MPU6050::Loop()':
C:\Users\Olivier\Desktop\Lego Manuals\LightSabers\$Oli\ProffieOS_7.14\motion\mpu6050.h:243:13: error: 'prop' was not declared in this scope
243 | prop.DoAccel(
| ^~~~
C:\Users\Olivier\Desktop\Lego Manuals\LightSabers\$Oli\ProffieOS_7.14\motion\mpu6050.h:251:13: error: 'prop' was not declared in this scope
251 | prop.DoMotion(
| ^~~~
In file included from C:\Users\Olivier\Desktop\Lego Manuals\LightSabers\$Oli\ProffieOS_7.14\ProffieOS_7.14.ino:1419:
C:\Users\Olivier\Desktop\Lego Manuals\LightSabers\$Oli\ProffieOS_7.14\motion\lsm6ds3h.h: In member function 'void LSM6DS3H::DataReceived2()':
C:\Users\Olivier\Desktop\Lego Manuals\LightSabers\$Oli\ProffieOS_7.14\motion\lsm6ds3h.h:326:5: error: 'prop' was not declared in this scope
326 | prop.DoMotion(MotionUtil::FromData(databuffer, 2000.0 / 32768.0, // 2000 dps
| ^~~~
In file included from C:\Users\Olivier\Desktop\Lego Manuals\LightSabers\$Oli\ProffieOS_7.14\ProffieOS_7.14.ino:1420:
C:\Users\Olivier\Desktop\Lego Manuals\LightSabers\$Oli\ProffieOS_7.14\motion\fxos8700.h: In member function 'virtual void FXOS8700::Loop()':
C:\Users\Olivier\Desktop\Lego Manuals\LightSabers\$Oli\ProffieOS_7.14\motion\fxos8700.h:169:6: error: 'prop' was not declared in this scope
169 | prop.DoAccel(
| ^~~~
In file included from C:\Users\Olivier\Desktop\Lego Manuals\LightSabers\$Oli\ProffieOS_7.14\ProffieOS_7.14.ino:1421:
C:\Users\Olivier\Desktop\Lego Manuals\LightSabers\$Oli\ProffieOS_7.14\motion\fxas21002.h: In member function 'virtual void FXAS21002::Loop()':
C:\Users\Olivier\Desktop\Lego Manuals\LightSabers\$Oli\ProffieOS_7.14\motion\fxas21002.h:72:6: error: 'prop' was not declared in this scope
72 | prop.DoMotion(MotionUtil::FromData(databuffer,
| ^~~~
In file included from C:\Users\Olivier\Desktop\Lego Manuals\LightSabers\$Oli\ProffieOS_7.14\ProffieOS_7.14.ino:1439:
C:\Users\Olivier\Desktop\Lego Manuals\LightSabers\$Oli\ProffieOS_7.14\common\booster.h: In member function 'bool Booster::Active()':
C:\Users\Olivier\Desktop\Lego Manuals\LightSabers\$Oli\ProffieOS_7.14\common\booster.h:20:9: error: 'prop' was not declared in this scope
20 | if (prop.NeedsPower()) return true;
| ^~~~
C:\Users\Olivier\Desktop\Lego Manuals\LightSabers\$Oli\ProffieOS_7.14\ProffieOS_7.14.ino: In function 'void setup()':
ProffieOS_7.14:1520:3: error: 'prop' was not declared in this scope
1520 | prop.FindBlade();
| ^~~~
In file included from C:\Users\Olivier\Desktop\Lego Manuals\LightSabers\$Oli\ProffieOS_7.14\ProffieOS_7.14.ino:1549:
C:\Users\Olivier\Desktop\Lego Manuals\LightSabers\$Oli\ProffieOS_7.14\common\clock_control.h: In member function 'virtual void ClockControl::Loop()':
C:\Users\Olivier\Desktop\Lego Manuals\LightSabers\$Oli\ProffieOS_7.14\common\clock_control.h:16:5: error: 'prop' was not declared in this scope
16 | || prop.NeedsPower()
| ^~~~
Using library Wire at version 1.0 in folder: C:\Users\Olivier\AppData\Local\Arduino15\packages\proffieboard\hardware\stm32l4\3.6\libraries\Wire
exit status 1
'prop' was not declared in this scope
I do not understand what this means. And the answer from ChatGPT is as confusing (I feel like I am walking in a circle):
//The error message you're seeing in your Arduino IDE is related to the C++ code you're trying to compile for the Proffieboard. It indicates that there is an issue with the variable or object named prop, which is not recognized by the compiler within the scope where it is being used. Let's break down the main points:
//Key Issues:
//1. Undefined Type MultiProp:
/*- The error suggests that */MultiProp/* is not defined or not included correctly. The compiler is suggesting */MultiPropClass/* instead, which may be the correct type or a similar one.
- The specific error is:*/
error: 'MultiProp' does not name a type; did you mean 'MultiPropClass'?
/*- This might be due to missing includes, or a typo in the type name.
/*2. Undeclared */prop/* Variable:
/*- The error message indicates that the variable */prop/* is not declared in the scope where it's being used.
/*- The specific error is:*/
'prop' was not declared in this scope
/*- This error appears in multiple places throughout your code, indicating that the */prop/* variable is either missing its declaration or not properly instantiated before being used.
Potential Causes:
- Incorrect or Missing Includes: The necessary header files that define */MultiProp/* or the */prop/* variable might not be included or may be incorrect. Ensure all required headers are included at the beginning of your */.ino/* or header files.
- Typo or Misconfiguration in the Config File: The line */#define PROP_TYPE MultiProp <Saber, Blaster>/*, Detonator could have a typo or be incorrectly configured. Ensure that */MultiProp/* is correctly defined or referenced.
- Misplaced Variable Declaration: The */prop/* variable might not be declared globally or within the correct scope. Ensure that */prop/* is declared before it is used in the various functions and classes.
How to Fix:
1. Check for Correct Includes:
- Ensure that all the necessary header files are included at the top of your code where */MultiProp/* and */prop/* should be defined.
2. Correct the Type Name:
- Double-check the type name */MultiProp/*. If */MultiPropClass/* is the correct type, modify the */#define/* statement accordingly:
*/#define PROP_TYPE MultiPropClass<Saber, Blaster>/*, Detonator
3. Ensure */prop/* is Declared:
- Make sure that */prop/* is declared and initialized properly before it is used in your code. If it's supposed to be an instance of */PROP_TYPE/*, ensure that it is declared like this:
*/PROP_TYPE prop;/*
4. Check Config and Class Files:
Ensure that the configuration in */olicomplex1.4.8_test_multi_prop.h/* and related files correctly defines the types and variables you're using.
By addressing these points, you should be able to resolve the compilation errors. If the problem persists, consider reviewing the code around where */prop/* is used to ensure it's in the correct context and that the related libraries are correctly included and configured.
What am I missing now ? Can you help me ?
Thank you for spending your valuable time just reading this.
Cheers.