Update BACnet protocol revision and enhance lighting output handling (#1211)

* Changed apps to build at protocol-revision 28 to be able to use the lighting output special values by default.

* Fixed blinkt app server name and removed the device.c module which was no longer needed.

* Added debug prints for lighting-output object for present-value and lighting-command property values which may be out-of-range.
This commit is contained in:
Steve Karg
2026-01-27 10:45:28 -06:00
committed by GitHub
parent 2b59aa1a99
commit b6d895ccf0
7 changed files with 83 additions and 2241 deletions
+6
View File
@@ -32,6 +32,8 @@ The git repositories are hosted at the following sites:
### Added
* Added debug prints for lighting output properties to assist in identifying
out-of-range values. (#1211)
* Added API to get the RGB pixel and brightness values from the blinkt
interface. Added API to the color-RGB library to convert from ASCII
CSS color name to X,Y and brightness. Added a default color name command
@@ -95,6 +97,8 @@ The git repositories are hosted at the following sites:
### Changed
* Changed the default BACnet protocol revision to 28 to enable usage of
special lighting output values. (#1211)
* Changed bacnet_strtof and bacnet_strtold functions to use strtod to
improve compatibility with C89 standards while ensuring proper type
casting and range checking. (#1207)
@@ -113,6 +117,8 @@ The git repositories are hosted at the following sites:
### Fixed
* Fixed the server name in the blinkt app and removed the unnecessary
device.c module. (#1211)
* Fixed Channel object for Color object present-value which does not
use coercion. (#1210)
* Fixed lighting output object lighting-command last-on-value to only
+1 -1
View File
@@ -100,7 +100,7 @@ option(
"build with uci"
OFF)
set(BACNET_PROTOCOL_REVISION 24)
set(BACNET_PROTOCOL_REVISION 28)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
+1 -1
View File
@@ -233,7 +233,7 @@ BACNET_DEFINES += -DPRINT_ENABLED=1
BACNET_DEFINES += -DBACAPP_ALL
BACNET_DEFINES += -DBACNET_TIME_MASTER
BACNET_DEFINES += -DBACNET_PROPERTY_LISTS=1
BACNET_DEFINES += -DBACNET_PROTOCOL_REVISION=24
BACNET_DEFINES += -DBACNET_PROTOCOL_REVISION=28
# put all the flags together
INCLUDES = -I$(BACNET_SRC_DIR) -I$(BACNET_PORT_DIR) -I$(BACNET_POSIX_DIR)
-2222
View File
File diff suppressed because it is too large Load Diff
+19 -16
View File
@@ -159,14 +159,15 @@ static void BACnet_Object_Table_Init(void *context)
{
unsigned i = 0;
uint8_t led_max;
uint32_t object_instance = 0, member_element = 0, device_instance = 0;
uint32_t object_instance = 0, member_element = 0;
BACNET_COLOR_COMMAND command = { 0 };
BACNET_OBJECT_ID object_id = { 0 };
BACNET_DEVICE_OBJECT_PROPERTY_REFERENCE member = { 0 };
BACNET_TIMER_STATE_CHANGE_VALUE timer_transition = { 0 };
(void)context;
device_instance = Device_Object_Instance_Number();
Device_Set_Object_Instance_Number(Device_ID);
Device_Object_Name_ANSI_Init(Device_Name);
/* create the objects */
Channel_Create(Light_Channel_Instance);
Channel_Name_Set(Light_Channel_Instance, "Lights");
@@ -209,7 +210,7 @@ static void BACnet_Object_Table_Init(void *context)
member.propertyIdentifier = PROP_PRESENT_VALUE;
member.arrayIndex = BACNET_ARRAY_ALL;
member.deviceIdentifier.type = OBJECT_DEVICE;
member.deviceIdentifier.instance = device_instance;
member.deviceIdentifier.instance = Device_ID;
Timer_Reference_List_Member_Element_Add(Vacancy_Timer_Instance, &member);
Timer_Priority_For_Writing_Set(Vacancy_Timer_Instance, Default_Priority);
/* configure outputs and bindings */
@@ -234,7 +235,7 @@ static void BACnet_Object_Table_Init(void *context)
member.propertyIdentifier = PROP_PRESENT_VALUE;
member.arrayIndex = BACNET_ARRAY_ALL;
member.deviceIdentifier.type = OBJECT_DEVICE;
member.deviceIdentifier.instance = device_instance;
member.deviceIdentifier.instance = Device_ID;
Channel_Reference_List_Member_Element_Set(
Color_Channel_Instance, member_element, &member);
@@ -252,7 +253,7 @@ static void BACnet_Object_Table_Init(void *context)
member.propertyIdentifier = PROP_PRESENT_VALUE;
member.arrayIndex = BACNET_ARRAY_ALL;
member.deviceIdentifier.type = OBJECT_DEVICE;
member.deviceIdentifier.instance = device_instance;
member.deviceIdentifier.instance = Device_ID;
Channel_Reference_List_Member_Element_Set(
CCT_Channel_Instance, member_element, &member);
@@ -270,7 +271,7 @@ static void BACnet_Object_Table_Init(void *context)
member.propertyIdentifier = PROP_PRESENT_VALUE;
member.arrayIndex = BACNET_ARRAY_ALL;
member.deviceIdentifier.type = OBJECT_DEVICE;
member.deviceIdentifier.instance = device_instance;
member.deviceIdentifier.instance = Device_ID;
Channel_Reference_List_Member_Element_Set(
Light_Channel_Instance, member_element, &member);
}
@@ -451,18 +452,11 @@ int main(int argc, char *argv[])
}
}
}
Device_Set_Object_Instance_Number(Device_ID);
Device_Object_Name_ANSI_Init(Device_Name);
printf(
"BACnet Raspberry Pi Blinkt! Demo %s\n"
"BACnet Stack Version %s\n"
"BACnet Device ID: %u\n"
"Max APDU: %d\n",
Device_Application_Software_Version(), Device_Firmware_Revision(),
Device_Object_Instance_Number(), MAX_APDU);
/* hardware init */
blinkt_init();
atexit(blinkt_cleanup);
debug_printf_stdout("Blinkt! initialized\n");
/* application init */
bacnet_basic_init_callback_set(BACnet_Object_Table_Init, NULL);
bacnet_basic_task_callback_set(BACnet_Object_Task, NULL);
bacnet_basic_init();
@@ -471,7 +465,16 @@ int main(int argc, char *argv[])
dlenv_init();
atexit(datalink_cleanup);
}
debug_printf_stdout("Server: BACnet initialized\n");
debug_printf_stdout("BACnet initialized\n");
/* application info */
printf(
"BACnet Raspberry Pi Blinkt! Demo %s\n"
"BACnet Stack Version %s\n"
"BACnet Device ID: %u\n"
"Max APDU: %d\n",
Device_Application_Software_Version(), Device_Firmware_Revision(),
Device_Object_Instance_Number(), MAX_APDU);
/* operation */
BACnet_Object_Value_Init(color_name);
for (;;) {
bacnet_basic_task();
+1 -1
View File
@@ -28,7 +28,7 @@
/* Although this stack can implement any revision,
* sometimes a specific revision is desired */
#ifndef BACNET_PROTOCOL_REVISION
#define BACNET_PROTOCOL_REVISION 24
#define BACNET_PROTOCOL_REVISION 28
#endif
/* there are a few dependencies on the BACnet Protocol-Revision */
+55
View File
@@ -916,6 +916,9 @@ bool Lighting_Output_Present_Value_Set(
if (is_float_equal(value, BACNET_LIGHTING_SPECIAL_VALUE_WARN)) {
/* Provides the same functionality as the
WARN lighting command. */
debug_printf(
"LO[%u]: Present-Value@%u Warn\n", object_instance,
priority);
Lighting_Command_Warn(pObject, priority);
status = true;
} else if (is_float_equal(
@@ -923,12 +926,18 @@ bool Lighting_Output_Present_Value_Set(
BACNET_LIGHTING_SPECIAL_VALUE_WARN_RELINQUISH)) {
/* Provides the same functionality as the
WARN_RELINQUISH lighting command. */
debug_printf(
"LO[%u]: Present-Value@%u Warn-Relinquish\n",
object_instance, priority);
Lighting_Command_Warn_Relinquish(pObject, priority);
status = true;
} else if (is_float_equal(
value, BACNET_LIGHTING_SPECIAL_VALUE_WARN_OFF)) {
/* Provides the same functionality as the
WARN_OFF lighting command. */
debug_printf(
"LO[%u]: Present-Value@%u Warn-Off\n", object_instance,
priority);
Lighting_Command_Warn_Off(pObject, priority);
status = true;
#if (BACNET_PROTOCOL_REVISION >= 28)
@@ -936,12 +945,18 @@ bool Lighting_Output_Present_Value_Set(
value, BACNET_LIGHTING_SPECIAL_VALUE_RESTORE_ON)) {
/* Provides the same functionality as the
RESTORE_ON lighting command. */
debug_printf(
"LO[%u]: Present-Value@%u Restore-On\n", object_instance,
priority);
Lighting_Command_Restore_On(pObject, priority);
status = true;
} else if (is_float_equal(
value, BACNET_LIGHTING_SPECIAL_VALUE_DEFAULT_ON)) {
/* Provides the same functionality as the
DEFAULT_ON lighting command. */
debug_printf(
"LO[%u]: Present-Value@%u Default-On\n", object_instance,
priority);
Lighting_Command_Default_On(pObject, priority);
status = true;
} else if (is_float_equal(
@@ -949,6 +964,9 @@ bool Lighting_Output_Present_Value_Set(
BACNET_LIGHTING_SPECIAL_VALUE_TOGGLE_RESTORE)) {
/* Provides the same functionality as the
TOGGLE_RESTORE lighting command. */
debug_printf(
"LO[%u]: Present-Value@%u Toggle-Restore\n",
object_instance, priority);
Lighting_Command_Toggle_Restore(pObject, priority);
status = true;
} else if (is_float_equal(
@@ -956,14 +974,24 @@ bool Lighting_Output_Present_Value_Set(
BACNET_LIGHTING_SPECIAL_VALUE_TOGGLE_DEFAULT)) {
/* Provides the same functionality as the
TOGGLE_DEFAULT lighting command. */
debug_printf(
"LO[%u]: Present-Value@%u Toggle-Default\n",
object_instance, priority);
Lighting_Command_Toggle_Default(pObject, priority);
status = true;
#endif
} else if (
isgreaterequal(value, 0.0) && islessequal(value, 100.0)) {
debug_printf(
"LO[%u]: Present-Value@%u %0.2f\n", object_instance,
priority, value);
Present_Value_Set(pObject, value, priority);
Lighting_Command_Transition_Default(pObject, priority, value);
status = true;
} else {
debug_printf(
"LO[%u]: Present-Value@%u %0.2f out-of-range\n",
object_instance, priority, value);
}
}
}
@@ -1487,44 +1515,71 @@ bool Lighting_Output_Lighting_Command_Set(
case BACNET_LIGHTS_WARN:
/* Provides the same functionality as the
WARN lighting command. */
debug_printf(
"LO[%u]: Lighting-Command@%u Warn\n", object_instance,
priority);
Lighting_Command_Warn(pObject, priority);
status = true;
break;
case BACNET_LIGHTS_WARN_OFF:
/* Provides the same functionality as the
WARN_OFF lighting command. */
debug_printf(
"LO[%u]: Lighting-Command@%u Warn-Off\n", object_instance,
priority);
Lighting_Command_Warn_Off(pObject, priority);
status = true;
break;
case BACNET_LIGHTS_WARN_RELINQUISH:
/* Provides the same functionality as the
WARN_RELINQUISH lighting command. */
debug_printf(
"LO[%u]: Lighting-Command@%u Warn-Relinquish\n",
object_instance, priority);
Lighting_Command_Warn_Relinquish(pObject, priority);
status = true;
break;
case BACNET_LIGHTS_STOP:
debug_printf(
"LO[%u]: Lighting-Command@%u Stop\n", object_instance,
priority);
Lighting_Command_Stop(pObject, priority);
status = true;
break;
#if (BACNET_PROTOCOL_REVISION >= 28)
case BACNET_LIGHTS_RESTORE_ON:
debug_printf(
"LO[%u]: Lighting-Command@%u Restore-On\n", object_instance,
priority);
Lighting_Command_Restore_On(pObject, priority);
status = true;
break;
case BACNET_LIGHTS_DEFAULT_ON:
debug_printf(
"LO[%u]: Lighting-Command@%u Default-On\n", object_instance,
priority);
Lighting_Command_Default_On(pObject, priority);
status = true;
break;
case BACNET_LIGHTS_TOGGLE_RESTORE:
debug_printf(
"LO[%u]: Lighting-Command@%u Toggle-Restore\n",
object_instance, priority);
Lighting_Command_Toggle_Restore(pObject, priority);
status = true;
break;
case BACNET_LIGHTS_TOGGLE_DEFAULT:
debug_printf(
"LO[%u]: Lighting-Command@%u Toggle-Default\n",
object_instance, priority);
Lighting_Command_Toggle_Default(pObject, priority);
status = true;
break;
#endif
default:
debug_printf(
"LO[%u]: Lighting-Command@%u %u out-of-range\n",
object_instance, priority, value->operation);
break;
}
if (status) {