ZUNO_SETUP_CFGPARAMETER_HANDLER()
Z-Uno can be configured using standard Z-Wave Configuration feature. A Z-Wave controller can push parameter values to Z-Uno to tune Z-Uno behavior without changing Z-Uno sketch.This macro defines the handler to be called on Configuration parameter change.
Z-Uno supports up to 32 configurable parameters. ZUNO_SETUP_CFGPARAMETER_HANDLER(config_parameter_changed) config_parameter_changed Function to be called on parameters changed from the Z-Wave network. Function prototype is:
void config_parameter_changed(byte param, word value)
void config_parameter_changed(uint8_t param, uint32_t value)
param is the parameter number.
value is the new value in 2-bytes representation value is the new value in 4-bytes representation Configuration parameters are automatically saved to the EEPROM. You can get them from the EEPROM at any time (even after reboot) using zunoLoadCFGParam(param) or save (to be reported back to the controller upon request) using zunoSaveCFGParam(param, value) word value = zunoLoadCFGParam(byte param); uint32_t value = zunoLoadCFGParam(byte param); param Number of the parameter to be loaded from the EEPROM (starts from 64) zunoSaveCFGParam(byte param, word value); zunoSaveCFGParam(uint8_t param, uint32_t value); param Number of the parameter to be saved to the EEPROM (starts from 64) value word variable to store dword variable to store Parameters on the Z-Wave controller side are numbered from 64 to 96. Note that Configuration parameters are signed values when defined in the Z-Wave controller. Since 2.1.5 zunoSaveCFGParam accepts and zunoLoadCFGParam returns a value instead of a pointer. Prior to version 2.1.4 parameters were 4 bytes (dword). Starting from 2.1.4 parameters are now two bytes (word).
word paramValue;
ZUNO_SETUP_CFGPARAMETER_HANDLER(config_parameter_changed);
word paramValue;
void setup() {
paramValue = zunoLoadCFGParam(64);
}
void loop() {
zunoSaveCFGParam(64, paramValue);
}
void config_parameter_changed(byte param, word value) {
if (param == 64) { // The first user-defined parameter
paramValue = value;
}
}
uint32_t paramValue;
ZUNO_SETUP_CFGPARAMETER_HANDLER(config_parameter_changed);
uint32_t paramValue;
void setup() {
paramValue = zunoLoadCFGParam(64);
}
void loop() {
zunoSaveCFGParam(64, paramValue);
}
void config_parameter_changed(uint8_t param, uint32_t value) {
if (param == 64) { // The first user-defined parameter
paramValue = value;
}
}
Get more information about Z-Wave.Use ZUNO_SETUP_CONFIGPARAMETERS() to setup parameter's metadata