Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#1032 failing upload flag for monitor mgr #1040

Merged
merged 28 commits into from
Jun 22, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
d10181b
1032 failing upload flag for monitor mgr
davegarthsimpson Jun 10, 2022
eed8a69
move upload failure fix logic to frontend
davegarthsimpson Jun 13, 2022
fff6075
misc corrections
davegarthsimpson Jun 13, 2022
cc12bc0
avoid starting monitor when upload is in progress
Jun 14, 2022
209ac69
avoid starting monitor when upload is in progress
Jun 14, 2022
9585991
Merge branch '1032-uploads-failing-with-monitor-open' of https://gith…
davegarthsimpson Jun 14, 2022
48b9c4d
prevent monitor side effects on upload (WIP)
davegarthsimpson Jun 15, 2022
01604ee
send upload req after notifying mgr
davegarthsimpson Jun 15, 2022
1e7fbf1
Merge branch 'main' into 1032-uploads-failing-with-monitor-open
davegarthsimpson Jun 15, 2022
2d5dff2
dispose instead of pause on upld (code not final)
davegarthsimpson Jun 15, 2022
89e51cb
Revert "dispose instead of pause on upld (code not final)"
davegarthsimpson Jun 16, 2022
a9d968c
force wait before upload (test)
davegarthsimpson Jun 16, 2022
bd02a19
always start queued services after uplaod finishes
Jun 16, 2022
97bdb78
test cli with monitor close delay
davegarthsimpson Jun 16, 2022
a562f0c
clean up unnecessary await(s)
davegarthsimpson Jun 17, 2022
725c0fb
remove unused dependency
davegarthsimpson Jun 17, 2022
6d1e930
Merge branch 'main' into 1032-uploads-failing-with-monitor-open
davegarthsimpson Jun 17, 2022
6710f35
revert CLI to 0.23
davegarthsimpson Jun 17, 2022
5260a07
use master cli for testing, await in upload finish
davegarthsimpson Jun 17, 2022
1678da7
remove upload port from pending monitor requests
davegarthsimpson Jun 17, 2022
37f7311
fix startQueuedServices
davegarthsimpson Jun 17, 2022
99dfd4e
refinements queued monitors
davegarthsimpson Jun 17, 2022
6e264a6
clean up monitor mgr state
davegarthsimpson Jun 17, 2022
c892ce3
fix typo from prev cleanup
davegarthsimpson Jun 19, 2022
a7c8806
avoid dupl queued monitor services
davegarthsimpson Jun 19, 2022
3830ba2
variable name changes
davegarthsimpson Jun 21, 2022
fbf3fc6
Merge branch 'main' into 1032-uploads-failing-with-monitor-open
davegarthsimpson Jun 21, 2022
095bbd9
reference latest cli commit in package.json
davegarthsimpson Jun 21, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions arduino-ide-extension/src/browser/contributions/upload-sketch.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { inject, injectable } from '@theia/core/shared/inversify';
import { Emitter } from '@theia/core/lib/common/event';
import { BoardUserField, CoreService } from '../../common/protocol';
import {
BoardUserField,
CoreService,
MonitorManagerProxyClient,
} from '../../common/protocol';
import { ArduinoMenus, PlaceholderMenuNode } from '../menu/arduino-menus';
import { ArduinoToolbar } from '../toolbar/arduino-toolbar';
import { BoardsDataStore } from '../boards/boards-data-store';
Expand Down Expand Up @@ -34,6 +38,9 @@ export class UploadSketch extends SketchContribution {
@inject(UserFieldsDialog)
protected readonly userFieldsDialog: UserFieldsDialog;

@inject(MonitorManagerProxyClient)
protected readonly monitorManagerProxyClient: MonitorManagerProxyClient;

protected cachedUserFields: Map<string, BoardUserField[]> = new Map();

protected readonly onDidChangeEmitter = new Emitter<Readonly<void>>();
Expand Down Expand Up @@ -204,6 +211,13 @@ export class UploadSketch extends SketchContribution {
// toggle the toolbar button and menu item state.
// uploadInProgress will be set to false whether the upload fails or not
this.uploadInProgress = true;

// here we inform the "monitorManagerProxyClient" an upload is in progress,
// setting a boolean flag, this is to prevent triggering of the
// "usual side effects" if a serial port change occurs during upload
// (expected on windows for some boards)
this.monitorManagerProxyClient.setUploadInProgress(true);
davegarthsimpson marked this conversation as resolved.
Show resolved Hide resolved

this.onDidChangeEmitter.fire();
const sketch = await this.sketchServiceClient.currentSketch();
if (!CurrentSketch.isValid(sketch)) {
Expand All @@ -227,7 +241,7 @@ export class UploadSketch extends SketchContribution {
...boardsConfig.selectedBoard,
name: boardsConfig.selectedBoard?.name || '',
fqbn,
}
};
let options: CoreService.Upload.Options | undefined = undefined;
const sketchUri = sketch.uri;
const optimizeForDebug = this.editorMode.compileForDebug;
Expand Down Expand Up @@ -290,6 +304,9 @@ export class UploadSketch extends SketchContribution {
this.messageService.error(errorMessage);
} finally {
this.uploadInProgress = false;

this.monitorManagerProxyClient.setUploadInProgress(false);

this.onDidChangeEmitter.fire();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ export class MonitorManagerProxyClientImpl
private lastConnectedBoard: BoardsConfig.Config;
private onBoardsConfigChanged: Disposable | undefined;

private uploadInProgress = false;

getWebSocketPort(): number | undefined {
return this.wsPort;
}
Expand Down Expand Up @@ -135,7 +137,9 @@ export class MonitorManagerProxyClientImpl
this.onBoardsConfigChanged =
this.boardsServiceProvider.onBoardsConfigChanged(
async ({ selectedBoard, selectedPort }) => {
const changeTriggeredDuringUpload = this.uploadInProgress;
if (
changeTriggeredDuringUpload ||
typeof selectedBoard === 'undefined' ||
typeof selectedPort === 'undefined'
)
Expand Down Expand Up @@ -196,4 +200,8 @@ export class MonitorManagerProxyClientImpl
})
);
}

public setUploadInProgress(value: boolean): void {
this.uploadInProgress = value;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export interface MonitorManagerProxyClient {
getCurrentSettings(board: Board, port: Port): Promise<MonitorSettings>;
send(message: string): void;
changeSettings(settings: MonitorSettings): void;
setUploadInProgress(value: boolean): void;
davegarthsimpson marked this conversation as resolved.
Show resolved Hide resolved
}

export interface PluggableMonitorSetting {
Expand Down