Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions software/firmware/experimental/settings_menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
from experimental.knobs import KnobBank, LockableKnob
from framebuf import FrameBuffer, MONO_HLSB
from machine import Timer

import gc
import os
import time

Expand Down Expand Up @@ -389,7 +391,7 @@ def modify_choices(self, choices=None, new_default=None):
# add the autoselect items, if needed
if self.autoselect_knob:
choices.append(AUTOSELECT_KNOB)
if self.autoselect_knob:
if self.autoselect_cv:
choices.append(AUTOSELECT_AIN)

self.config_point.choices = choices
Expand Down Expand Up @@ -448,7 +450,7 @@ def get_option_list(self):
# Add the autoselect inputs, if needed
if self.autoselect_knob:
items.append(AUTOSELECT_KNOB)
if self.autoselect_knob:
if self.autoselect_cv:
items.append(AUTOSELECT_AIN)

return items
Expand Down Expand Up @@ -769,6 +771,11 @@ def save(self, settings_file):

:param settings_file: The path to the JSON file to generate
"""
# free up any fragmented memory before the dict-building + JSON
# serialization below, which can be a meaningful allocation on
# memory-constrained boards (e.g. the original RP2040 Pico)
gc.collect()

data = {}
for item in self.menu_items_by_name.values():
data[item.config_point.name] = item.value_choice
Expand Down
Loading