Skip to content

Commit 85e84e2

Browse files
committed
Removed now unused DumpAndFlash methods
1 parent 4c7be74 commit 85e84e2

File tree

2 files changed

+0
-75
lines changed

2 files changed

+0
-75
lines changed

Diff for: programmers/avrdude/avrdude.go

-42
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,13 @@ package avrdude
22

33
import (
44
"fmt"
5-
"io/ioutil"
65
"log"
76
"os"
8-
"path/filepath"
97
"time"
108

119
"github.com/arduino/FirmwareUpdater/utils/context"
1210
"github.com/arduino/arduino-cli/executils"
1311
"github.com/arduino/go-paths-helper"
14-
"github.com/pkg/errors"
1512
)
1613

1714
type Avrdude struct {
@@ -46,45 +43,6 @@ func (b *Avrdude) Flash(filename string) error {
4643
return err
4744
}
4845

49-
func (b *Avrdude) DumpAndFlash(filename string) (string, error) {
50-
dir, err := ioutil.TempDir("", "wifiFlasher_dump")
51-
if err != nil {
52-
return "", errors.WithMessage(err, "creating temp dir to store current sketch")
53-
}
54-
55-
log.Println("Reading existing sketch from the baord, to restore it later")
56-
err = b.invoke(
57-
fmt.Sprintf("-C%s", b.configPath),
58-
"-v",
59-
"-patmega4809",
60-
"-cxplainedmini_updi",
61-
"-Pusb",
62-
"-b115200",
63-
"-D",
64-
"-Uflash:r:"+filepath.Join(dir, "dump.bin")+":i")
65-
if err != nil {
66-
return "", err
67-
}
68-
log.Println("Original sketch saved at " + filepath.Join(dir, "dump.bin"))
69-
70-
log.Println("Flashing " + filename)
71-
err = b.invoke(
72-
fmt.Sprintf("-C%s", b.configPath),
73-
"-v",
74-
"-patmega4809",
75-
"-cxplainedmini_updi",
76-
"-Pusb",
77-
"-b115200",
78-
"-e",
79-
"-D",
80-
"-Uflash:w:"+filename+":i",
81-
"-Ufuse8:w:0x00:m")
82-
83-
time.Sleep(3 * time.Second)
84-
85-
return filepath.Join(dir, "dump.bin"), err
86-
}
87-
8846
func (b *Avrdude) invoke(args ...string) error {
8947
cmd, err := executils.NewProcessFromPath(b.avrdudePath, args...)
9048
if err != nil {

Diff for: programmers/bossac/bossac.go

-33
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
11
package bossac
22

33
import (
4-
"io/ioutil"
54
"log"
65
"os"
7-
"path/filepath"
86
"time"
97

108
"github.com/arduino/FirmwareUpdater/utils/context"
119
"github.com/arduino/arduino-cli/arduino/serialutils"
1210
"github.com/arduino/arduino-cli/executils"
1311
"github.com/arduino/go-paths-helper"
14-
"github.com/pkg/errors"
1512
)
1613

1714
type Bossac struct {
@@ -43,36 +40,6 @@ func (b *Bossac) Flash(filename string) error {
4340
return err
4441
}
4542

46-
func (b *Bossac) DumpAndFlash(ctx *context.Context, filename string) (string, error) {
47-
dir, err := ioutil.TempDir("", "wifiFlasher_dump")
48-
if err != nil {
49-
return "", errors.WithMessage(err, "creating temp dir to store current sketch")
50-
}
51-
52-
log.Println("Entering board into bootloader mode")
53-
port, err := serialutils.Reset(ctx.PortName, true)
54-
if err != nil {
55-
return "", err
56-
}
57-
58-
log.Println("Reading existing sketch from the baord, to restore it later")
59-
err = b.invoke("-u", "-r", "-p", port, filepath.Join(dir, "dump.bin"))
60-
61-
log.Println("Original sketch saved at " + filepath.Join(dir, "dump.bin"))
62-
if err != nil {
63-
return "", err
64-
}
65-
66-
log.Println("Flashing " + filename)
67-
err = b.invoke("-e", "-R", "-p", port, "-w", filename)
68-
69-
ctx.PortName, err = serialutils.WaitForNewSerialPortOrDefaultTo(port)
70-
log.Println("Board is back online " + ctx.PortName)
71-
time.Sleep(1 * time.Second)
72-
73-
return filepath.Join(dir, "dump.bin"), err
74-
}
75-
7643
func (b *Bossac) invoke(args ...string) error {
7744
cmd, err := executils.NewProcessFromPath(b.bossacPath, args...)
7845
if err != nil {

0 commit comments

Comments
 (0)