Skip to content

Commit

Permalink
Modify the parsing position of the library parameter according to the…
Browse files Browse the repository at this point in the history
… vm code changes.
  • Loading branch information
zhengyangliu committed Jul 10, 2024
1 parent fd2f3e5 commit f60b973
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions src/session/serialport.js
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ class SerialportSession extends Session {
}

async upload (params) {
const {message, config, encoding, library} = params;
const {message, config, encoding} = params;
const code = new Buffer.from(message, encoding).toString();

const {baudRate} = this.peripheralParams.peripheralConfig.config;
Expand All @@ -311,7 +311,7 @@ class SerialportSession extends Session {

try {
this.sendRemoteRequest('setUploadAbortEnabled', true);
const exitCode = await this.tool.build(code, library);
const exitCode = await this.tool.build(code);
if (exitCode === 'Success') {
try {
this.sendstd(`${ansi.clear}Disconnect serial port\n`);
Expand Down Expand Up @@ -342,7 +342,7 @@ class SerialportSession extends Session {
try {
this.sendRemoteRequest('setUploadAbortEnabled', true);
await this.disconnect();
const exitCode = await this.tool.flash(code, library);
const exitCode = await this.tool.flash(code);
await this.connect(this.peripheralParams, true);
await this.updateBaudrate({baudRate: 115200});
this.sendstd(`${ansi.clear}Reset device\n`);
Expand Down
6 changes: 3 additions & 3 deletions src/upload/arduino.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class Arduino {
this._abort = true;
}

build (code, library = []) {
build (code) {
return new Promise((resolve, reject) => {
if (!fs.existsSync(this._codeFolderPath)) {
fs.mkdirSync(this._codeFolderPath, {recursive: true});
Expand All @@ -95,9 +95,9 @@ class Arduino {
];

// if extensions library to not empty
library.forEach(lib => {
this._config.library.forEach(lib => {
if (fs.existsSync(lib)) {
args.splice(5, 0, '--libraries', lib);
args.splice(3, 0, '--libraries', lib);
}
});

Expand Down
4 changes: 2 additions & 2 deletions src/upload/microbit.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class Microbit {
this._abort = true;
}

async flash (code, library = []) {
async flash (code) {
const fileToPut = [];

if (!fs.existsSync(this._projectPath)) {
Expand All @@ -53,7 +53,7 @@ class Microbit {

fileToPut.push(this._codefilePath);

library.forEach(lib => {
this._config.library.forEach(lib => {
if (fs.existsSync(lib)) {
const libraries = fs.readdirSync(lib);
libraries.forEach(file => {
Expand Down

0 comments on commit f60b973

Please sign in to comment.