@@ -23,7 +23,6 @@ import (
2323 "strings"
2424
2525 "github.com/arduino/arduino-cli/arduino"
26- "github.com/arduino/arduino-cli/arduino/sketch"
2726 "github.com/arduino/arduino-cli/commands"
2827 sk "github.com/arduino/arduino-cli/commands/sketch"
2928 "github.com/arduino/arduino-cli/commands/upload"
@@ -90,7 +89,7 @@ func runUploadCommand(command *cobra.Command, args []string) {
9089 feedback .Warning (msg )
9190 }
9291
93- sk , err := sketch . New ( sketchPath )
92+ sketch , err := sk . LoadSketch ( context . Background (), & rpc. LoadSketchRequest { SketchPath : sketchPath . String ()} )
9493 if err != nil && importDir == "" && importFile == "" {
9594 feedback .Fatal (tr ("Error during Upload: %v" , err ), feedback .ErrGeneric )
9695 }
@@ -99,7 +98,7 @@ func runUploadCommand(command *cobra.Command, args []string) {
9998 var profile * rpc.Profile
10099
101100 if profileArg .Get () == "" {
102- inst , profile = instance .CreateAndInitWithProfile (sk . Project . DefaultProfile , sketchPath )
101+ inst , profile = instance .CreateAndInitWithProfile (sketch . GetDefaultProfile (). GetName () , sketchPath )
103102 } else {
104103 inst , profile = instance .CreateAndInitWithProfile (profileArg .Get (), sketchPath )
105104 }
@@ -108,8 +107,9 @@ func runUploadCommand(command *cobra.Command, args []string) {
108107 fqbnArg .Set (profile .GetFqbn ())
109108 }
110109
111- defaultFQBN := sk .GetDefaultFQBN ()
112- defaultAddress , defaultProtocol := sk .GetDefaultPortAddressAndProtocol ()
110+ defaultFQBN := sketch .GetDefaultFqbn ()
111+ defaultAddress := sketch .GetDefaultPort ()
112+ defaultProtocol := sketch .GetDefaultProtocol ()
113113 fqbn , port := arguments .CalculateFQBNAndPort (& portArgs , & fqbnArg , inst , defaultFQBN , defaultAddress , defaultProtocol )
114114
115115 userFieldRes , err := upload .SupportedUserFields (context .Background (), & rpc.SupportedUserFieldsRequest {
0 commit comments