Is there a way to leave a NumberSetting empty and set it to a default value if it doesn’t exist? I want to add an optional debug setting but this format requires an input:
my_number_setting = NumberSetting(min_value=0, max_value=100)
Instead, I get a message in the Edit Settings pop-up: “my_number_setting” must be a valid number.
@ruvim.piholyuk Unfortunately, this likely isn’t possible, or in other words, a workaround is currently not documented if it is possible.
Can I know more information about what exactly you would like to accomplish with a default setting for the min and max value? For example, can you explain a typical scenario in which you’d utilize something like this?
I was hoping to add a layer of validation to HID-I2C packets. Specifically, I wanted to let users set an optional setting for wMaxInputLength. The analyzer would detect and display a message to the user if the Hid report length is larger than wMaxInputLength. If the value isn’t set the analyzer would avoid checking the report length at all.
@ruvim.piholyuk Thanks for describing your use case! That makes a lot of sense. I’ll bring this up internally with the team here.
Thanks for the feedback! We definitely want to improve flexibility here, including allow some settings to be dependent on other settings. Supporting optional values seems like a good plan.
In the meantime, I would suggest using -1 as the value for unset, or using a string setting instead of a number setting, then parse the string value in your python. Unfortunately there aren’t a lot of great options for validation though.
Thanks @timreyes @markgarrison! I have a workaround in for now but I’ll be on the lookout for any updates.