From 412cbc03e38618cb4503c1196ace6fc73c91e2eb Mon Sep 17 00:00:00 2001 From: Bart Van Der Meerssche Date: Sat, 30 Apr 2011 19:23:51 +0200 Subject: [PATCH] [fluksod] we only have to publish once per second --- mote/v2/openwrt/package/flukso/luasrc/fluksod.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mote/v2/openwrt/package/flukso/luasrc/fluksod.lua b/mote/v2/openwrt/package/flukso/luasrc/fluksod.lua index 976f550..cde8468 100755 --- a/mote/v2/openwrt/package/flukso/luasrc/fluksod.lua +++ b/mote/v2/openwrt/package/flukso/luasrc/fluksod.lua @@ -79,6 +79,7 @@ local CACERT = FLUKSO.daemon.cacert -- set LAN parameters local LAN_ENABLED = (FLUKSO.daemon.enable_lan_branch == '1') +local LAN_INTERVAL = 0 local LAN_POLISH_CUTOFF = 60 local LAN_PUBLISH_PATH = DAEMON_PATH .. '/sensor' @@ -264,6 +265,7 @@ end function lan_buffer(child) return coroutine.create(function(sensor_id, timestamp, power, counter, msec) local measurements = data.new() + local threshold = os.time() + LAN_INTERVAL local previous = {} local function diff(x, y) -- calculates y - x @@ -299,8 +301,9 @@ function lan_buffer(child) end end - if next(measurements) then --checking whether table is not empty + if timestamp > threshold and next(measurements) then --checking whether table is not empty coroutine.resume(child, measurements) + threshold = os.time() + LAN_INTERVAL end sensor_id, timestamp, power, counter, msec = coroutine.yield()