Skip to content

Commit 9810582

Browse files
committed
feat: Allow setting custom manufacturer and device name
By setting `general.manufacturer` and `general.device_name` it is now possible to overwrite this values.
1 parent 5267ef5 commit 9810582

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

config/device.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ type General struct {
2727
NCSVersion string `yaml:"ncs_version"`
2828
ZephyrBase string `yaml:"zephyr_base"`
2929

30-
Manufacturer string
31-
DeviceName string
30+
Manufacturer string `yaml:"manufacturer"`
31+
DeviceName string `yaml:"device_name"`
3232
// Zephyr name for the board
3333
Board string
3434
RunEvery time.Duration
@@ -55,6 +55,8 @@ func ParseFromFile(configPath string) (*Device, error) {
5555
RunEvery: time.Minute,
5656
NCSToolChainBase: "~/ncs",
5757
NCSVersion: "v2.5.0",
58+
Manufacturer: "FFexix113",
59+
DeviceName: "dongle",
5860
},
5961
}
6062

templates/src/device.h.tpl

+2-2
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,10 @@ ZBOSS_DECLARE_DEVICE_CTX_{{len .Device.Sensors}}_EP(
7676
);
7777

7878
/* Manufacturer name (32 bytes). */
79-
#define DEVICE_INIT_BASIC_MANUF_NAME "FFenix113"
79+
#define DEVICE_INIT_BASIC_MANUF_NAME "{{ .Device.General.Manufacturer }}"
8080

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

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

0 commit comments

Comments
 (0)