Fixed a disconnect but, and unhoming on failed probe

This commit is contained in:
David Carley
2021-10-21 19:25:27 -07:00
parent 2571475700
commit 3710a3e1f6
6 changed files with 61 additions and 29 deletions

View File

@@ -27,9 +27,10 @@
'use strict'
var api = require('./api');
var cookie = require('./cookie')('bbctrl-');
var Sock = require('./sock');
const api = require('./api');
const cookie = require('./cookie')('bbctrl-');
const Sock = require('./sock');
const omit = require('lodash.omit');
function is_newer_version(current, latest) {
const pattern = /(\d+)\.(\d+)\.(\d+)(.*)/;
@@ -385,10 +386,10 @@ module.exports = new Vue({
}
if ('log' in e.data) {
if (this.state.probing_active && e.data.log.msg === "Switch not found") {
if (e.data.log.msg === "Switch not found") {
this.$broadcast('probing_failed');
} else {
this.$broadcast('log', JSON.stringify(e.data.log, null, 4));
this.$broadcast('log', e.data.log);
}
delete e.data.log;
@@ -407,6 +408,25 @@ module.exports = new Vue({
}
}
// Set this to true to get console output of changes to the state
const debugStateChanges = false;
if (debugStateChanges) {
const data = omit(e.data, [
'vdd',
'vin',
'vout',
'motor',
'temp',
'heartbeat',
'load1',
'load2',
'rpi_temp'
]);
if (Object.keys(data).length > 0) {
console.log(JSON.stringify(data, null, 4));
}
}
update_object(this.state, e.data, false);
if (this.state.pw === 0) {