forked from Elara6331/itd
		
	Add reminder to validate firmware to itctl and itgui
This commit is contained in:
		| @@ -19,6 +19,9 @@ | |||||||
| package firmware | package firmware | ||||||
|  |  | ||||||
| import ( | import ( | ||||||
|  | 	"fmt" | ||||||
|  | 	"time" | ||||||
|  |  | ||||||
| 	"github.com/cheggaaa/pb/v3" | 	"github.com/cheggaaa/pb/v3" | ||||||
| 	"github.com/rs/zerolog/log" | 	"github.com/rs/zerolog/log" | ||||||
| 	"github.com/spf13/cobra" | 	"github.com/spf13/cobra" | ||||||
| @@ -38,6 +41,8 @@ var upgradeCmd = &cobra.Command{ | |||||||
| 	Short:   "Upgrade InfiniTime firmware using files or archive", | 	Short:   "Upgrade InfiniTime firmware using files or archive", | ||||||
| 	Aliases: []string{"upg"}, | 	Aliases: []string{"upg"}, | ||||||
| 	Run: func(cmd *cobra.Command, args []string) { | 	Run: func(cmd *cobra.Command, args []string) { | ||||||
|  | 		start := time.Now() | ||||||
|  |  | ||||||
| 		client := viper.Get("client").(*api.Client) | 		client := viper.Get("client").(*api.Client) | ||||||
|  |  | ||||||
| 		var upgType api.UpgradeType | 		var upgType api.UpgradeType | ||||||
| @@ -79,6 +84,9 @@ var upgradeCmd = &cobra.Command{ | |||||||
| 		} | 		} | ||||||
| 		// Finish progress bar | 		// Finish progress bar | ||||||
| 		bar.Finish() | 		bar.Finish() | ||||||
|  |  | ||||||
|  | 		fmt.Printf("Transferred %d B in %s.\n", bar.Total(), time.Since(start)) | ||||||
|  | 		fmt.Println("Remember to validate the new firmware in the InfiniTime settings.") | ||||||
| 	}, | 	}, | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -134,8 +134,6 @@ func upgradeTab(parent fyne.Window, client *api.Client) *fyne.Container { | |||||||
|  |  | ||||||
| 		// Show progress dialog | 		// Show progress dialog | ||||||
| 		progressDlg.Show() | 		progressDlg.Show() | ||||||
| 		// Hide progress dialog after completion |  | ||||||
| 		defer progressDlg.Hide() |  | ||||||
|  |  | ||||||
| 		for event := range progress { | 		for event := range progress { | ||||||
| 			// Set label text to received / total B | 			// Set label text to received / total B | ||||||
| @@ -150,6 +148,24 @@ func upgradeTab(parent fyne.Window, client *api.Client) *fyne.Container { | |||||||
| 				break | 				break | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
|  | 		// Hide progress dialog after completion | ||||||
|  | 		progressDlg.Hide() | ||||||
|  |  | ||||||
|  | 		// Reset screen to default | ||||||
|  | 		upgradeTypeSelect.SetSelectedIndex(0) | ||||||
|  | 		firmwareBtn.SetText("Select firmware (.bin)") | ||||||
|  | 		initPktBtn.SetText("Select init packet (.dat)") | ||||||
|  | 		archiveBtn.SetText("Select archive (.zip)") | ||||||
|  | 		firmwarePath = "" | ||||||
|  | 		initPktPath = "" | ||||||
|  | 		archivePath = "" | ||||||
|  |  | ||||||
|  | 		dialog.NewInformation( | ||||||
|  | 			"Upgrade Complete", | ||||||
|  | 			"The firmware was transferred successfully.\nRemember to validate the firmware in InfiniTime settings.", | ||||||
|  | 			parent, | ||||||
|  | 		).Show() | ||||||
| 	}) | 	}) | ||||||
|  |  | ||||||
| 	// Return container containing all elements | 	// Return container containing all elements | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user