diff --git a/package.json b/package.json index 93ab00c..33a1dfc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hardwario-playground", - "productName": "Hardwario Playground", + "productName": "HARDWARIO Playground", "author": { "name": "HARDWARIO s.r.o.", "email": "karel.blavka@hardwario.com", @@ -28,9 +28,9 @@ "package-mac": "npm run webpack && electron-builder build --mac" }, "build": { - "productName": "Hardwario Playground", + "productName": "HARDWARIO Playground", "appId": "com.electron.hio-playground", - "artifactName": "hio-playground-${version}-${os}-${arch}.${ext}", + "artifactName": "hio-playground-v${version}-${os}-${arch}.${ext}", "files": [ "dist/", "node_modules/", @@ -48,11 +48,11 @@ "electronVersion": "7.1.9", "publish": null, "mac": { - "artifactName": "hio-playground-${version}-macos-${arch}.${ext}", + "artifactName": "hio-playground-v${version}-macos-${arch}.${ext}", "category": "public.app-category.utilities" }, "win": { - "artifactName": "hio-playground-${version}-windows-${arch}.${ext}", + "artifactName": "hio-playground-v${version}-windows-${arch}.${ext}", "target": [ "nsis", "portable" @@ -60,7 +60,7 @@ "publisherName": "HARDWARIO s.r.o." }, "linux": { - "artifactName": "hio-playground-${version}-linux-${arch}.${ext}", + "artifactName": "hio-playground-v${version}-linux-${arch}.${ext}", "target": [ "deb", "snap", @@ -69,7 +69,7 @@ "category": "Utility" }, "nsis": { - "artifactName": "hio-playground-${version}-${os}-setup-${arch}.${ext}" + "artifactName": "hio-playground-v${version}-${os}-setup-${arch}.${ext}" }, "dmg": { "contents": [ diff --git a/src/render/components/Firmware.js b/src/render/components/Firmware.js index 91c1955..f3cbff0 100644 --- a/src/render/components/Firmware.js +++ b/src/render/components/Firmware.js @@ -123,7 +123,7 @@ export default class extends Component { this.setState({ports:ports}); if ((this.state.port === "") && (ports.length > 0)) { - this.setState({port:ports[0].comName}); + this.setState({port:ports[0].path}); } this.timer = setTimeout(() => { @@ -243,7 +243,7 @@ export default class extends Component { diff --git a/src/render/components/Gateway.js b/src/render/components/Gateway.js index 6769e1f..5e52ff1 100644 --- a/src/render/components/Gateway.js +++ b/src/render/components/Gateway.js @@ -55,7 +55,7 @@ export default class extends Component { if (this.state.ports.length == ports.length){ for (let i=0, l=ports.length; i < l; i++) { - if (this.state.ports[i].comName != ports[i].comName) { + if (this.state.ports[i].path != ports[i].path) { change = true; break; } @@ -67,7 +67,8 @@ export default class extends Component { if (change) { if ((this.state.selectedPort == "") && (ports.length > 0)) { - this.setState({ selectedPort: ports[0].comName }); + this.setState({ selectedPort: ports[0].path }); + console.log(this.state.selectedPort); } else if (ports.length == 0) { @@ -103,6 +104,8 @@ export default class extends Component { if (this.state.selectedPort == "") return; + console.log(this.state.selectedPort); + ipcRenderer.send("gateway/connect", this.state.selectedPort) } @@ -116,7 +119,7 @@ export default class extends Component { diff --git a/src/render/components/GatewayList.js b/src/render/components/GatewayList.js index 2930b63..39b1917 100644 --- a/src/render/components/GatewayList.js +++ b/src/render/components/GatewayList.js @@ -31,9 +31,9 @@ export default class extends Component {
{ this.state.ports.map((port, index) => { - return
{ - ipcRenderer.send("gateway/connect", port.comName) - }} >{port.comName}
+ return
{ + ipcRenderer.send("gateway/connect", port.path) + }} >{port.path}
}) }
{ diff --git a/src/utils/flasher/flasher-serial.js b/src/utils/flasher/flasher-serial.js index b0108e9..32e9fb5 100644 --- a/src/utils/flasher/flasher-serial.js +++ b/src/utils/flasher/flasher-serial.js @@ -112,6 +112,7 @@ class Flash_Serial { return this._read(buffer, 1); }) .then((length) => { + console.log(length, buffer, buffer.readUInt8()); if ((length == 1) && (buffer.readUInt8() == ACK)) { resolve(); } else { @@ -189,11 +190,11 @@ class Flash_Serial { return new Promise((resolve, reject) => { this._ser.read(readBuffer, 0, 1) - .then((length) => { + .then((ret) => { if (readBuffer[0] == ACK) { resolve(); } else { - console.log(length, readBuffer); + console.log(ret.bytesRead, readBuffer); reject('Expect ACK'); } }) @@ -213,11 +214,14 @@ class Flash_Serial { this._ser.close(); }, timeout); + var ret; + while (read_length < length) { - read_length += await this._ser.read(readBuffer, read_length, length - read_length).catch((e)=>{ + ret = await this._ser.read(readBuffer, read_length, length - read_length).catch((e)=>{ clearTimeout(timer); reject(e); }); + read_length += ret.bytesRead; } clearTimeout(timer); @@ -301,9 +305,9 @@ class Flash_Serial { .then(() => { return this._ser.read(readBuffer, 0, 2); }) - .then((l) => { + .then((ret) => { if ((readBuffer[0] & readBuffer[1]) != ACK) { - if ((l == 1) && (readBuffer[0] == ACK)) { + if ((ret.bytesRead == 1) && (readBuffer[0] == ACK)) { return this._wait_for_ack(); } diff --git a/webpack.build.config.js b/webpack.build.config.js index fc23928..dba7698 100644 --- a/webpack.build.config.js +++ b/webpack.build.config.js @@ -53,7 +53,7 @@ module.exports = { target: "electron-renderer", plugins: [ new HtmlWebpackPlugin({ - title: "Hardwario Playground " + process.env.npm_package_version + title: "HARDWARIO Playground v" + process.env.npm_package_version }), new ExtractTextPlugin("bundle.css"), new webpack.DefinePlugin({ diff --git a/webpack.dev.config.js b/webpack.dev.config.js index c349607..7b9de27 100644 --- a/webpack.dev.config.js +++ b/webpack.dev.config.js @@ -49,7 +49,7 @@ module.exports = { target: "electron-renderer", plugins: [ new HtmlWebpackPlugin({ - title: "Hardwario Playground " + process.env.npm_package_version + title: "HARDWARIO Playground v" + process.env.npm_package_version }), new webpack.DefinePlugin({ "process.env.NODE_ENV": JSON.stringify("development")