mirror of
https://github.com/arduino/arduino-ide.git
synced 2025-07-30 14:46:34 +00:00
Changed upload settings
This commit is contained in:
parent
116b3d5984
commit
2c95e7f033
@ -60,9 +60,15 @@ export class BurnBootloader extends SketchContribution {
|
|||||||
this.preferences.get('arduino.upload.verify'),
|
this.preferences.get('arduino.upload.verify'),
|
||||||
this.preferences.get('arduino.upload.verbose'),
|
this.preferences.get('arduino.upload.verbose'),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
const board = {
|
||||||
|
...boardsConfig.selectedBoard,
|
||||||
|
name: boardsConfig.selectedBoard?.name || '',
|
||||||
|
fqbn,
|
||||||
|
}
|
||||||
this.outputChannelManager.getChannel('Arduino').clear();
|
this.outputChannelManager.getChannel('Arduino').clear();
|
||||||
await this.coreService.burnBootloader({
|
await this.coreService.burnBootloader({
|
||||||
fqbn,
|
board,
|
||||||
programmer,
|
programmer,
|
||||||
port,
|
port,
|
||||||
verify,
|
verify,
|
||||||
|
@ -226,6 +226,11 @@ export class UploadSketch extends SketchContribution {
|
|||||||
this.sourceOverride(),
|
this.sourceOverride(),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
const board = {
|
||||||
|
...boardsConfig.selectedBoard,
|
||||||
|
name: boardsConfig.selectedBoard?.name || '',
|
||||||
|
fqbn,
|
||||||
|
}
|
||||||
let options: CoreService.Upload.Options | undefined = undefined;
|
let options: CoreService.Upload.Options | undefined = undefined;
|
||||||
const sketchUri = sketch.uri;
|
const sketchUri = sketch.uri;
|
||||||
const optimizeForDebug = this.editorMode.compileForDebug;
|
const optimizeForDebug = this.editorMode.compileForDebug;
|
||||||
@ -247,7 +252,7 @@ export class UploadSketch extends SketchContribution {
|
|||||||
const programmer = selectedProgrammer;
|
const programmer = selectedProgrammer;
|
||||||
options = {
|
options = {
|
||||||
sketchUri,
|
sketchUri,
|
||||||
fqbn,
|
board,
|
||||||
optimizeForDebug,
|
optimizeForDebug,
|
||||||
programmer,
|
programmer,
|
||||||
port,
|
port,
|
||||||
@ -259,7 +264,7 @@ export class UploadSketch extends SketchContribution {
|
|||||||
} else {
|
} else {
|
||||||
options = {
|
options = {
|
||||||
sketchUri,
|
sketchUri,
|
||||||
fqbn,
|
board,
|
||||||
optimizeForDebug,
|
optimizeForDebug,
|
||||||
port,
|
port,
|
||||||
verbose,
|
verbose,
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { BoardUserField } from '.';
|
import { BoardUserField } from '.';
|
||||||
import { Port } from '../../common/protocol/boards-service';
|
import { Board, Port } from '../../common/protocol/boards-service';
|
||||||
import { Programmer } from './boards-service';
|
import { Programmer } from './boards-service';
|
||||||
|
|
||||||
export const CompilerWarningLiterals = [
|
export const CompilerWarningLiterals = [
|
||||||
@ -33,7 +33,7 @@ export namespace CoreService {
|
|||||||
* `file` URI to the sketch folder.
|
* `file` URI to the sketch folder.
|
||||||
*/
|
*/
|
||||||
readonly sketchUri: string;
|
readonly sketchUri: string;
|
||||||
readonly fqbn?: string | undefined;
|
readonly board?: Board;
|
||||||
readonly optimizeForDebug: boolean;
|
readonly optimizeForDebug: boolean;
|
||||||
readonly verbose: boolean;
|
readonly verbose: boolean;
|
||||||
readonly sourceOverride: Record<string, string>;
|
readonly sourceOverride: Record<string, string>;
|
||||||
@ -42,7 +42,7 @@ export namespace CoreService {
|
|||||||
|
|
||||||
export namespace Upload {
|
export namespace Upload {
|
||||||
export interface Options extends Compile.Options {
|
export interface Options extends Compile.Options {
|
||||||
readonly port?: Port | undefined;
|
readonly port?: Port;
|
||||||
readonly programmer?: Programmer | undefined;
|
readonly programmer?: Programmer | undefined;
|
||||||
readonly verify: boolean;
|
readonly verify: boolean;
|
||||||
readonly userFields: BoardUserField[];
|
readonly userFields: BoardUserField[];
|
||||||
@ -51,8 +51,8 @@ export namespace CoreService {
|
|||||||
|
|
||||||
export namespace Bootloader {
|
export namespace Bootloader {
|
||||||
export interface Options {
|
export interface Options {
|
||||||
readonly fqbn?: string | undefined;
|
readonly board?: Board;
|
||||||
readonly port?: Port | undefined;
|
readonly port?: Port;
|
||||||
readonly programmer?: Programmer | undefined;
|
readonly programmer?: Programmer | undefined;
|
||||||
readonly verbose: boolean;
|
readonly verbose: boolean;
|
||||||
readonly verify: boolean;
|
readonly verify: boolean;
|
||||||
|
@ -24,7 +24,7 @@ import { ArduinoCoreServiceClient } from './cli-protocol/cc/arduino/cli/commands
|
|||||||
import { firstToUpperCase, firstToLowerCase } from '../common/utils';
|
import { firstToUpperCase, firstToLowerCase } from '../common/utils';
|
||||||
import { Port } from './cli-protocol/cc/arduino/cli/commands/v1/port_pb';
|
import { Port } from './cli-protocol/cc/arduino/cli/commands/v1/port_pb';
|
||||||
import { nls } from '@theia/core';
|
import { nls } from '@theia/core';
|
||||||
import { SerialService } from './../common/protocol/serial-service';
|
import { MonitorManager } from './monitor-manager';
|
||||||
|
|
||||||
@injectable()
|
@injectable()
|
||||||
export class CoreServiceImpl extends CoreClientAware implements CoreService {
|
export class CoreServiceImpl extends CoreClientAware implements CoreService {
|
||||||
@ -34,8 +34,8 @@ export class CoreServiceImpl extends CoreClientAware implements CoreService {
|
|||||||
@inject(NotificationServiceServer)
|
@inject(NotificationServiceServer)
|
||||||
protected readonly notificationService: NotificationServiceServer;
|
protected readonly notificationService: NotificationServiceServer;
|
||||||
|
|
||||||
@inject(SerialService)
|
@inject(MonitorManager)
|
||||||
protected readonly serialService: SerialService;
|
protected readonly monitorManager: MonitorManager;
|
||||||
|
|
||||||
protected uploading = false;
|
protected uploading = false;
|
||||||
|
|
||||||
@ -45,7 +45,7 @@ export class CoreServiceImpl extends CoreClientAware implements CoreService {
|
|||||||
compilerWarnings?: CompilerWarnings;
|
compilerWarnings?: CompilerWarnings;
|
||||||
}
|
}
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
const { sketchUri, fqbn, compilerWarnings } = options;
|
const { sketchUri, board, compilerWarnings } = options;
|
||||||
const sketchPath = FileUri.fsPath(sketchUri);
|
const sketchPath = FileUri.fsPath(sketchUri);
|
||||||
|
|
||||||
await this.coreClientProvider.initialized;
|
await this.coreClientProvider.initialized;
|
||||||
@ -55,8 +55,8 @@ export class CoreServiceImpl extends CoreClientAware implements CoreService {
|
|||||||
const compileReq = new CompileRequest();
|
const compileReq = new CompileRequest();
|
||||||
compileReq.setInstance(instance);
|
compileReq.setInstance(instance);
|
||||||
compileReq.setSketchPath(sketchPath);
|
compileReq.setSketchPath(sketchPath);
|
||||||
if (fqbn) {
|
if (board?.fqbn) {
|
||||||
compileReq.setFqbn(fqbn);
|
compileReq.setFqbn(board.fqbn);
|
||||||
}
|
}
|
||||||
if (compilerWarnings) {
|
if (compilerWarnings) {
|
||||||
compileReq.setWarnings(compilerWarnings.toLowerCase());
|
compileReq.setWarnings(compilerWarnings.toLowerCase());
|
||||||
@ -139,11 +139,9 @@ export class CoreServiceImpl extends CoreClientAware implements CoreService {
|
|||||||
await this.compile(Object.assign(options, { exportBinaries: false }));
|
await this.compile(Object.assign(options, { exportBinaries: false }));
|
||||||
|
|
||||||
this.uploading = true;
|
this.uploading = true;
|
||||||
this.serialService.uploadInProgress = true;
|
const { sketchUri, board, port, programmer } = options;
|
||||||
|
await this.monitorManager.notifyUploadStarted(board, port);
|
||||||
|
|
||||||
await this.serialService.disconnect();
|
|
||||||
|
|
||||||
const { sketchUri, fqbn, port, programmer } = options;
|
|
||||||
const sketchPath = FileUri.fsPath(sketchUri);
|
const sketchPath = FileUri.fsPath(sketchUri);
|
||||||
|
|
||||||
await this.coreClientProvider.initialized;
|
await this.coreClientProvider.initialized;
|
||||||
@ -153,8 +151,8 @@ export class CoreServiceImpl extends CoreClientAware implements CoreService {
|
|||||||
const req = requestProvider();
|
const req = requestProvider();
|
||||||
req.setInstance(instance);
|
req.setInstance(instance);
|
||||||
req.setSketchPath(sketchPath);
|
req.setSketchPath(sketchPath);
|
||||||
if (fqbn) {
|
if (board?.fqbn) {
|
||||||
req.setFqbn(fqbn);
|
req.setFqbn(board.fqbn);
|
||||||
}
|
}
|
||||||
const p = new Port();
|
const p = new Port();
|
||||||
if (port) {
|
if (port) {
|
||||||
@ -209,23 +207,22 @@ export class CoreServiceImpl extends CoreClientAware implements CoreService {
|
|||||||
throw new Error(errorMessage);
|
throw new Error(errorMessage);
|
||||||
} finally {
|
} finally {
|
||||||
this.uploading = false;
|
this.uploading = false;
|
||||||
this.serialService.uploadInProgress = false;
|
this.monitorManager.notifyUploadFinished(board, port);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async burnBootloader(options: CoreService.Bootloader.Options): Promise<void> {
|
async burnBootloader(options: CoreService.Bootloader.Options): Promise<void> {
|
||||||
this.uploading = true;
|
this.uploading = true;
|
||||||
this.serialService.uploadInProgress = true;
|
const { board, port, programmer } = options;
|
||||||
await this.serialService.disconnect();
|
await this.monitorManager.notifyUploadStarted(board, port);
|
||||||
|
|
||||||
await this.coreClientProvider.initialized;
|
await this.coreClientProvider.initialized;
|
||||||
const coreClient = await this.coreClient();
|
const coreClient = await this.coreClient();
|
||||||
const { client, instance } = coreClient;
|
const { client, instance } = coreClient;
|
||||||
const { fqbn, port, programmer } = options;
|
|
||||||
const burnReq = new BurnBootloaderRequest();
|
const burnReq = new BurnBootloaderRequest();
|
||||||
burnReq.setInstance(instance);
|
burnReq.setInstance(instance);
|
||||||
if (fqbn) {
|
if (board?.fqbn) {
|
||||||
burnReq.setFqbn(fqbn);
|
burnReq.setFqbn(board.fqbn);
|
||||||
}
|
}
|
||||||
const p = new Port();
|
const p = new Port();
|
||||||
if (port) {
|
if (port) {
|
||||||
@ -267,7 +264,7 @@ export class CoreServiceImpl extends CoreClientAware implements CoreService {
|
|||||||
throw new Error(errorMessage);
|
throw new Error(errorMessage);
|
||||||
} finally {
|
} finally {
|
||||||
this.uploading = false;
|
this.uploading = false;
|
||||||
this.serialService.uploadInProgress = false;
|
await this.monitorManager.notifyUploadFinished(board, port);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user