Hi,
I am currently giving 3.0.12b a try. I have sketch file called eol.ino that stores some stuff in EEPROM and sets the default values for the parameters I use in my main sketch. For some reason, when I use zunoSaveCFGParam() function, no values are getting written to EEPROM. On 3.0.10 it works flawlessly. The only possibility to have default values for parameters saved is to use the macro ZUNO_SETUP_CONFIGPARAMETERS.
But I am wondering if ZUNO_SETUP_CONFIGPARAMETERS is the correct way to proceed. Each time I flash or update my sketch, the parameters will be overwritten. I don't think this is the intended usage for the default value in this macro. Im my opinion, the macro should check for a default written value for a config parameter in EEPROM in production (let's say 0xAFAFAFAF), and only write the default value provided by the macro ZUNO_SETUP_CONFIGPARAMETERS when the config parameter hasn't been set before.
Is this issue known to you?
Configuration parameters in 3.0.12 beta
Re: Configuration parameters in 3.0.12 beta
Hello. Can you give an example of using zunoSaveCFGParam?aleconakad wrote: ↑06 Mar 2024 15:43I am currently giving 3.0.12b a try. I have sketch file called eol.ino that stores some stuff in EEPROM and sets the default values for the parameters I use in my main sketch. For some reason, when I use zunoSaveCFGParam() function, no values are getting written to EEPROM. On 3.0.10 it works flawlessly. The only possibility to have default values for parameters saved is to use the macro ZUNO_SETUP_CONFIGPARAMETERS.
Re: Configuration parameters in 3.0.12 beta
At the moment this functionality is not supported.aleconakad wrote: ↑06 Mar 2024 15:43
Im my opinion, the macro should check for a default written value for a config parameter in EEPROM in production (let's say 0xAFAFAFAF), and only write the default value provided by the macro ZUNO_SETUP_CONFIGPARAMETERS when the config parameter hasn't been set before.
-
- Posts: 68
- Joined: 18 Jan 2016 15:25
Re: Configuration parameters in 3.0.12 beta
Here's a snapshot:
This writes the cfg parameters, then read them out and print them on the serial console. In 3.0.10 and older it works flawlessly. In 3.0.12b it doesn't work.
Instead I have to use:
Furthermore, any change to these parameters from the controller will not lead to any effective change on Z-Uno2.
Code: Select all
#ifdef FLASH_CONFIG_PARAMS
void flash_config_params() {
Serial.println("Flashing Z-UNO sketch default configuration parameters");
val = 0; // fading algorithm
zunoSaveCFGParam(64, val);
delay(50);
val = 3000; // fading time
zunoSaveCFGParam(65, val);
delay(50);
val = 0; // operation mode
zunoSaveCFGParam(66, val);
delay(50);
val = 99; // dimming max
zunoSaveCFGParam(67, val);
delay(50);
val = 1; // dimming min
zunoSaveCFGParam(68, val);
delay(50);
val = 1; // start state
zunoSaveCFGParam(69, val);
delay(50);
val = 0; // strip type
zunoSaveCFGParam(70, val);
delay(50);
val = 0; // white generation
zunoSaveCFGParam(71, val);
delay(50);
val = 15; // power report components
zunoSaveCFGParam(72, val);
delay(50);
val = 0; // report frequency
zunoSaveCFGParam(73, val);
delay(50);
val = 25; // report on change in %
zunoSaveCFGParam(74, val);
delay(50);
val = 0; // switch multilevel
zunoSaveCFGParam(75, val);
delay(50);
val = 0; // set animation
zunoSaveCFGParam(76, val);
delay(50);
val = 0; // on mode change
zunoSaveCFGParam(77, val);
delay(50);
val = 0; // start delay in seconds
zunoSaveCFGParam(78, val);
delay(50);
val = 100; // extension factor
zunoSaveCFGParam(79, val);
delay(50);
val = 0; // high priority notifications
zunoSaveCFGParam(80, val);
delay(50);
val = 0; // low priority notifications
zunoSaveCFGParam(81, val);
delay(500);
Serial.println("Flashing of Z-UNO sketch default configuration parameters completed!");
}
#define PARAM_START_ADDR 64
#define PARAM_END_ADDR 81
void verify_flash_config_params() {
Serial.println("Verifying Z-UNO sketch default configuration parameters");
byte i;
for (i = PARAM_START_ADDR; i <= PARAM_END_ADDR; i++) {
val = zunoLoadCFGParam(i);
Serial.print("Param ");
Serial.print(i);
Serial.print(": ");
Serial.println(val);
delay(100);
}
delay(200);
Serial.println("Verification of Z-UNO sketch default configuration parameters completed!");
}
#endif
Instead I have to use:
Code: Select all
#ifdef STATIC_CONFIG_PARAMS
// Device's configuration parametrs definitions
ZUNO_SETUP_CONFIGPARAMETERS(
ZUNO_CONFIG_PARAMETER_1B("Fading algorithm", 0, 1, 0),
ZUNO_CONFIG_PARAMETER_2B("Fading time", 0, 10000, 3000),
ZUNO_CONFIG_PARAMETER_1B("Operating mode", 0, 2, 0),
ZUNO_CONFIG_PARAMETER_1B("Dimming max", 1, 99, 99),
ZUNO_CONFIG_PARAMETER_1B("Dimming min", 1, 99, 1),
ZUNO_CONFIG_PARAMETER_1B("State on start", 0, 2, 1),
ZUNO_CONFIG_PARAMETER_1B("RGBW Strip type", 0, 2, 1),
ZUNO_CONFIG_PARAMETER_1B("White color generation", 0, 1, 0),
ZUNO_CONFIG_PARAMETER_1B("Power report", 0, 0x0F, 0x0F),
ZUNO_CONFIG_PARAMETER_2B("Power report frequency", 0, 65535, 0),
ZUNO_CONFIG_PARAMETER_1B("Power report on change", 0, 100, 25),
ZUNO_CONFIG_PARAMETER_1B("Handling of 0xFF switch multilevel value", 0, 1, 0),
ZUNO_CONFIG_PARAMETER_1B("Set animation", 0, 13, 0),
ZUNO_CONFIG_PARAMETER_1B("On mode change", 0, 2, 0),
ZUNO_CONFIG_PARAMETER_2B("Start delay (in sec)", 0, 600, 0),
ZUNO_CONFIG_PARAMETER_2B("Strip extension factor", 100, 65536, 100),
ZUNO_CONFIG_PARAMETER_2B("Animations on high priority notifications", 0, 0xFFFF, 0x0000),
ZUNO_CONFIG_PARAMETER_2B("Animations on high priority notifications", 0, 0xFFFF, 0x0000)
);
#endif
Re: Configuration parameters in 3.0.12 beta
I checked everything is changing successfully.aleconakad wrote: ↑12 Mar 2024 12:48Furthermore, any change to these parameters from the controller will not lead to any effective change on Z-Uno2.
Maybe you are using numbers out of bounds?
As an example here:
Code: Select all
ZUNO_CONFIG_PARAMETER_1B("Fading algorithm", 0, 1, 0),
The correct numbers are 0 and 1 - all others cannot be used.
Re: Configuration parameters in 3.0.12 beta
I'm not sure I understood exactly. But if you need to use ZUNO_SETUP_CONFIGPARAMETERS, and not through zunoSaveCFGParam - then this is how it should be - so that the command class has all the necessary information for its work.aleconakad wrote: ↑12 Mar 2024 12:48
This writes the cfg parameters, then read them out and print them on the serial console. In 3.0.10 and older it works flawlessly. In 3.0.12b it doesn't work.
-
- Posts: 68
- Joined: 18 Jan 2016 15:25
Re: Configuration parameters in 3.0.12 beta
After a while of digging it turned out that my usb cable had some issue. Replacing it simply fixed the problem. BTW I use Visual Studio Code on a M2 Apple Silicon. My initial thoughts lead me to try out the same sketch on multiple machines, including Linux and windows in a virtualized environment. All were exhibiting the same symptom. When I replaced the cable, issue was just gone.
Thanks for your support.
Thanks for your support.