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