Skip to content

Commit e2966b3

Browse files
committed
minor fixes
1 parent e151baf commit e2966b3

File tree

8 files changed

+96
-11
lines changed

8 files changed

+96
-11
lines changed

buildspec.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ phases:
1010
build:
1111
commands:
1212
- yarn build
13-
- echo '["https://compile.duino.app"]' > dist/servers.json
13+
- cp dist/servers-beta.json dist/servers.json
1414
artifacts:
1515
files:
1616
- '**/*'

public/servers-beta.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[
2+
"https://compile-beta.duino.app"
3+
]
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
<template>
2+
<v-card outlined>
3+
<v-card-title>
4+
Serial Monitor
5+
</v-card-title>
6+
<v-card-text>
7+
<v-row>
8+
<v-col cols="12" sm="6" md="4" class="pt-0">
9+
<v-select
10+
v-model="settings.value.encoding"
11+
:items="encodings"
12+
label="Encoding"
13+
outlined
14+
/>
15+
</v-col>
16+
</v-row>
17+
</v-card-text>
18+
</v-card>
19+
</template>
20+
21+
<script>
22+
23+
export default {
24+
data() {
25+
return {
26+
settings: { value: {} },
27+
encodings: [
28+
{ value: 'ascii', text: 'ASCII' },
29+
{ value: 'utf8', text: 'UTF-8 (unicode + emojis)' },
30+
{ value: 'utf16le', text: 'UTF-16 LE' },
31+
{ value: 'ucs2', text: 'UCS-2' },
32+
{ value: 'base64', text: 'Base64' },
33+
{ value: 'hex', text: 'Hex' },
34+
{ value: 'latin1', text: 'Latin1' },
35+
],
36+
};
37+
},
38+
methods: {
39+
loadSettings() {
40+
const { Setting } = this.$FeathersVuex.api;
41+
const { data } = Setting.findInStore({ query: { key: 'monitor' } });
42+
if (data[0]) {
43+
[this.settings] = data;
44+
return;
45+
}
46+
const settings = new Setting({ key: 'monitor' });
47+
settings.save();
48+
this.settings = settings;
49+
},
50+
handleSave(to, from) {
51+
if (JSON.stringify(to) === JSON.stringify(from)) return false;
52+
this.settings.save();
53+
return true;
54+
},
55+
},
56+
mounted() {
57+
this.loadSettings();
58+
},
59+
watch: {
60+
'settings.value.encoding': {
61+
handler(to, from) { this.handleSave(to, from); },
62+
},
63+
},
64+
};
65+
</script>

src/plugins/compile-server.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ class CompileServer extends EventEmitter {
167167
const board = store.getters['boards/find']({ query: { uuid: store.getters.currentBoard } }).data[0];
168168
if (!board) return 'arduino:avr:uno';
169169
return Object.keys(board.config)
170-
.filter((i) => !board.config_options
170+
.filter((i) => board.config[i] && !board.config_options
171171
.find((c) => c.option === i).values
172172
.find((v) => v.value === board.config[i]).isDefault)
173173
.reduce((a, i) => `${a}:${i}=${board.config[i]}`, board.fqbn);
@@ -202,13 +202,13 @@ class CompileServer extends EventEmitter {
202202
.map((f) => ({ content: f.body, name: `${project.ref}/${f.name}` }));
203203
this.emit('console.progress', { percent: 0, message: 'Initialising Libraries...' });
204204
const libs = await this._getLibs(project);
205-
if (libs.length) {
206-
await this.serverReq('libraries/cache', {
207-
method: 'POST',
208-
headers: { 'Content-Type': 'application/json' },
209-
body: JSON.stringify({ libs }),
210-
});
211-
}
205+
// if (libs.length) {
206+
// await this.serverReq('libraries/cache', {
207+
// method: 'POST',
208+
// headers: { 'Content-Type': 'application/json' },
209+
// body: JSON.stringify({ libs }),
210+
// });
211+
// }
212212
this.emit('console.progress', { percent: 0.25 * mod, message: 'Compiling code...' });
213213
const req = {
214214
fqbn: this._getFqbn(),

src/plugins/serial/base-serial.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/* eslint-disable no-unused-vars */
22
/* eslint-disable class-methods-use-this */
33
import EventEmitter from 'events';
4+
import store from '@/store';
45

56
/*
67
Interface should emit the following:
@@ -28,7 +29,6 @@ class BaseSerial extends EventEmitter {
2829
this.mute = false;
2930
this.baud = Number(window.localStorage.currentBaudRate) || 115200;
3031
this.lastBaud = 115200;
31-
this.encoding = 'ascii';
3232
this.devices = [];
3333
this.currentDevice = null;
3434
this.connected = false;
@@ -39,6 +39,11 @@ class BaseSerial extends EventEmitter {
3939
// console.log('debug', this.DEBUG);
4040
}
4141

42+
get encoding() {
43+
const [settings] = store.getters['settings/find']({ query: { key: 'monitor' } }).data;
44+
return settings?.value?.encoding || 'ascii';
45+
}
46+
4247
install(Vue) {
4348
// eslint-disable-next-line no-param-reassign
4449
Vue.$serial = this;

src/store/services/boards.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,11 @@ class Board extends BaseModel {
1616
if (!this.config_options) return {};
1717
const config = {};
1818
this.config_options.forEach((con) => {
19-
config[con.option] = (con.values.find((val) => val.selected) || {}).value;
19+
config[con.option] = (
20+
con.values.find((val) => val.selected)
21+
|| con.values.find((val) => val.isDefault)
22+
|| {}
23+
).value;
2024
});
2125
return config;
2226
},

src/store/tools.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,7 @@ export const settingsDefaults = {
4141
compiler: {
4242
verbose: false,
4343
},
44+
monitor: {
45+
encoding: 'ascii',
46+
},
4447
};

src/views/tools/Settings.vue

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,22 @@
1212
<v-col cols="12">
1313
<compiler />
1414
</v-col>
15+
<v-col cols="12">
16+
<monitor />
17+
</v-col>
1518
</v-row>
1619
</template>
1720

1821
<script>
1922
import Editor from '../../components/settings/editor.vue';
2023
import Compiler from '../../components/settings/compiler.vue';
24+
import Monitor from '../../components/settings/monitor.vue';
2125
2226
export default {
2327
components: {
2428
Editor,
2529
Compiler,
30+
Monitor,
2631
},
2732
};
2833
</script>

0 commit comments

Comments
 (0)