mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-25 21:13:33 +08:00
Add UAVCAN_NO_GLOBAL_DATA_TYPE_REGISTRY flag to allow the global data type registry to be disabled
This commit is contained in:
@@ -100,6 +100,13 @@
|
|||||||
# define UAVCAN_TINY 0
|
# define UAVCAN_TINY 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Disable the global data type registry, which can save some space on embedded systems.
|
||||||
|
*/
|
||||||
|
#ifndef UAVCAN_NO_GLOBAL_DATA_TYPE_REGISTRY
|
||||||
|
# define UAVCAN_NO_GLOBAL_DATA_TYPE_REGISTRY 1
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* toString() methods will be disabled by default, unless the library is built for a general-purpose target like Linux.
|
* toString() methods will be disabled by default, unless the library is built for a general-purpose target like Linux.
|
||||||
* It is not recommended to enable toString() on embedded targets as code size will explode.
|
* It is not recommended to enable toString() on embedded targets as code size will explode.
|
||||||
|
|||||||
@@ -187,6 +187,7 @@ struct UAVCAN_EXPORT DefaultDataTypeRegistrator
|
|||||||
{
|
{
|
||||||
DefaultDataTypeRegistrator()
|
DefaultDataTypeRegistrator()
|
||||||
{
|
{
|
||||||
|
#if !UAVCAN_NO_GLOBAL_DATA_TYPE_REGISTRY
|
||||||
const GlobalDataTypeRegistry::RegistrationResult res =
|
const GlobalDataTypeRegistry::RegistrationResult res =
|
||||||
GlobalDataTypeRegistry::instance().registerDataType<Type>(Type::DefaultDataTypeID);
|
GlobalDataTypeRegistry::instance().registerDataType<Type>(Type::DefaultDataTypeID);
|
||||||
|
|
||||||
@@ -194,6 +195,7 @@ struct UAVCAN_EXPORT DefaultDataTypeRegistrator
|
|||||||
{
|
{
|
||||||
handleFatalError("Type reg failed");
|
handleFatalError("Type reg failed");
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user