From 0d98b257fc691986ecaa9d9f75d9103f427ddb0e Mon Sep 17 00:00:00 2001 From: Ake Hedman Date: Fri, 17 May 2024 17:31:29 +0200 Subject: [PATCH] Fixed some errors --- src/vscp/common/vscp.h | 28 +++++++++++++++++----------- src/vscp/common/vscphelper.h | 13 +++++++++++++ 2 files changed, 30 insertions(+), 11 deletions(-) diff --git a/src/vscp/common/vscp.h b/src/vscp/common/vscp.h index fdec664e9..3de55b733 100644 --- a/src/vscp/common/vscp.h +++ b/src/vscp/common/vscp.h @@ -292,14 +292,14 @@ typedef VSCPChannelInfo *PVSCPCHANNELINFO; /* Interface types */ #define VSCP_INTERFACE_TYPE_UNKNOWN 0 -#define VSCP_INTERFACE_TYPE_INTERNAL 1 // Internal to daemon/server -#define VSCP_INTERFACE_TYPE_LEVEL1DRV 2 // Level I driver -#define VSCP_INTERFACE_TYPE_LEVEL2DRV 3 // Level II driver -#define VSCP_INTERFACE_TYPE_CLIENT_TCPIP 4 // TCP/IP client -#define VSCP_INTERFACE_TYPE_CLIENT_UDP 5 // UDP client -#define VSCP_INTERFACE_TYPE_CLIENT_WEB 6 // Web server -#define VSCP_INTERFACE_TYPE_CLIENT_WEBSOCK 7 // Websocket client -#define VSCP_INTERFACE_TYPE_CLIENT_REST 8 // REST client +#define VSCP_INTERFACE_TYPE_INTERNAL 1 // Internal to daemon/server +#define VSCP_INTERFACE_TYPE_LEVEL1DRV 2 // Level I driver +#define VSCP_INTERFACE_TYPE_LEVEL2DRV 3 // Level II driver +#define VSCP_INTERFACE_TYPE_CLIENT_TCPIP 4 // TCP/IP client +#define VSCP_INTERFACE_TYPE_CLIENT_UDP 5 // UDP client +#define VSCP_INTERFACE_TYPE_CLIENT_WEB 6 // Web server +#define VSCP_INTERFACE_TYPE_CLIENT_WEBSOCK 7 // Websocket client +#define VSCP_INTERFACE_TYPE_CLIENT_REST 8 // REST client /* VSCP Encryption types */ #define VSCP_ENCRYPTION_NONE 0 @@ -479,11 +479,16 @@ struct vscpMyNode { /* * * * Standard VSCP registers * * * */ /* Register defines above 0x7f (Level I) / 0xffffff7f (Level II) */ +#define VSCP_STD_REGISTER_START 0x80 + +// Alarm status (Read only) #define VSCP_STD_REGISTER_ALARM_STATUS 0x80 #define VSCP_STD_REGISTER_MAJOR_VERSION 0x81 #define VSCP_STD_REGISTER_MINOR_VERSION 0x82 -#define VSCP_STD_REGISTER_SUB_VERSION 0x83 + +// Counts errors +#define VSCP_STD_REGISTER_ERROR_COUNTER 0x83 /* 0x84 - 0x88 - User id space */ #define VSCP_STD_REGISTER_USER_ID 0x84 @@ -506,10 +511,11 @@ struct vscpMyNode { #define VSCP_STD_REGISTER_FIRMWARE_MAJOR 0x94 #define VSCP_STD_REGISTER_FIRMWARE_MINOR 0x95 #define VSCP_STD_REGISTER_FIRMWARE_SUBMINOR 0x96 +#define VSCP_STD_REGISTER_FIRMWARE_RELEASE 0x96 #define VSCP_STD_REGISTER_BOOT_LOADER 0x97 -#define VSCP_STD_REGISTER_BUFFER_SIZE 0x98 -#define VSCP_STD_REGISTER_PAGES_COUNT 0x99 +#define VSCP_STD_REGISTER_BUFFER_SIZE 0x98 // Deprecated +#define VSCP_STD_REGISTER_PAGES_COUNT 0x99 // Deprecated /* Unsigned 32-bit integer for family code */ #define VSCP_STD_REGISTER_FAMILY_CODE 0x9A diff --git a/src/vscp/common/vscphelper.h b/src/vscp/common/vscphelper.h index 5f736c85a..5aa306a35 100644 --- a/src/vscp/common/vscphelper.h +++ b/src/vscp/common/vscphelper.h @@ -140,6 +140,19 @@ (((val) >> 24) & 0x0000000000FF0000) | (((val) >> 8) & 0x00000000FF000000) | (((val) << 8) & 0x000000FF00000000) | \ (((val) << 24) & 0x0000FF0000000000) | (((val) << 40) & 0x00FF000000000000) | (((val) << 56) & 0xFF00000000000000)) +/*! + * @name Min/max macros + * @{ + */ +#if !defined(MIN) +#define MIN(a, b) (((a) < (b)) ? (a) : (b)) +#endif + +#if !defined(MAX) +#define MAX(a, b) (((a) > (b)) ? (a) : (b)) +#endif +/* @} */ + // For platform independet non-case dependent string compare #ifdef _MSC_VER // not #if defined(_WIN32) || defined(_WIN64) because we have strncasecmp in mingw