Skip to content
This repository was archived by the owner on Oct 1, 2024. It is now read-only.

Commit fd5927f

Browse files
committed
Merge branch 'main' into use-l4j-encoding
2 parents febb72e + 849de32 commit fd5927f

14 files changed

+144
-40
lines changed

.github/workflows/build.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ name: CI
66
on:
77
push:
88
branches:
9-
- master
10-
- dev
9+
- main
10+
- release
1111
tags:
1212
- v*
1313
pull_request:
1414
branches:
15-
- master
16-
- dev
15+
- main
16+
- release
1717

1818
jobs:
1919
build:

.github/workflows/fixed-issues.yml

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Close fixed issues
2+
3+
on:
4+
push:
5+
tags:
6+
- "v[0-9.]+"
7+
workflow_dispatch:
8+
9+
jobs:
10+
fixed:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/[email protected]
14+
with:
15+
days-before-stale: 0
16+
days-before-close: 0
17+
ignore-updates: true
18+
close-issue-message: >-
19+
This issue has been fixed in the latest release of this extension,
20+
which is available in the VS Code extension marketplace.
21+
stale-issue-label: fixed-pending-release
22+
only-labels: fixed-pending-release

CHANGELOG.md

+10
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
# Change Log
22
All notable changes to this project will be documented in this file.
33

4+
## Version 0.4.9
5+
6+
- Release date: January 12, 2022
7+
8+
### Changed
9+
10+
- vid and pid for Adafruit Grand Central M4 (SAMD51) [#1218](https://github.com/microsoft/vscode-arduino/pull/1218)
11+
- Add clear output on build option [#1057](https://github.com/microsoft/vscode-arduino/pull/1057)
12+
- Added buffering to prevent heavy logging issues [#1412](https://github.com/microsoft/vscode-arduino/pull/1412)
13+
414
## Version 0.4.8
515

616
- Release date: November 9, 2021

CONTRIBUTING.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ There are many ways that you can contribute, beyond writing code. The goal of th
88

99
If you are interested in writing code to fix issues, first look at the issues with the [help-wanted](https://github.com/Microsoft/vscode-arduino/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22) label. They should have the context and code pointers needed to get started. If not, then feel free to ask for some, and we will be happy to provide any guidance you need.
1010

11-
When you are doing code fix, please work against [dev](https://github.com/microsoft/vscode-arduino/tree/dev)
12-
branch and also submit pull request to `dev` branch.
13-
Changes will be merged into `master` branch after production release.
11+
When you are doing code fix, please work against [main](https://github.com/microsoft/vscode-arduino/tree/main)
12+
branch and also submit pull request to `main` branch.
13+
Changes will be merged into `release` branch after production release.
1414

1515

1616

README.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# Visual Studio Code extension for Arduino
22

33
[![Gitter](https://img.shields.io/badge/chat-on%20gitter-blue.svg)](https://gitter.im/Microsoft/vscode-arduino)
4-
[![Travis CI](https://travis-ci.org/Microsoft/vscode-arduino.svg?branch=master)](https://travis-ci.org/Microsoft/vscode-arduino)
54

65
Welcome to the Visual Studio Code extension for **Arduino** <sup>preview</sup> ! The Arduino extension makes it easy to develop, build, deploy and debug your Arduino sketches in Visual Studio Code, with a rich set of functionalities. These include:
76

@@ -74,7 +73,8 @@ This extension provides several commands in the Command Palette (<kbd>F1</kbd> o
7473
| `arduino.commandPath` | Path to an executable (or script) relative to `arduino.path`. The default value is `arduino_debug.exe` for Windows, `Contents/MacOS/Arduino` for Mac and `arduino` for Linux, You also can use a custom launch script to run Arduino by modifying this setting. (Requires a restart after change) Example: `run-arduino.bat` for Windows, `Contents/MacOS/run-arduino.sh` for Mac and `bin/run-arduino.sh` for Linux. |
7574
| `arduino.additionalUrls` | Additional Boards Manager URLs for 3rd party packages. You can have multiple URLs in one string with a comma(`,`) as separator, or have a string array. The default value is empty. |
7675
| `arduino.logLevel` | CLI output log level. Could be info or verbose. The default value is `"info"`. |
77-
| `arduino.allowPDEFiletype` | Allow the VSCode Arduino extension to open .pde files from pre-1.0.0 versions of Arduino. Note that this will break Processing code. Default value is `false`. |
76+
| `arduino.clearOutputOnBuild` | Clear the output logs before uploading or verifying. Default value is `false`. |
77+
| `arduino.allowPDEFiletype` | Allow the VSCode Arduino extension to open .pde files from pre-1.0.0 versions of Arduino. Note that this will break Processing code. Default value is `false`. |
7878
| `arduino.enableUSBDetection` | Enable/disable USB detection from the VSCode Arduino extension. The default value is `true`. When your device is plugged in to your computer, it will pop up a message "`Detected board ****, Would you like to switch to this board type`". After clicking the `Yes` button, it will automatically detect which serial port (COM) is connected a USB device. If your device does not support this feature, please provide us with the PID/VID of your device; the code format is defined in `misc/usbmapping.json`.To learn more about how to list the vid/pid, use the following tools: https://github.com/EmergingTechnologyAdvisors/node-serialport `npm install -g serialport` `serialport-list -f jsonline`|
7979
| `arduino.disableTestingOpen` | Enable/disable automatic sending of a test message to the serial port for checking the open status. The default value is `false` (a test message will be sent). |
8080
| `arduino.skipHeaderProvider` | Enable/disable the extension providing completion items for headers. This functionality is included in newer versions of the C++ extension. The default value is `false`.|
@@ -120,7 +120,7 @@ The following settings are as per sketch settings of the Arduino extension. You
120120
- `port` - Name of the serial port connected to the device. Can be set by the `Arduino: Select Serial Port` command. For Mac users could be "/dev/cu.wchusbserial1420".
121121
- `board` - Currently selected Arduino board alias. Can be set by the `Arduino: Change Board Type` command. Also, you can find the board list there.
122122
- `output` - Arduino build output path. If not set, Arduino will create a new temporary output folder each time, which means it cannot reuse the intermediate result of the previous build leading to long verify/upload time, so it is recommended to set the field. Arduino requires that the output path should not be the workspace itself or in a subfolder of the workspace, otherwise, it may not work correctly. By default, this option is not set. It's worth noting that the contents of this file could be deleted during the build process, so pick (or create) a directory that will not store files you want to keep.
123-
- `debugger` - The short name of the debugger that will be used when the board itself does not have a debugger and there is more than one debugger available. You can find the list of debuggers [here](https://github.com/Microsoft/vscode-arduino/blob/master/misc/debuggerUsbMapping.json). By default, this option is not set.
123+
- `debugger` - The short name of the debugger that will be used when the board itself does not have a debugger and there is more than one debugger available. You can find the list of debuggers [here](https://github.com/Microsoft/vscode-arduino/blob/release/misc/debuggerUsbMapping.json). By default, this option is not set.
124124
- `prebuild` - External command which will be invoked before any sketch build (verify, upload, ...). For details see the [Pre- and Post-Build Commands](#Pre--and-Post-Build-Commands) section.
125125
- `postbuild` - External command to be run after the sketch has been built successfully. See the afore mentioned section for more details.
126126
- `intelliSenseGen` - Override the global setting for auto-generation of the IntelliSense configuration (i.e. `.vscode/c_cpp_properties.json`). Three options are available:
@@ -203,7 +203,7 @@ Steps to start debugging:
203203
> To learn more about how to debug Arduino code, visit our [team blog](https://blogs.msdn.microsoft.com/iotdev/2017/05/27/debug-your-arduino-code-with-visual-studio-code/).
204204
205205
## Change Log
206-
See the [Change log](https://github.com/Microsoft/vscode-arduino/blob/master/CHANGELOG.md) for details about the changes in each version.
206+
See the [Change log](https://github.com/Microsoft/vscode-arduino/blob/release/CHANGELOG.md) for details about the changes in each version.
207207

208208
## Supported Operating Systems
209209
Currently this extension supports the following operating systems:
@@ -241,7 +241,7 @@ This project has adopted the [Microsoft Open Source Code of Conduct](https://ope
241241
The [Microsoft Enterprise and Developer Privacy Statement](https://www.microsoft.com/en-us/privacystatement/EnterpriseDev/default.aspx) describes the privacy statement of this software.
242242

243243
## License
244-
This extension is licensed under the [MIT License](https://github.com/Microsoft/vscode-arduino/blob/master/LICENSE.txt). Please see the [Third Party Notice](https://github.com/Microsoft/vscode-arduino/blob/master/ThirdPartyNotices.txt) file for additional copyright notices and terms.
244+
This extension is licensed under the [MIT License](https://github.com/Microsoft/vscode-arduino/blob/release/LICENSE.txt). Please see the [Third Party Notice](https://github.com/Microsoft/vscode-arduino/blob/release/ThirdPartyNotices.txt) file for additional copyright notices and terms.
245245

246246
## Contact Us
247247
If you would like to help build the best Arduino experience with VS Code, you can reach us directly at [gitter chat room](https://gitter.im/Microsoft/vscode-arduino).

azure-pipelines.yml

+7-7
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ parameters:
1414
- real
1515

1616
pr:
17-
- master
18-
- dev
17+
- main
18+
- release
1919

2020
trigger:
2121
branches:
2222
include:
23-
- master
24-
- dev
23+
- main
24+
- release
2525
tags:
2626
include:
2727
- v*
@@ -33,12 +33,12 @@ variables:
3333
# MicroBuild requires TeamName to be set.
3434
TeamName: C++ Cross Platform and Cloud
3535
# If the user didn't override the signing type, then only real-sign on tags,
36-
# master, or dev.
36+
# main, or release.
3737
${{ if ne(parameters.SignTypeOverride, 'default') }}:
3838
SignType: ${{ parameters.SignTypeOverride }}
39-
${{ if and(eq(parameters.SignTypeOverride, 'default'), or(startsWith(variables['Build.SourceBranch'], 'refs/tags'), eq(variables['Build.SourceBranchName'], 'master'), eq(variables['Build.SourceBranchName'], 'dev'))) }}:
39+
${{ if and(eq(parameters.SignTypeOverride, 'default'), or(startsWith(variables['Build.SourceBranch'], 'refs/tags'), eq(variables['Build.SourceBranchName'], 'main'), eq(variables['Build.SourceBranchName'], 'release'))) }}:
4040
SignType: real
41-
${{ if and(eq(parameters.SignTypeOverride, 'default'), not(or(startsWith(variables['Build.SourceBranch'], 'refs/tags'), eq(variables['Build.SourceBranchName'], 'master'), eq(variables['Build.SourceBranchName'], 'dev')))) }}:
41+
${{ if and(eq(parameters.SignTypeOverride, 'default'), not(or(startsWith(variables['Build.SourceBranch'], 'refs/tags'), eq(variables['Build.SourceBranchName'], 'main'), eq(variables['Build.SourceBranchName'], 'release')))) }}:
4242
SignType: test
4343

4444
steps:

package-lock.json

+3-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+7-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "vscode-arduino",
33
"displayName": "Arduino",
44
"description": "Arduino for Visual Studio Code",
5-
"version": "0.4.8",
5+
"version": "0.4.9",
66
"publisher": "vsciot-vscode",
77
"aiKey": "83dd2c27-6594-41d3-85a9-bdb22070eb42",
88
"preview": true,
@@ -18,7 +18,7 @@
1818
"bugs": {
1919
"url": "https://github.com/Microsoft/vscode-arduino/issues"
2020
},
21-
"homepage": "https://github.com/Microsoft/vscode-arduino/blob/master/README.md",
21+
"homepage": "https://github.com/Microsoft/vscode-arduino/blob/release/README.md",
2222
"categories": [
2323
"Programming Languages",
2424
"Debuggers",
@@ -496,6 +496,11 @@
496496
"verbose"
497497
]
498498
},
499+
"arduino.clearOutputOnBuild": {
500+
"type": "boolean",
501+
"default": false,
502+
"description": "Clear the output logs before uploading or verifying."
503+
},
499504
"arduino.openPDEFiletype": {
500505
"type": "boolean",
501506
"default": false,

src/arduino/arduino.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -596,13 +596,10 @@ export class ArduinoApp {
596596
} else {
597597
args.push("--upload",
598598
"--useprogrammer",
599-
"--pref", `programmer=arduino:${programmer}`);
599+
"--pref", `programmer=${programmer}`);
600600
}
601601

602602
args.push("--port", dc.port);
603-
if (!this.useArduinoCli()) {
604-
args.push("--verify");
605-
}
606603
} else if (buildMode === BuildMode.CliUploadProgrammer) {
607604
const programmer = this.programmerManager.currentProgrammer;
608605
if (!programmer) {
@@ -650,6 +647,9 @@ export class ArduinoApp {
650647
// we prepare the channel here since all following code will
651648
// or at leas can possibly output to it
652649
arduinoChannel.show();
650+
if (VscodeSettings.getInstance().clearOutputOnBuild) {
651+
arduinoChannel.clear();
652+
}
653653
arduinoChannel.start(`${buildMode} sketch '${dc.sketch}'`);
654654

655655
if (buildDir || dc.output) {

src/arduino/vscodeSettings.ts

+6
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ const configKeys = {
88
ARDUINO_COMMAND_PATH: "arduino.commandPath",
99
ADDITIONAL_URLS: "arduino.additionalUrls",
1010
LOG_LEVEL: "arduino.logLevel",
11+
CLEAR_OUTPUT_ON_START: "arduino.clearOutputOnBuild",
1112
AUTO_UPDATE_INDEX_FILES: "arduino.autoUpdateIndexFiles",
1213
ALLOW_PDE_FILETYPE: "arduino.allowPDEFiletype",
1314
ENABLE_USB_DETECTION: "arduino.enableUSBDetection",
@@ -24,6 +25,7 @@ export interface IVscodeSettings {
2425
commandPath: string;
2526
additionalUrls: string | string[];
2627
logLevel: string;
28+
clearOutputOnBuild: boolean;
2729
allowPDEFiletype: boolean;
2830
enableUSBDetection: boolean;
2931
disableTestingOpen: boolean;
@@ -63,6 +65,10 @@ export class VscodeSettings implements IVscodeSettings {
6365
return this.getConfigValue<string>(configKeys.LOG_LEVEL) || "info";
6466
}
6567

68+
public get clearOutputOnBuild(): boolean {
69+
return this.getConfigValue<boolean>(configKeys.CLEAR_OUTPUT_ON_START);
70+
}
71+
6672
public get allowPDEFiletype(): boolean {
6773
return this.getConfigValue<boolean>(configKeys.ALLOW_PDE_FILETYPE);
6874
}

src/common/outputChannel.ts

+4
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,8 @@ export const arduinoChannel = {
3333
hide() {
3434
this.channel.hide();
3535
},
36+
37+
clear() {
38+
this.channel.clear();
39+
},
3640
};

src/serialmonitor/outputBuffer.ts

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT license.
3+
4+
import { performance } from "perf_hooks";
5+
import * as vscode from "vscode";
6+
7+
export class BufferedOutputChannel implements vscode.Disposable {
8+
private _buffer: string[];
9+
private _timer: NodeJS.Timer;
10+
private _lastFlushTime: number;
11+
12+
public constructor(private readonly outputCallback: (value: string) => void, private readonly flushIntervalMs: number) {
13+
this._buffer = [];
14+
this._timer = setInterval(() => this.tryFlush(), this.flushIntervalMs);
15+
this._lastFlushTime = Number.NEGATIVE_INFINITY;
16+
}
17+
18+
public append(value: string) {
19+
this.add(value);
20+
}
21+
22+
public appendLine(value: string) {
23+
this.add(value + "\n");
24+
}
25+
26+
public dispose() {
27+
this.tryFlush();
28+
clearInterval(this._timer);
29+
}
30+
31+
private add(value: string) {
32+
this._buffer.push(value);
33+
this.tryFlush();
34+
}
35+
36+
private tryFlush() {
37+
const currentTime = performance.now();
38+
if (this._buffer.length > 0 && currentTime - this._lastFlushTime > this.flushIntervalMs) {
39+
this.outputCallback(this._buffer.join(""));
40+
this._lastFlushTime = currentTime;
41+
this._buffer = [];
42+
}
43+
}
44+
}

src/serialmonitor/serialMonitor.ts

+11-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import ArduinoContext from "../arduinoContext";
66
import * as constants from "../common/constants";
77
import { DeviceContext } from "../deviceContext";
88
import * as Logger from "../logger/logger";
9+
import { BufferedOutputChannel } from "./outputBuffer";
910
import { SerialPortCtrl } from "./serialportctrl";
1011

1112
export interface ISerialPortDetail {
@@ -49,6 +50,8 @@ export class SerialMonitor implements vscode.Disposable {
4950

5051
private _outputChannel: vscode.OutputChannel;
5152

53+
private _bufferedOutputChannel: BufferedOutputChannel;
54+
5255
public initialize() {
5356
let defaultBaudRate;
5457
if (ArduinoContext.arduinoApp && ArduinoContext.arduinoApp.settings && ArduinoContext.arduinoApp.settings.defaultBaudRate) {
@@ -57,6 +60,7 @@ export class SerialMonitor implements vscode.Disposable {
5760
defaultBaudRate = SerialMonitor.DEFAULT_BAUD_RATE;
5861
}
5962
this._outputChannel = vscode.window.createOutputChannel(SerialMonitor.SERIAL_MONITOR);
63+
this._bufferedOutputChannel = new BufferedOutputChannel(this._outputChannel.append, 300);
6064
this._currentBaudRate = defaultBaudRate;
6165
this._portsStatusBar = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Right, constants.statusBarPriority.PORT);
6266
this._portsStatusBar.command = "arduino.selectSerialPort";
@@ -88,6 +92,8 @@ export class SerialMonitor implements vscode.Disposable {
8892
if (this._serialPortCtrl && this._serialPortCtrl.isActive) {
8993
return this._serialPortCtrl.stop();
9094
}
95+
this._outputChannel.dispose();
96+
this._bufferedOutputChannel.dispose();
9197
}
9298

9399
public async selectSerialPort(vid: string, pid: string) {
@@ -145,7 +151,11 @@ export class SerialMonitor implements vscode.Disposable {
145151
return;
146152
}
147153
} else {
148-
this._serialPortCtrl = new SerialPortCtrl(this._currentPort, this._currentBaudRate, this._outputChannel);
154+
this._serialPortCtrl = new SerialPortCtrl(
155+
this._currentPort,
156+
this._currentBaudRate,
157+
this._bufferedOutputChannel,
158+
this._outputChannel.show);
149159
}
150160

151161
if (!this._serialPortCtrl.currentPort) {

0 commit comments

Comments
 (0)