Skip to content

Commit

Permalink
feat: Allow setting custom manufacturer and device name
Browse files Browse the repository at this point in the history
By setting `general.manufacturer` and `general.device_name` it is now possible to overwrite this values.
  • Loading branch information
ffenix113 committed Apr 30, 2024
1 parent 5267ef5 commit 9810582
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions config/device.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ type General struct {
NCSVersion string `yaml:"ncs_version"`
ZephyrBase string `yaml:"zephyr_base"`

Manufacturer string
DeviceName string
Manufacturer string `yaml:"manufacturer"`
DeviceName string `yaml:"device_name"`
// Zephyr name for the board
Board string
RunEvery time.Duration
Expand All @@ -55,6 +55,8 @@ func ParseFromFile(configPath string) (*Device, error) {
RunEvery: time.Minute,
NCSToolChainBase: "~/ncs",
NCSVersion: "v2.5.0",
Manufacturer: "FFexix113",
DeviceName: "dongle",
},
}

Expand Down
4 changes: 2 additions & 2 deletions templates/src/device.h.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,10 @@ ZBOSS_DECLARE_DEVICE_CTX_{{len .Device.Sensors}}_EP(
);

/* Manufacturer name (32 bytes). */
#define DEVICE_INIT_BASIC_MANUF_NAME "FFenix113"
#define DEVICE_INIT_BASIC_MANUF_NAME "{{ .Device.General.Manufacturer }}"

/* Model number assigned by manufacturer (32-bytes long string). */
#define DEVICE_INIT_BASIC_MODEL_ID "dongle"
#define DEVICE_INIT_BASIC_MODEL_ID "{{ .Device.General.DeviceName }}"

/* First 8 bytes specify the date of manufacturer of the device
* in ISO 8601 format (YYYYMMDD). The rest (8 bytes) are manufacturer specific.
Expand Down

0 comments on commit 9810582

Please sign in to comment.