Skip to content

Commit 7e9dcfd

Browse files
author
Alberto Iannaccone
committed
move uploadSketch in boardConfiguration
1 parent 15efcb8 commit 7e9dcfd

File tree

3 files changed

+29
-29
lines changed

3 files changed

+29
-29
lines changed

src/boardConfiguration.js

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,33 @@ export default class BoardConfiguration {
131131
return storing.finally(() => this.serialMessagesSubscription.unsubscribe());
132132
}
133133

134+
uploadSketch(compiledSketch, board) {
135+
const uploadTarget = {
136+
board: board.fqbn,
137+
port: board.port,
138+
network: false
139+
};
140+
141+
const file = {
142+
name: compiledSketch.name + board.upload[0].ext,
143+
data: compiledSketch.hex
144+
};
145+
146+
const uploadData = {
147+
files: [file],
148+
commandline: board.upload[0].commandline,
149+
signature: board.upload[0].options.signature,
150+
extrafiles: [],
151+
options: {
152+
wait_for_upload_port: (board.upload[0].options.wait_for_upload_port === true || board.upload[0].options.wait_for_upload_port === 'true'),
153+
use_1200bps_touch: (board.upload[0].options.use_1200bps_touch === true || board.upload[0].options.use_1200bps_touch === 'true'),
154+
params_verbose: '-v'
155+
}
156+
};
157+
158+
this.daemon.upload(uploadTarget, uploadData);
159+
}
160+
134161
/**
135162
* Uploads the sketch and performs action in order to configure the board for Arduino Cloud
136163
* @param {Object} compiledSketch the Object containing the provisioning sketch, ready to be compiled
@@ -209,6 +236,6 @@ export default class BoardConfiguration {
209236
});
210237

211238
this.daemon.initUpload();
212-
this.daemon.uploadSketch(compiledSketch, board);
239+
this.uploadSketch(compiledSketch, board);
213240
}
214241
}

src/daemon.js

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -114,33 +114,6 @@ export default class Daemon {
114114
throw new Error('Stop Upload not supported on Chrome OS');
115115
}
116116

117-
uploadSketch(compiledSketch, board) {
118-
const uploadTarget = {
119-
board: board.fqbn,
120-
port: board.port,
121-
network: false
122-
};
123-
124-
const file = {
125-
name: compiledSketch.name + board.upload[0].ext,
126-
data: compiledSketch.hex
127-
};
128-
129-
const uploadData = {
130-
files: [file],
131-
commandline: board.upload[0].commandline,
132-
signature: board.upload[0].options.signature,
133-
extrafiles: [],
134-
options: {
135-
wait_for_upload_port: (board.upload[0].options.wait_for_upload_port === true || board.upload[0].options.wait_for_upload_port === 'true'),
136-
use_1200bps_touch: (board.upload[0].options.use_1200bps_touch === true || board.upload[0].options.use_1200bps_touch === 'true'),
137-
params_verbose: '-v'
138-
}
139-
};
140-
141-
this.upload(uploadTarget, uploadData);
142-
}
143-
144117
initUpload() {
145118
this.uploading.next({ status: this.UPLOAD_NOPE });
146119
}

src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,5 @@ import BoardConfiguration from './boardConfiguration';
2525

2626
const Daemon = window.navigator.userAgent.indexOf(' CrOS ') !== -1 ? ChromeOsDaemon : SocketDaemon;
2727

28-
export { BoardConfiguration };
28+
export { Daemon, BoardConfiguration };
2929
export default Daemon;

0 commit comments

Comments
 (0)