fix: correct hex padding for as_generated_default_macro to fix 24-bit attribute defaults (#1648)

- Ensure proper hex padding based on attribute size (attributeSize * 2 digits)
- Fix issue where 0x186A0 for 24-bit attributes generated incorrect byte sequence
- Handle both hex (0x prefixed) and decimal input values correctly
- Maintain backward compatibility with existing test expectations
- Fixes customer-reported issue where 24-bit values were 16x larger than expected
- The padding logic now ensures that hex values like 0x186A0 are properly padded to 0x0186A0 for 3-byte attributes, generating the correct byte sequence 0x01, 0x86, 0xA0 instead of 0x18, 0x6A, 0x0.

- adding test for little endian as well
- JIRA: ZAPP-1658
4 files changed
tree: 66fe2ce5d7ae82ed1501b1796d5ade8d810d4299
  1. .github/
  2. .husky/
  3. cypress/
  4. docs/
  5. public/
  6. resource-build/
  7. src/
  8. src-electron/
  9. src-script/
  10. src-shared/
  11. test/
  12. zcl-builtin/
  13. .editorconfig
  14. .eslintignore
  15. .eslintrc.js
  16. .gitignore
  17. .gitmodules
  18. .postcssrc.js
  19. .prettierrc
  20. .stylintrc
  21. apack.json
  22. babel.config.js
  23. cypress.config.js
  24. Jenkinsfile
  25. jest.config.js
  26. jsconfig.json
  27. LICENSE.txt
  28. package-lock.json
  29. package.json
  30. quasar.conf.js
  31. quasar.extensions.json
  32. quasar.testing.json
  33. README.md
  34. sonar-project.properties
  35. tsconfig.json
  36. zap-schema.dot
  37. zap-schema.svg
README.md

ZCL Advanced Platform

ZCL Advanced Platform

Build and release packages Zigbee code regeneration Matter code regeneration

What is ZAP?

ZAP is a generic generation engine and user interface for applications and libraries based on Zigbee Cluster Library, the specification developed by the Connectivity Standards Alliance.

ZAP allows you to perform the following:

  • perform SDK-specific customized generation of all global artifacts (constants, types, IDs, etc) based on the ZCL specification
  • provide UI for the end-user to select specific application configuration (clusters, attributes, commands, etc.)
  • perform SDK-specific customized generation of all user selected configuration artifacts (application configuration, endpoint configuration, etc) based on ZCL specification and customer-provided application configuration.

ZAP is a generic templating engine. Examples are provided for how to generate artifacts for the C language environment, but one could easily add new templates for other language environments, such as C++, java, node.js, python or any other.

Quick setup

Refer to Setup Instructions

Source code

Refer to development instructions for more details.

License

This software is licensed under Apache 2.0 license.

Usage Documentation

Detailed Developer Documentation