@@ -24,8 +24,8 @@ import (
2424
2525 "github.com/arduino/arduino-cli/arduino"
2626 "github.com/arduino/arduino-cli/arduino/cores/packagemanager"
27- "github.com/arduino/arduino-cli/arduino/sketch"
2827 "github.com/arduino/arduino-cli/commands"
28+ sk "github.com/arduino/arduino-cli/commands/sketch"
2929 "github.com/arduino/arduino-cli/commands/upload"
3030 "github.com/arduino/arduino-cli/i18n"
3131 "github.com/arduino/arduino-cli/internal/cli/arguments"
@@ -90,7 +90,7 @@ func runUploadCommand(command *cobra.Command, args []string) {
9090 arguments .WarnDeprecatedFiles (sketchPath )
9191 }
9292
93- sk , err := sketch . New ( sketchPath )
93+ sketch , err := sk . LoadSketch ( context . Background (), & rpc. LoadSketchRequest { SketchPath : sketchPath . String ()} )
9494 if err != nil && importDir == "" && importFile == "" {
9595 feedback .Fatal (tr ("Error during Upload: %v" , err ), feedback .ErrGeneric )
9696 }
@@ -99,7 +99,7 @@ func runUploadCommand(command *cobra.Command, args []string) {
9999 var profile * rpc.Profile
100100
101101 if profileArg .Get () == "" {
102- inst , profile = instance .CreateAndInitWithProfile (sk . Project . DefaultProfile , sketchPath )
102+ inst , profile = instance .CreateAndInitWithProfile (sketch . GetDefaultProfile (). GetName () , sketchPath )
103103 } else {
104104 inst , profile = instance .CreateAndInitWithProfile (profileArg .Get (), sketchPath )
105105 }
@@ -108,8 +108,9 @@ func runUploadCommand(command *cobra.Command, args []string) {
108108 fqbnArg .Set (profile .GetFqbn ())
109109 }
110110
111- defaultFQBN := sk .GetDefaultFQBN ()
112- defaultAddress , defaultProtocol := sk .GetDefaultPortAddressAndProtocol ()
111+ defaultFQBN := sketch .GetDefaultFqbn ()
112+ defaultAddress := sketch .GetDefaultPort ()
113+ defaultProtocol := sketch .GetDefaultProtocol ()
113114 fqbn , port := arguments .CalculateFQBNAndPort (& portArgs , & fqbnArg , inst , defaultFQBN , defaultAddress , defaultProtocol )
114115
115116 userFieldRes , err := upload .SupportedUserFields (context .Background (), & rpc.SupportedUserFieldsRequest {
0 commit comments