# HLA Settings Default Values?

**URL:** <https://discuss.saleae.com/t/hla-settings-default-values/3475>\
**Category:** Extensions\
**Created:** [July 16, 2025, 3:25pm UTC](https://discuss.saleae.com/t/hla-settings-default-values/3475 "2025-07-16T15:25:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![baebiebrian](https://avatars.discourse-cdn.com/v4/letter/b/a8b319/32.png) [@baebiebrian](https://discuss.saleae.com/u/baebiebrian)\
**Post date:** [July 16, 2025, 3:25pm UTC](https://discuss.saleae.com/t/hla-settings-default-values/3475/1 "2025-07-16T15:25:13Z")

</div>

If I’m working on a new HLA, I might want to add new settings to it to enhance its behavior. Unfortunately, if I just add a new setting to the Python file and reload it in a capture session in Logic, [the runtime error described in this thread](https://discuss.saleae.com/t/cant-add-settings-in-the-default-hla-template/3314/6) (`ValidationError: Missing setting...`) is raised. The only workaround I’ve found is to delete the analyzer and re-add it to the capture session.

If a settings object could be instantiated with a default value, this issue could be avoided; in the absence of a setting already in the capture session, the default would be used.

The documentation for `XxxxxxSettings` objects is essentially nonexistent, and I can’t find the source for the Saleae HLA Python modules to figure it out myself. Is there a kwarg for the settings objects that would permit a default value to be specified?

---

<div class="post-metadata">

**Author:** ![baebiebrian](https://avatars.discourse-cdn.com/v4/letter/b/a8b319/32.png) [@baebiebrian](https://discuss.saleae.com/u/baebiebrian)\
**Post date:** [July 16, 2025, 5:20pm UTC](https://discuss.saleae.com/t/hla-settings-default-values/3475/2 "2025-07-16T17:20:58Z")

</div>

Thanks to the inherently open-source nature of Python, I read the exception messages more carefully and realized I have the source code in Logic’s internal Python environment.

I’ve come up with a partial work-around by overriding the ` __new__ ` implementation of `HighLevelAnalyzer` in my subclass:

```
def __new__ (cls, settings, *args, **kwargs):
    obj = super(HighLevelAnalyzer, cls). __new__ (cls, *args, **kwargs)

    for setting in cls._get_settings():
        name = setting.name
        if name not in settings:
            if hasattr(setting, "default"):
                print(f'Using default setting for {name}: {setting.default}')
                settings[name] = setting.default
            else:
                raise ValidationError('Missing setting: ' + name)
        setting.validate(settings[name])
        setattr(obj, name, settings[name])

    return obj

```

The important bit is the four lines immediately following `if name not in settings:` which then checks if the Setting has a default attribute and, if so, uses it. Also important is that this calls _`HighLevelAnalyzer`’s superclass ` __new__ `_ (and not its own superclass) to skip over `HighLevelAnalyzer`’s implementation. Combine that with adding the defaults in the static initialization (whatever Python calls it):

```
my_new_setting = NumberSetting(min_value=0, max_value=30000, label='Interbyte Timeout (ms)')
my_new_setting.default = 150

```

The one drawback is that Logic doesn’t reinitialize the settings window when reloading the Extension, so those new settings won’t appear when selecting Edit. The only workaround I’ve found for that is to save the capture, then restart Logic.

**Saleae Devs** : Please consider adding a `default=` kwarg to `Settings` and have it function similarly to what I’ve implemented here. Also please make the settings window be reinitialized when an Extension is reloaded.

---

<div class="post-metadata">

**Author:** ![timreyes](https://yyz2.discourse-cdn.com/flex030/user_avatar/discuss.saleae.com/timreyes/32/108_2.png) [@timreyes](https://discuss.saleae.com/u/timreyes)\
**Post date:** [July 18, 2025, 1:18am UTC](https://discuss.saleae.com/t/hla-settings-default-values/3475/3 "2025-07-18T01:18:57Z")

</div>

@baebiebrian I’ve gone ahead and referenced this information in the bug report post I made below as well. Thanks for sharing that with us.

> **[Bug Report - HLA ValidationError upon Reload - Logic 2 - Ideas and Feature...](https://ideas.saleae.com/b/feature-requests/bug-report-hla-validationerror-upon-reload/)**
>
> Reported via the forum links below:
> 
> https://discuss.saleae.com/t/cant-add-settings-in-the-default-hla-template/3314/6
> https://discuss.saleae.com/t/hla-settings-default-values/3475 (a more detailed workaround was summarized here as well)
> 
> Quick...
