Update: WebSocket模式添加对Serial和Arduino编译上传的支持
This commit is contained in:
48
src/common/shell-arduino.js
Normal file
48
src/common/shell-arduino.js
Normal file
@@ -0,0 +1,48 @@
|
||||
import _ from 'lodash';
|
||||
import Shell from './shell';
|
||||
import { ARDUINO } from './config';
|
||||
|
||||
|
||||
export default class ShellArduino extends Shell {
|
||||
constructor() {
|
||||
super();
|
||||
}
|
||||
|
||||
async compile(config) {
|
||||
let arduino = _.merge({}, ARDUINO);
|
||||
arduino = _.merge(arduino, config);
|
||||
const command = [
|
||||
`"${arduino.path.cli}"`,
|
||||
'compile',
|
||||
'-b', arduino.key,
|
||||
'--config-file', `"${arduino.path.config}"`,
|
||||
'--build-cache-path', `"${arduino.path.cache}"`,
|
||||
'--verbose',
|
||||
'--libraries', `"${arduino.path.libraries.join('","')}"`,
|
||||
'--build-path', `"${arduino.path.build}"`,
|
||||
`"${arduino.path.code}"`,
|
||||
'--no-color'
|
||||
].join(' ');
|
||||
return this.exec(command);
|
||||
}
|
||||
|
||||
async upload(config) {
|
||||
let arduino = _.merge({}, ARDUINO);
|
||||
arduino = _.merge(arduino, config);
|
||||
const command = [
|
||||
`"${arduino.path.cli}"`,
|
||||
'compile',
|
||||
'--upload',
|
||||
'-p', arduino.port,
|
||||
'-b', arduino.key,
|
||||
'--config-file', `"${arduino.path.config}"`,
|
||||
'--build-cache-path', `"${arduino.path.cache}"`,
|
||||
'--verbose',
|
||||
'--libraries', `"${arduino.path.libraries.join('","')}"`,
|
||||
'--build-path', `"${arduino.path.build}"`,
|
||||
`"${arduino.path.code}"`,
|
||||
'--no-color'
|
||||
].join(' ');
|
||||
return this.exec(command);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user