Merged revision(s) 2731 from branches/releases/bacnet-stack-0-8-0:
fixed BDK MAC to Device ID initialization ........ Merged revision(s) 2732 from branches/releases/bacnet-stack-0-8-0: made function local ........
This commit is contained in:
@@ -85,10 +85,24 @@ static bool seeprom_version_test(
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void device_id_init(uint8_t mac)
|
||||||
|
{
|
||||||
|
uint32_t device_id = 0;
|
||||||
|
|
||||||
|
/* Get the device ID from the eeprom */
|
||||||
|
eeprom_bytes_read(NV_EEPROM_DEVICE_0, (uint8_t *) & device_id,
|
||||||
|
sizeof(device_id));
|
||||||
|
if (device_id < BACNET_MAX_INSTANCE) {
|
||||||
|
Device_Set_Object_Instance_Number(device_id);
|
||||||
|
} else {
|
||||||
|
/* use the DIP switch address as the Device ID if unconfigured */
|
||||||
|
Device_Set_Object_Instance_Number(MSTP_MAC_Address);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void bacnet_init(
|
void bacnet_init(
|
||||||
void)
|
void)
|
||||||
{
|
{
|
||||||
uint32_t device_id = 0;
|
|
||||||
uint8_t max_master = 0;
|
uint8_t max_master = 0;
|
||||||
|
|
||||||
MSTP_MAC_Address = input_address();
|
MSTP_MAC_Address = input_address();
|
||||||
@@ -105,15 +119,7 @@ void bacnet_init(
|
|||||||
}
|
}
|
||||||
/* initialize objects */
|
/* initialize objects */
|
||||||
Device_Init(NULL);
|
Device_Init(NULL);
|
||||||
/* Get the device ID from the eeprom */
|
device_id_init(MSTP_MAC_Address);
|
||||||
eeprom_bytes_read(NV_EEPROM_DEVICE_0, (uint8_t *) & device_id,
|
|
||||||
sizeof(device_id));
|
|
||||||
if (device_id < BACNET_MAX_INSTANCE) {
|
|
||||||
Device_Set_Object_Instance_Number(device_id);
|
|
||||||
} else {
|
|
||||||
/* use the DIP switch address as the Device ID if unconfigured */
|
|
||||||
Device_Set_Object_Instance_Number(MSTP_MAC_Address);
|
|
||||||
}
|
|
||||||
/* set up our confirmed service unrecognized service handler - required! */
|
/* set up our confirmed service unrecognized service handler - required! */
|
||||||
apdu_set_unrecognized_service_handler_handler
|
apdu_set_unrecognized_service_handler_handler
|
||||||
(handler_unrecognized_service);
|
(handler_unrecognized_service);
|
||||||
@@ -158,6 +164,7 @@ void bacnet_task(
|
|||||||
/* address changed! */
|
/* address changed! */
|
||||||
MSTP_MAC_Address = mstp_mac_address;
|
MSTP_MAC_Address = mstp_mac_address;
|
||||||
dlmstp_set_mac_address(MSTP_MAC_Address);
|
dlmstp_set_mac_address(MSTP_MAC_Address);
|
||||||
|
device_id_init(MSTP_MAC_Address);
|
||||||
Send_I_Am(&Handler_Transmit_Buffer[0]);
|
Send_I_Am(&Handler_Transmit_Buffer[0]);
|
||||||
}
|
}
|
||||||
/* handle the inputs */
|
/* handle the inputs */
|
||||||
|
|||||||
Reference in New Issue
Block a user