Skip to content

Commit 4bb6b91

Browse files
committed
#4: Add command to Build, Upload and Open Serial Monitor one by one
1 parent ec71ebb commit 4bb6b91

File tree

5 files changed

+30
-4
lines changed

5 files changed

+30
-4
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
## 0.0.8 (2017-05-03)
2+
* [#4](https://github.com/formulahendry/vscode-platformio/issues/4): Add command to `Build`, `Upload` and `Open Serial Monitor` one by one
3+
14
## 0.0.7 (2017-04-28)
25
* Add Include Path to `c_cpp_properties.json`
36

README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ Integrate [PlatformIO](http://platformio.org/) into Visual Studio Code on top of
1616
* Install library from [PlatformIO Library Registry](http://platformio.org/lib)
1717
* Quick way to open PlatformIO Terminal
1818
* Add Include Path to `c_cpp_properties.json` for [C/C++ extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools)
19+
* Combined `Build`, `Upload` and `Open Serial Monitor` with one command
1920

2021
## Prerequisites
2122

@@ -33,15 +34,15 @@ Integrate [PlatformIO](http://platformio.org/) into Visual Studio Code on top of
3334

3435
## Usage
3536

36-
* **Build PlatformIO project**: use shortcut `Ctrl+Alt+B`, or press `F1` and then select/type `PlatformIO: Build`, or right click the Text Editor and then click `PlatformIO: Build` in context menu
37+
* **Build PlatformIO project**: Use shortcut `Ctrl+Alt+B`, or press `F1` and then select/type `PlatformIO: Build`, or right click the Text Editor and then click `PlatformIO: Build` in context menu
3738

3839
![build](images/build.gif)
3940

40-
* **Upload firmware to devices**: use shortcut `Ctrl+Alt+U`, or press `F1` and then select/type `PlatformIO: Upload`, or right click the Text Editor and then click `PlatformIO: Upload` in context menu
41+
* **Upload firmware to devices**: Use shortcut `Ctrl+Alt+U`, or press `F1` and then select/type `PlatformIO: Upload`, or right click the Text Editor and then click `PlatformIO: Upload` in context menu
4142

4243
![upload](images/upload.gif)
4344

44-
* **Open Serial Monitor**: use shortcut `Ctrl+Alt+S`, or press `F1` and then select/type `PlatformIO: Open Serial Monitor`, or right click the Text Editor and then click `PlatformIO: Open Serial Monitor` in context menu
45+
* **Open Serial Monitor**: Use shortcut `Ctrl+Alt+S`, or press `F1` and then select/type `PlatformIO: Open Serial Monitor`, or right click the Text Editor and then click `PlatformIO: Open Serial Monitor` in context menu
4546

4647
![openSerialMonitor](images/openSerialMonitor.gif)
4748

@@ -59,6 +60,8 @@ Integrate [PlatformIO](http://platformio.org/) into Visual Studio Code on top of
5960

6061
* **Add Include Path to `c_cpp_properties.json` for C/C++ extension**: Press `F1` and then select/type `PlatformIO: Add Include Path to Settings`. Wait for some seconds, then the PlatformIO libraries will be automatically added into Include Path of `c_cpp_properties.json`
6162

63+
* **Combined `Build`, `Upload` and `Open Serial Monitor` with one command**: Use shortcut `Ctrl+Alt+A`, or press `F1` and then select/type `PlatformIO: Build, Upload and Open Serial Monitor`. `Build`, `Upload` and `Open Serial Monitor` will be run one by one.
64+
6265
## Settings
6366

6467
* `platformio.baudRate`: Set baud rate for Serial Monitor. (Default is **9600**)

package.json

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "platformio",
33
"displayName": "PlatformIO",
44
"description": "PlatformIO for Visual Studio Code: Arduino, Espressif, Raspberry Pi, mbed and more",
5-
"version": "0.0.7",
5+
"version": "0.0.8",
66
"publisher": "formulahendry",
77
"icon": "logo.png",
88
"preview": true,
@@ -33,6 +33,7 @@
3333
"onCommand:platformio.build",
3434
"onCommand:platformio.upload",
3535
"onCommand:platformio.openSerialMonitor",
36+
"onCommand:platformio.buildUploadAndOpenSerialMonitor",
3637
"onCommand:platformio.searchLibrary",
3738
"onCommand:platformio.installLibrary",
3839
"onCommand:platformio.openTerminal",
@@ -52,6 +53,10 @@
5253
"command": "platformio.openSerialMonitor",
5354
"title": "PlatformIO: Open Serial Monitor"
5455
},
56+
{
57+
"command": "platformio.buildUploadAndOpenSerialMonitor",
58+
"title": "PlatformIO: Build, Upload and Open Serial Monitor"
59+
},
5560
{
5661
"command": "platformio.searchLibrary",
5762
"title": "PlatformIO: Search Library"
@@ -80,6 +85,10 @@
8085
{
8186
"command": "platformio.openSerialMonitor",
8287
"key": "ctrl+alt+s"
88+
},
89+
{
90+
"command": "platformio.buildUploadAndOpenSerialMonitor",
91+
"key": "ctrl+alt+a"
8392
}
8493
],
8594
"menus": {

src/extension.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ export function activate(context: vscode.ExtensionContext) {
1717
platformio.openSerialMonitor();
1818
}));
1919

20+
context.subscriptions.push(vscode.commands.registerCommand("platformio.buildUploadAndOpenSerialMonitor", () => {
21+
platformio.buildUploadAndOpenSerialMonitor();
22+
}));
23+
2024
context.subscriptions.push(vscode.commands.registerCommand("platformio.searchLibrary", () => {
2125
platformio.searchLibrary();
2226
}));

src/platformio.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,13 @@ export class PlatformIO {
3131
AppInsightsClient.sendEvent("openSerialMonitor", { baudRate: baudRate.toString() });
3232
}
3333

34+
public buildUploadAndOpenSerialMonitor(): void {
35+
this.build();
36+
this.upload();
37+
this.openSerialMonitor();
38+
AppInsightsClient.sendEvent("buildUploadAndOpenSerialMonitor");
39+
}
40+
3441
public searchLibrary(): void {
3542
let query = "CANCELED";
3643
vscode.window.showInputBox({

0 commit comments

Comments
 (0)