Closed JuPrgn closed 3 years ago
It seems, MPLAB really has a problem. It is strange. I just don't like complicate, if only MPLAB compiler has problems. I would make a hack in CO_driver.h for MPLAB and make a comment there. For example, define CO_VERSION_MAJOR as 1. It is not used anywhere else than in CO_OD.c, anyway.
If /301 is added to compiler include path this is fine :
#include "CO_driver.h"
#if CO_VERSION_MAJOR < 2
#include "CO_OD.h"
#include "CO_SDO.h"
#elif CO_VERSION_MAJOR < 4
#include "CO_OD.h"
#include "301/CO_SDOserver.h"
#else
#error This Object dictionary is not compatible with CANopenNode v4.0 and up!
#endif
Of course ... my mistake CO_VERSION_MAJOR is defined in CO_driver.h, but #if is one line above the #include.
I think, we can't avoid using special compiler option or manual editing CO_OD.c.
I prefer second solution. However, this has to be used for all tools, not just MPLAB. libedssharo is then Ok as it is. If we use first solutuion, we have to change also all other include directives to make things clean.
I have an issue with
CO_VERSION_MAJOR
this is defined inCO_driver.h
and also required to includeCO_driver.h
:MPLAB X IDE run the first part
< 2
even ifCO_VERSION_MAJOR
is equal to 2.Should we find another way to include
CO_driver.h
/301/CO_driver.h
here ?