diff --git a/arduino/cores/fqbn.go b/arduino/cores/fqbn.go index 9003ee6f888..19b95d2f11c 100644 --- a/arduino/cores/fqbn.go +++ b/arduino/cores/fqbn.go @@ -65,7 +65,7 @@ func ParseFQBN(fqbnIn string) (*FQBN, error) { } func (fqbn *FQBN) String() string { - res := fmt.Sprintf("%s:%s:%s", fqbn.Package, fqbn.PlatformArch, fqbn.BoardID) + res := fqbn.StringWithoutConfig() if fqbn.Configs.Size() > 0 { sep := ":" for _, k := range fqbn.Configs.Keys() { @@ -75,3 +75,8 @@ func (fqbn *FQBN) String() string { } return res } + +// StringWithoutConfig returns the FQBN without the Config part +func (fqbn *FQBN) StringWithoutConfig() string { + return fqbn.Package + ":" + fqbn.PlatformArch + ":" + fqbn.BoardID +} diff --git a/commands/compile/compile.go b/commands/compile/compile.go index 43ebfb39b2c..0a368a0b3b5 100644 --- a/commands/compile/compile.go +++ b/commands/compile/compile.go @@ -206,8 +206,7 @@ func Compile(ctx context.Context, req *rpc.CompileReq, outStream, errStream io.W // FIXME: Make a function to produce a better name... // Make the filename without the FQBN configs part - fqbn.Configs = properties.NewMap() - fqbnSuffix := strings.Replace(fqbn.String(), ":", ".", -1) + fqbnSuffix := strings.Replace(fqbn.StringWithoutConfig(), ":", ".", -1) var exportPath *paths.Path var exportFile string diff --git a/commands/upload/upload.go b/commands/upload/upload.go index c373c9b049f..4b68dd4eb25 100644 --- a/commands/upload/upload.go +++ b/commands/upload/upload.go @@ -130,8 +130,7 @@ func Upload(ctx context.Context, req *rpc.UploadReq, outStream io.Writer, errStr } // Set properties for verbose upload - Verbose := req.GetVerbose() - if Verbose { + if req.GetVerbose() { if v, ok := uploadProperties.GetOk("upload.params.verbose"); ok { uploadProperties.Set("upload.verbose", v) } @@ -142,8 +141,7 @@ func Upload(ctx context.Context, req *rpc.UploadReq, outStream io.Writer, errStr } // Set properties for verify - Verify := req.GetVerify() - if Verify { + if req.GetVerify() { uploadProperties.Set("upload.verify", uploadProperties.Get("upload.params.verify")) } else { uploadProperties.Set("upload.verify", uploadProperties.Get("upload.params.noverify")) @@ -191,6 +189,10 @@ func Upload(ctx context.Context, req *rpc.UploadReq, outStream io.Writer, errStr return nil, fmt.Errorf("cannot get serial port list: %s", err) } for _, p := range ports { + if req.GetVerbose() { + outStream.Write([]byte(fmt.Sprintf("Performing 1200-bps touch reset on serial port %s", p))) + outStream.Write([]byte(fmt.Sprintln())) + } if p == port { if err := touchSerialPortAt1200bps(p); err != nil { return nil, fmt.Errorf("cannot perform reset: %s", err) @@ -209,6 +211,9 @@ func Upload(ctx context.Context, req *rpc.UploadReq, outStream io.Writer, errStr // Wait for upload port if requested actualPort := port // default if uploadProperties.GetBoolean("upload.wait_for_upload_port") { + if req.GetVerbose() { + outStream.Write([]byte(fmt.Sprintln("Waiting for upload port..."))) + } if p, err := waitForNewSerialPort(); err != nil { return nil, fmt.Errorf("cannot detect serial ports: %s", err) } else if p == "" { @@ -240,6 +245,9 @@ func Upload(ctx context.Context, req *rpc.UploadReq, outStream io.Writer, errStr } // Run Tool + if req.GetVerbose() { + outStream.Write([]byte(fmt.Sprintln(cmdLine))) + } cmd, err := executils.Command(cmdArgs) if err != nil { return nil, fmt.Errorf("cannot execute upload tool: %s", err)