Corrected BACnet name in BDK port to clear end of string when new string is smaller than old string.
This commit is contained in:
@@ -163,6 +163,8 @@ static bool bacnet_name_save(
|
|||||||
char *str,
|
char *str,
|
||||||
uint8_t length)
|
uint8_t length)
|
||||||
{
|
{
|
||||||
|
uint8_t buffer[NV_EEPROM_NAME_SIZE] = {0};
|
||||||
|
uint8_t i = 0;
|
||||||
|
|
||||||
if (bacnet_name_isvalid(encoding, length, str)) {
|
if (bacnet_name_isvalid(encoding, length, str)) {
|
||||||
eeprom_bytes_write(
|
eeprom_bytes_write(
|
||||||
@@ -171,10 +173,13 @@ static bool bacnet_name_save(
|
|||||||
eeprom_bytes_write(
|
eeprom_bytes_write(
|
||||||
NV_EEPROM_NAME_ENCODING(offset),
|
NV_EEPROM_NAME_ENCODING(offset),
|
||||||
(uint8_t *)&encoding, 1);
|
(uint8_t *)&encoding, 1);
|
||||||
|
for (i = 0; i < length; i++) {
|
||||||
|
buffer[i] = str[i];
|
||||||
|
}
|
||||||
eeprom_bytes_write(
|
eeprom_bytes_write(
|
||||||
NV_EEPROM_NAME_STRING(offset),
|
NV_EEPROM_NAME_STRING(offset),
|
||||||
(uint8_t *)str,
|
&buffer[0],
|
||||||
length);
|
NV_EEPROM_NAME_SIZE);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user