Skip to content

Commit b5d34f3

Browse files
author
Furkan DUMAN
committed
Extension need to run in Windows
1 parent a3594c3 commit b5d34f3

File tree

6 files changed

+35
-4
lines changed

6 files changed

+35
-4
lines changed

.vscode/launch.json

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"name": "Launch Extension",
6+
"type": "extensionHost",
7+
"request": "launch",
8+
"runtimeExecutable": "${execPath}",
9+
"args": [
10+
"--extensionDevelopmentPath=${workspaceRoot}"
11+
],
12+
"stopOnEntry": false,
13+
"sourceMaps": true,
14+
"outDir": "${workspaceRoot}/out",
15+
"preLaunchTask": "npm"
16+
}
17+
]
18+
}

client/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"email": "[email protected]"
88
},
99
"license": "MIT",
10-
"version": "1.0.2",
10+
"version": "1.0.3",
1111
"publisher": "fduman",
1212
"icon": "esp8266.gif",
1313
"repository": {

client/src/nodeMcuManager.ts

+15-2
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@ import { window } from "vscode";
33
import * as path from "path";
44

55
export function uploadFile(device: string, filename: string) {
6-
let connector = new nodemcu.Connector(device, 9600);
6+
// TODO: NodeMcu's default uart settings is 115200. Need to implement baudrate change function
7+
let connector = new nodemcu.Connector(device, 115200);
78

89
connector.connect((err, deviceInfo) => {
910
if (err) {
1011
window.showErrorMessage("NodeMCU connection error: " + err);
12+
connector.disconnect();
1113
}
1214
else {
1315
window.showInformationMessage("NodeMCU device connected: " + deviceInfo);
@@ -31,13 +33,24 @@ export function uploadFile(device: string, filename: string) {
3133
export function findDevice(cb: any): void {
3234
let connector = new nodemcu.Connector("", 9600);
3335

34-
connector.deviceInfo(false, (err, devices) => {
36+
// serialport module cannot detect vendor id on windows so we should get all com devices and filtered by pnpid
37+
let osIsWindows = process.platform == "win32";
38+
39+
connector.deviceInfo(osIsWindows, (err, devices) => {
3540
if (err) {
3641
window.showErrorMessage('Serial device connection error: ' + err);
3742
} else {
43+
if (osIsWindows)
44+
{
45+
devices = devices.filter(function(device) {
46+
return device.pnpId.toString().includes("VID_1A86") || device.pnpId.toString().includes("VID_10C4");
47+
});
48+
}
49+
3850
if (devices.length == 0) {
3951
window.showErrorMessage('No Connected Devices found');
4052
} else if (devices.length > 1) {
53+
// TODO: Display selection popup
4154
window.showErrorMessage("Many devices found. Connect only once");
4255
}
4356
else {

native_binaries/win32/serialport.node

176 KB
Binary file not shown.

server/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"name": "vscode-nodemcu-languageserver",
33
"description": "Nodemcu language server",
4+
"displayName": "NodeMcu language server",
45
"version": "1.0.1",
56
"author": "Furkan Duman",
67
"license": "MIT",

test.lua

-1
This file was deleted.

0 commit comments

Comments
 (0)