Skip to content

Commit abfcb76

Browse files
committed
Merge branch 'backport/1.5/string-max-value-persistence' into 'release/v1.5'
components/esp_matter: fix string attribute max length lost after NVS See merge request app-frameworks/esp-matter!1551
2 parents 8e51777 + 2be1ae2 commit abfcb76

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

components/esp_matter/data_model/esp_matter_data_model.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -606,6 +606,12 @@ attribute_t *create(cluster_t *cluster, uint32_t attribute_id, uint16_t flags, e
606606
// read from the NVS and store in the attribute's storage
607607
esp_matter_attr_val_t temp_val;
608608
temp_val.type = attribute->attribute_val_type;
609+
if (val.type == ESP_MATTER_VAL_TYPE_CHAR_STRING || val.type == ESP_MATTER_VAL_TYPE_LONG_CHAR_STRING ||
610+
val.type == ESP_MATTER_VAL_TYPE_OCTET_STRING || val.type == ESP_MATTER_VAL_TYPE_LONG_OCTET_STRING) {
611+
temp_val.val.a.max = max_val_size;
612+
temp_val.val.a.s = 0;
613+
temp_val.val.a.t = 0;
614+
}
609615
esp_err_t err = get_val_from_nvs(attribute->endpoint_id, attribute->cluster_id, attribute_id, temp_val);
610616
if (err == ESP_OK) {
611617
attribute->attribute_val = temp_val.val;

0 commit comments

Comments
 (0)