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

Pause UsbDetector during uploading #372

Merged
merged 6 commits into from Jul 20, 2017

Conversation

@codeworm96
Copy link
Contributor

codeworm96 commented Jul 17, 2017

Pause UsbDetector during uploading, so that the resetting of board during uploading will not trigger an annoying display of the board's README.

@msftclas

This comment has been minimized.

Copy link

msftclas commented Jul 17, 2017

@codeworm96,
Thanks for your contribution.
To ensure that the project team has proper rights to use your work, please complete the Contribution License Agreement at https://cla.microsoft.com.

It will cover your contributions to all Microsoft-managed open source projects.
Thanks,
Microsoft Pull Request Bot

@msftclas

This comment has been minimized.

Copy link

msftclas commented Jul 18, 2017

@codeworm96,
Thanks for your contribution as a Microsoft full-time employee or intern. You do not need to sign a CLA.
Thanks,
Microsoft Pull Request Bot

@@ -106,6 +117,20 @@ export class UsbDetector {
}
}

public pauseListening() {
if (this._usbDetector) {

This comment has been minimized.

Copy link
@yaohaizh

yaohaizh Jul 18, 2017

Contributor

Can we resume the existing stopListening/startListening? The two new APIs seems duplicate

This comment has been minimized.

Copy link
@codeworm96

codeworm96 Jul 18, 2017

Author Contributor

In fact, it is possible but the startListening() method needs to be modified. The current startListening() just sets the add event listener and does not explicitly start listening. It works previously just because the detector is default to be listening after initialization. startListening() cannot switch back the status of detector correctly yet.

My concern is that it may be unnecessary to set the add event listener again and again.

@@ -184,8 +183,8 @@ export async function activate(context: vscode.ExtensionContext) {
const completionProvider = new CompletionProvider();
context.subscriptions.push(vscode.languages.registerCompletionItemProvider(ARDUINO_MODE, completionProvider, "<", '"', "."));

usbDetector = new UsbDetector(context.extensionPath);
usbDetector.startListening();
UsbDetector.extensionRoot = context.extensionPath;

This comment has been minimized.

Copy link
@yaohaizh

yaohaizh Jul 18, 2017

Contributor

You can add Initialize(extensionRoot : string) method to UsbDector instance for passing value but not use the module to pass object value

This comment has been minimized.

Copy link
@codeworm96

codeworm96 Jul 18, 2017

Author Contributor

Good advice.


public static getInstance(): UsbDetector {
if (!UsbDetector._instance) {
UsbDetector._instance = new UsbDetector(UsbDetector.extensionRoot);

This comment has been minimized.

Copy link
@yaohaizh

yaohaizh Jul 18, 2017

Contributor

Should check the extensionRoot value carefully since there is no any explicit of the sequence of the calling order

This comment has been minimized.

Copy link
@codeworm96

codeworm96 Jul 18, 2017

Author Contributor

I am not sure what behavior should be if the assumption is violated. Can you give me some advice?

Yuning Zhang and others added 3 commits Jul 19, 2017
@yaohaizh yaohaizh merged commit f6e5343 into master Jul 20, 2017
1 check passed
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@codeworm96 codeworm96 deleted the feature/pause-detector branch Sep 22, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.