From 2479cc62fd1d40dd15c362f69959473c86904454 Mon Sep 17 00:00:00 2001 From: Dirk Jahnke Date: Sun, 3 Dec 2017 09:22:54 +0100 Subject: [PATCH] Added update RPC for colors, lamps and animations --- fs/init.js | 91 ++++++++++++++++++++++++++++++++++++++---------------- mos.yml | 3 +- src/main.c | 2 +- 3 files changed, 67 insertions(+), 29 deletions(-) diff --git a/fs/init.js b/fs/init.js index 520ae9a..7943b06 100644 --- a/fs/init.js +++ b/fs/init.js @@ -20,7 +20,8 @@ print('LED GPIO:', onBoardLed, 'button GPIO:', button); let getInfo = function() { return JSON.stringify({ total_ram: Sys.total_ram(), - free_ram: Sys.free_ram() + free_ram: Sys.free_ram(), + uptime: Sys.uptime() }); }; @@ -54,7 +55,7 @@ Net.setStatusEventHandler(function(ev, arg) { } else if (ev === Net.STATUS_GOT_IP) { evs = 'GOT_IP'; } - print('== Net event:', ev, evs); + print('==> NET:', ev, evs); }, null); // Initialize LED controller @@ -89,6 +90,7 @@ let animationFile = Cfg.get('led.animationFile'); let lampsFile = Cfg.get('led.lampsFile'); let useDefaults = Cfg.get('led.useDefaults'); let updateCycle = Cfg.get('led.updateCycle'); +let tickDuration = Cfg.get('led.tickDuration'); let brightnessAdjustment = Cfg.get('led.brightness'); let numberOfLeds = 0; // from config files, count led definition entries @@ -98,12 +100,12 @@ function createLedTestPattern() { let switchMod; for (i=0; i 5) print("WRONG -- should never reach this in switch statement!"); } strip.show(); @@ -112,7 +114,7 @@ function createLedTestPattern() { function allLedOn() { let i; for (i=0; i