Skip to content
代码片段 群组 项目
未验证 提交 d6b31c41 编辑于 作者: tehampson's avatar tehampson 提交者: GitHub
浏览文件

Modify helper endpoint config 4byte default (#501)

Allow for size of default value size to be configurable

defaultValue in the EmberAfDefaultOrMinMaxAttributeValue is uint16_t. For targets that have 32-bit addresses, there is wasted space in the union. We can let defaultValue be uint32_t and save on rodata region, by fitting the default value in the meta data structure itself. This allows use to specify the size of default value, if size option is not provided we default to legacy 2 bytes.
上级 5fa63e46
No related branches found
No related tags found
无相关合并请求
......@@ -528,6 +528,7 @@ async function collectAttributes(endpointTypes, options) {
let reportList = [] // Array of { direction, endpoint, clusterId, attributeId, mask, mfgCode, minOrSource, maxOrEndpoint, reportableChangeOrTimeout }
let longDefaultsList = [] // Array of { value, size. comment }
let attributeIndex = 0
let spaceForDefaultValue = options.spaceForDefaultValue !== undefined ? options.spaceForDefaultValue : 2
endpointTypes.forEach((ept) => {
let endpoint = {
......@@ -617,7 +618,7 @@ async function collectAttributes(endpointTypes, options) {
// nonempty default value to use long defaults.
// external strings and zero-length default values.
if (
defaultSize > 2 ||
defaultSize > spaceForDefaultValue ||
(types.isString(a.type) &&
attributeDefaultValue !== undefined &&
attributeDefaultValue !== '')
......@@ -926,6 +927,7 @@ function endpoint_config(options) {
let collectAttributesOptions = {
allowUnknownStorageOption:
options.hash.allowUnknownStorageOption === 'false' ? false : true,
spaceForDefaultValue: options.hash.spaceForDefaultValue,
}
let promise = templateUtil
.ensureZclPackageId(newContext)
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册