refactor: move serial port logic

This commit is contained in:
Vlad Stan
2022-08-03 13:50:07 +03:00
parent 4e9cfc0f74
commit df7ebc6699
6 changed files with 628 additions and 578 deletions
@@ -110,7 +110,7 @@ const ACCOUNT_TYPES = {
const getAccountDescription = type => ACCOUNT_TYPES[type] || 'nonstandard'
const readFromSerialPort = serial => {
const readFromSerialPort = reader => {
let partialChunk
let fulliness = []
@@ -123,7 +123,7 @@ const readFromSerialPort = serial => {
partialChunk = undefined
}
while (true) {
const {value, done} = await serial.reader.read()
const {value, done} = await reader.read()
console.log('### serial read', value)
if (value) {
const values = value.split(separator)