fixed: create peripheral

This commit is contained in:
2025-11-30 18:33:00 +01:00
parent d1fda9f075
commit 7f60f7b8d7
8 changed files with 83 additions and 138 deletions

View File

@@ -140,8 +140,8 @@ func (a *App) OpenProject(projectInfo ProjectInfo) error {
// CloseCurrentProject closes the current project
func (a *App) CloseCurrentProject() error {
// Unregistrer all peripherals of the project
projectPeripherals := a.projectInfo.PeripheralsInfo
// Unregister all peripherals of the project
projectPeripherals := a.hardwareManager.SavedPeripherals
for key, value := range projectPeripherals {
err := a.hardwareManager.UnregisterPeripheral(a.ctx, value)
if err != nil {
@@ -196,6 +196,9 @@ func (a *App) SaveProject() (string, error) {
a.projectSave = fmt.Sprintf("%04d%02d%02d%02d%02d%02d%s", date.Year(), date.Month(), date.Day(), date.Hour(), date.Minute(), date.Second(), projectExtension)
log.Debug().Str("file", "project").Str("newProjectSave", a.projectSave).Msg("projectSave is null, getting a new one")
}
// Get hardware info
a.projectInfo.PeripheralsInfo = a.hardwareManager.SavedPeripherals
// Marshal the project
data, err := yaml.Marshal(a.projectInfo)
if err != nil {
log.Err(err).Str("file", "project").Any("projectInfo", a.projectInfo).Msg("unable to format the project information")