fixed: FTDI get settings when disconnected

This commit is contained in:
2025-11-14 11:44:54 +01:00
parent a688420e43
commit 5b1372826f
2 changed files with 4 additions and 2 deletions

View File

@@ -133,7 +133,6 @@
<style>
main {
text-align: left;
padding: 1em;
max-width: 240px;
margin: 0 auto;
}

View File

@@ -166,7 +166,10 @@ func (f *FTDIFinder) GetPeripheralSettings(peripheralID string) (map[string]inte
// Return the specified peripheral
peripheral, found := f.detected[peripheralID]
if !found {
log.Error().Str("file", "FTDIFinder").Str("peripheralID", peripheralID).Msg("unable to get this peripheral from the FTDI finder")
// FTDI not detected, return the last settings saved
if savedPeripheral, isFound := f.saved[peripheralID]; isFound {
return savedPeripheral.Settings, nil
}
return nil, fmt.Errorf("unable to found the peripheral")
}
log.Debug().Str("file", "FTDIFinder").Str("peripheralID", peripheralID).Msg("peripheral found by the FTDI finder")