error catching for cfg
This commit is contained in:
parent
da801346a1
commit
c6446de63c
2 changed files with 6 additions and 1 deletions
2
index.js
2
index.js
|
@ -3,7 +3,7 @@ import * as lights from './lights.js';
|
|||
|
||||
const cfg = require('./config.json');
|
||||
|
||||
global.cfg = cfg;
|
||||
global.cfg = cfg || {};
|
||||
|
||||
server.recv(
|
||||
(res) => {
|
||||
|
|
|
@ -1,5 +1,10 @@
|
|||
import * as ws281x from 'rpi-ws281x'
|
||||
|
||||
if (!global.cfg) {
|
||||
const cfg = require('./config.json');
|
||||
|
||||
global.cfg = cfg || {};
|
||||
}
|
||||
const fade_ticks = global.cfg.fade_ticks || 10;
|
||||
var pixels = new Uint32Array(global.cfg.leds);
|
||||
var pixel_cache = new Uint32Array(global.cfg.leds);
|
||||
|
|
Loading…
Reference in a new issue