From 927ff10c7e917c393b08e266359c1b8fbbb96de6 Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Thu, 30 Apr 2020 17:00:21 +0200 Subject: [PATCH 1/4] Removed useless local variables --- commands/upload/upload.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/commands/upload/upload.go b/commands/upload/upload.go index c373c9b049f..147b0e0da30 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")) From 3e5ea50e7846f08e7a5e322ed786710a9442775b Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Thu, 7 May 2020 13:47:49 +0200 Subject: [PATCH 2/4] Added some more verbosity on upload --- commands/upload/upload.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/commands/upload/upload.go b/commands/upload/upload.go index 147b0e0da30..4b68dd4eb25 100644 --- a/commands/upload/upload.go +++ b/commands/upload/upload.go @@ -189,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) @@ -207,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 == "" { @@ -238,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) From 2a15bbaf8254d10c8882a18ab5eb6db28134f38a Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Thu, 9 Apr 2020 15:49:53 +0200 Subject: [PATCH 3/4] Added FQBN.StringWithoutConfig() method --- arduino/cores/fqbn.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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 +} From 3f83b112dd8b738bf86c4ebc555ec2304bf72307 Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Wed, 6 May 2020 15:59:20 +0200 Subject: [PATCH 4/4] Use fqbn.StringWithoutConfig() specific function --- commands/compile/compile.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) 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