save peripherals in project file

This commit is contained in:
2024-12-20 17:18:57 +01:00
parent 17b5d39fc4
commit 9964ccef7e
19 changed files with 316 additions and 228 deletions

View File

@@ -40,7 +40,20 @@ func (f *FTDIFinder) Initialize() error {
// GetName returns the name of the finder
func (f *FTDIFinder) GetName() string {
return "FTDI Finder"
return "FTDI"
}
// GetPeripheral gets the peripheral that correspond to the specified ID
func (f *FTDIFinder) GetPeripheral(peripheralID string) (Peripheral, bool) {
// Return the specified peripheral
peripheral := f.peripherals[peripheralID]
if peripheral == nil {
fmt.Println("Unable to get the peripheral in the finder")
return nil, false
}
fmt.Println("Peripheral found in the finder")
return peripheral, true
}
//go:embed third-party/ftdi/detectFTDI.exe
@@ -100,7 +113,7 @@ func (f *FTDIFinder) Scan(ctx context.Context) error {
location = -1
}
// Add the peripheral to the temporary list
peripheral, err := NewFTDIPeripheral(deviceInfo[2], deviceInfo[1], location)
peripheral, err := NewFTDIPeripheral(deviceInfo[2], deviceInfo[1], location, f.GetName())
if err != nil {
return fmt.Errorf("Unable to create the FTDI peripheral: %v", err)
}