Skip to content

Commit

Permalink
Fix flseh and texts
Browse files Browse the repository at this point in the history
  • Loading branch information
blavka committed Jan 14, 2020
1 parent 0df1d1b commit 0150dea
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 22 deletions.
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hardwario-playground",
"productName": "Hardwario Playground",
"productName": "HARDWARIO Playground",
"author": {
"name": "HARDWARIO s.r.o.",
"email": "karel.blavka@hardwario.com",
Expand Down Expand Up @@ -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/",
Expand All @@ -48,19 +48,19 @@
"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"
],
"publisherName": "HARDWARIO s.r.o."
},
"linux": {
"artifactName": "hio-playground-${version}-linux-${arch}.${ext}",
"artifactName": "hio-playground-v${version}-linux-${arch}.${ext}",
"target": [
"deb",
"snap",
Expand All @@ -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": [
Expand Down
4 changes: 2 additions & 2 deletions src/render/components/Firmware.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(() => {
Expand Down Expand Up @@ -243,7 +243,7 @@ export default class extends Component {
<select className="form-control mb-2" id="formDeviceSelect" disabled={this.state.isRun} value={this.state.port} onChange={(e) => this.setState({ port: e.target.value })}>
{this.state.ports.length == 0 ? <option>(no device available)</option> : null }
{
this.state.ports.map((port, index) => <option value={port.comName} key={index}>{port.comName}{port.serialNumber ? " " + port.serialNumber : null}</option>)
this.state.ports.map((port, index) => <option value={port.path} key={index}>{port.path}{port.serialNumber ? " " + port.serialNumber : null}</option>)
}
</select>

Expand Down
9 changes: 6 additions & 3 deletions src/render/components/Gateway.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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)
{
Expand Down Expand Up @@ -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)
}

Expand All @@ -116,7 +119,7 @@ export default class extends Component {
<select className="form-control" value={this.state.selectedPort} onChange={(e) => this.setState({ selectedPort: e.target.value })}>
{this.state.ports.length == 0 ? <option>(no device available)</option> : null }
{
this.state.ports.map((port, index) => <option value={port.comName} key={index}>{port.comName}{port.serialNumber ? " " + port.serialNumber : null}</option>)
this.state.ports.map((port, index) => <option value={port.path} key={index}>{port.path}{port.serialNumber ? " " + port.serialNumber : null}</option>)
}
</select>
</FormGroup>
Expand Down
6 changes: 3 additions & 3 deletions src/render/components/GatewayList.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ export default class extends Component {
<div id="gatewayList">
{
this.state.ports.map((port, index) => {
return <div className="port" key={port.comName} onClick={() => {
ipcRenderer.send("gateway/connect", port.comName)
}} >{port.comName}</div>
return <div className="port" key={port.path} onClick={() => {
ipcRenderer.send("gateway/connect", port.path)
}} >{port.path}</div>
})
}
<div className="port" onClick={() => {
Expand Down
14 changes: 9 additions & 5 deletions src/utils/flasher/flasher-serial.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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');
}
})
Expand All @@ -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);
Expand Down Expand Up @@ -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();
}

Expand Down
2 changes: 1 addition & 1 deletion webpack.build.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
2 changes: 1 addition & 1 deletion webpack.dev.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit 0150dea

Please sign in to comment.