feat: buttonConfig pins are optional

This commit is contained in:
Vlad Stan 2022-08-19 17:49:01 +03:00
parent 83f998fe37
commit 5b59cdcd0d
5 changed files with 14 additions and 16 deletions

View file

@ -83,7 +83,6 @@
filled filled
dense dense
v-model.trim="config.buttonOnePin" v-model.trim="config.buttonOnePin"
type="number"
label="Pin Number (Button 1)" label="Pin Number (Button 1)"
></q-input> ></q-input>
</div> </div>
@ -94,7 +93,6 @@
filled filled
dense dense
v-model.trim="config.buttonTwoPin" v-model.trim="config.buttonTwoPin"
type="number"
label="Pin Number (Button 2)" label="Pin Number (Button 2)"
></q-input> ></q-input>
</div> </div>

View file

@ -5,12 +5,8 @@ async function serialPortConfig(path) {
props: ['config'], props: ['config'],
template: t, template: t,
data() { data() {
return { return {}
}
}, },
methods: { methods: {}
},
}) })
} }

View file

@ -243,7 +243,7 @@
<div class="row q-mt-lg"> <div class="row q-mt-lg">
<div class="col-12"> <div class="col-12">
<q-badge class="text-subtitle2" color="yellow" text-color="black"> <q-badge class="text-subtitle2" color="yellow" text-color="black">
<span>Check data on the display of the hardware device.</span> <span>Confirm on the hardware device also.</span>
</q-badge> </q-badge>
</div> </div>
</div> </div>

View file

@ -336,6 +336,7 @@ async function serialSigner(path) {
this.hww.showPasswordDialog = true this.hww.showPasswordDialog = true
await this.sendCommandSecure(COMMAND_PASSWORD) await this.sendCommandSecure(COMMAND_PASSWORD)
} catch (error) { } catch (error) {
console.log(error)
this.$q.notify({ this.$q.notify({
type: 'warning', type: 'warning',
message: 'Failed to connect to Hardware Wallet!', message: 'Failed to connect to Hardware Wallet!',
@ -599,11 +600,14 @@ async function serialSigner(path) {
) )
const publicKeyHex = publicKey.toHex().slice(2) const publicKeyHex = publicKey.toHex().slice(2)
await this.sendCommandClearText(COMMAND_PAIR, [ const args = [publicKeyHex]
publicKeyHex, if (Number.isInteger(+this.config.buttonOnePin)) {
this.config.buttonOnePin, args.push(this.config.buttonOnePin)
this.config.buttonTwoPin }
]) if (Number.isInteger(+this.config.buttonTwoPin)) {
args.push(this.config.buttonTwoPin)
}
await this.sendCommandClearText(COMMAND_PAIR, args)
this.$q.notify({ this.$q.notify({
type: 'positive', type: 'positive',
message: 'Pairing started!', message: 'Pairing started!',

View file

@ -21,8 +21,8 @@ const PAIRING_CONTROL_TEXT = 'lnbits'
const HWW_DEFAULT_CONFIG = Object.freeze({ const HWW_DEFAULT_CONFIG = Object.freeze({
name: '', name: '',
buttonOnePin: 0, buttonOnePin: '',
buttonTwoPin: 35, buttonTwoPin: '',
baudRate: 9600, baudRate: 9600,
bufferSize: 255, bufferSize: 255,
dataBits: 8, dataBits: 8,