Skip to content

Commit 84835f9

Browse files
author
Alberto Iannaccone
committed
move uploadSketch in boardConfiguration
1 parent 0df7d76 commit 84835f9

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
@@ -140,6 +140,33 @@ export default class BoardConfiguration {
140140
return storing.finally(() => this.serialMessagesSubscription.unsubscribe());
141141
}
142142

143+
uploadSketch(compiledSketch, board) {
144+
const uploadTarget = {
145+
board: board.fqbn,
146+
port: board.port,
147+
network: false
148+
};
149+
150+
const file = {
151+
name: compiledSketch.name + board.upload[0].ext,
152+
data: compiledSketch.hex
153+
};
154+
155+
const uploadData = {
156+
files: [file],
157+
commandline: board.upload[0].commandline,
158+
signature: board.upload[0].options.signature,
159+
extrafiles: [],
160+
options: {
161+
wait_for_upload_port: (board.upload[0].options.wait_for_upload_port === true || board.upload[0].options.wait_for_upload_port === 'true'),
162+
use_1200bps_touch: (board.upload[0].options.use_1200bps_touch === true || board.upload[0].options.use_1200bps_touch === 'true'),
163+
params_verbose: '-v'
164+
}
165+
};
166+
167+
this.daemon.upload(uploadTarget, uploadData);
168+
}
169+
143170
/**
144171
* Uploads the sketch and performs action in order to configure the board for Arduino Cloud
145172
* @param {Object} compiledSketch the Object containing the provisioning sketch, ready to be compiled
@@ -218,6 +245,6 @@ export default class BoardConfiguration {
218245
});
219246

220247
this.daemon.initUpload();
221-
this.daemon.uploadSketch(compiledSketch, board);
248+
this.uploadSketch(compiledSketch, board);
222249
}
223250
}

src/daemon.js

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

97-
uploadSketch(compiledSketch, board) {
98-
const uploadTarget = {
99-
board: board.fqbn,
100-
port: board.port,
101-
network: false
102-
};
103-
104-
const file = {
105-
name: compiledSketch.name + board.upload[0].ext,
106-
data: compiledSketch.hex
107-
};
108-
109-
const uploadData = {
110-
files: [file],
111-
commandline: board.upload[0].commandline,
112-
signature: board.upload[0].options.signature,
113-
extrafiles: [],
114-
options: {
115-
wait_for_upload_port: (board.upload[0].options.wait_for_upload_port === true || board.upload[0].options.wait_for_upload_port === 'true'),
116-
use_1200bps_touch: (board.upload[0].options.use_1200bps_touch === true || board.upload[0].options.use_1200bps_touch === 'true'),
117-
params_verbose: '-v'
118-
}
119-
};
120-
121-
this.upload(uploadTarget, uploadData);
122-
}
123-
12497
initUpload() {
12598
this.uploading.next({ status: this.UPLOAD_NOPE });
12699
}

src/index.js

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

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

37-
export { BoardConfiguration };
37+
export { Daemon, BoardConfiguration };
3838
export default Daemon;

0 commit comments

Comments
 (0)