fix: Use keysGetMaxTrims() instead of MAX_TRIMS (#3860)

* fix: use keysGetMaxTrims() instead of MAX_TRIMS

* feat: add support for virtual trims

This is necessary for radios like X-lite where half of the trims are simulated
This commit is contained in:
Raphael Coeffic
2023-07-30 14:18:58 +10:00
committed by GitHub
parent 76423370cd
commit 574369aca4
13 changed files with 55 additions and 36 deletions
+9 -3
View File
@@ -66,13 +66,19 @@ def build_switch_gpio_port_index(switches):
def build_trim_gpio_port_index(trims):
def index_contact(gpios, contact):
append_to_index(gpios, contact['gpio'], contact['pin'])
gpio = contact['gpio']
pin = contact['pin']
if gpio and pin:
append_to_index(gpios, contact['gpio'], contact['pin'])
i = 0
gpios = {}
for trim in trims:
index_contact(gpios, trim['dec'])
index_contact(gpios, trim['inc'])
dec = trim.get('dec')
inc = trim.get('inc')
if dec and inc:
index_contact(gpios, dec)
index_contact(gpios, inc)
return gpios