From 350a373b723c6b63ab1691e24ffc8dbbc9e41c93 Mon Sep 17 00:00:00 2001 From: Bart Van Der Meerssche Date: Fri, 1 Apr 2011 15:54:55 +0200 Subject: [PATCH] [fluksod] rename type option to class in the flukso uci file --- mote/v2/openwrt/package/flukso/config/flukso.uci | 14 +++++++------- mote/v2/openwrt/package/flukso/luasrc/fluksod.lua | 6 +++--- mote/v2/openwrt/package/flukso/luasrc/fsync.lua | 6 +++--- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/mote/v2/openwrt/package/flukso/config/flukso.uci b/mote/v2/openwrt/package/flukso/config/flukso.uci index 9f5bf3b..80d244f 100644 --- a/mote/v2/openwrt/package/flukso/config/flukso.uci +++ b/mote/v2/openwrt/package/flukso/config/flukso.uci @@ -10,7 +10,7 @@ config settings main ### sensor config options # config sensor <1..6> # option id -# option type +# option class # list port <1..6> # option constant [] # option voltage [] @@ -18,7 +18,7 @@ config settings main config sensor 1 option id 0123456789abcdef0123456789abcde1 - option type analog + option class analog list port 1 option voltage 230 option current 50 @@ -26,7 +26,7 @@ config sensor 1 config sensor 2 option id 0123456789abcdef0123456789abcde2 - option type analog + option class analog list port 2 option voltage 230 option current 50 @@ -34,7 +34,7 @@ config sensor 2 config sensor 3 option id 0123456789abcdef0123456789abcde3 - option type analog + option class analog list port 3 option voltage 230 option current 50 @@ -42,20 +42,20 @@ config sensor 3 config sensor 4 option id 0123456789abcdef0123456789abcde4 - option type pulse + option class pulse list port 4 option constant 1 option enable 1 config sensor 5 option id 0123456789abcdef0123456789abcde5 - option type pulse + option class pulse list port 5 option constant 1 option enable 1 config sensor 6 option id 0123456789abcdef0123456789abcde6 - option type uart + option class uart list port 6 option enable 1 diff --git a/mote/v2/openwrt/package/flukso/luasrc/fluksod.lua b/mote/v2/openwrt/package/flukso/luasrc/fluksod.lua index 2d512d4..19928ec 100755 --- a/mote/v2/openwrt/package/flukso/luasrc/fluksod.lua +++ b/mote/v2/openwrt/package/flukso/luasrc/fluksod.lua @@ -110,7 +110,7 @@ function dispatch(wan_child, lan_child) -- map index(+1!) to sensor id and sensor type local sensor_id = FLUKSO[tostring(tolua(i))]['id'] - local sensor_type = FLUKSO[tostring(tolua(i))]['type'] + local sensor_class = FLUKSO[tostring(tolua(i))]['class'] -- resume both branches if WAN_ENABLED then @@ -119,10 +119,10 @@ function dispatch(wan_child, lan_child) end if LAN_ENABLED then - if sensor_type == 'analog' then + if sensor_class == 'analog' then coroutine.resume(lan_child, sensor_id, timestamp, extra) - elseif sensor_type == 'pulse' then + elseif sensor_class == 'pulse' then coroutine.resume(lan_child, sensor_id, timestamp, false, counter, extra) end end diff --git a/mote/v2/openwrt/package/flukso/luasrc/fsync.lua b/mote/v2/openwrt/package/flukso/luasrc/fsync.lua index 463b4c8..0d11f9d 100755 --- a/mote/v2/openwrt/package/flukso/luasrc/fsync.lua +++ b/mote/v2/openwrt/package/flukso/luasrc/fsync.lua @@ -152,7 +152,7 @@ local phy_to_log = {} for i = 1, MAX_SENSORS do if flukso[tostring(i)] ~= nil then - if flukso[tostring(i)]['type'] == 'analog' and i > MAX_ANALOG_SENSORS then + if flukso[tostring(i)]['class'] == 'analog' and i > MAX_ANALOG_SENSORS then print(string.format('Error. Analog sensor %s should be less than or equal to max_analog_sensors (%s)', i, MAX_ANALOG_SENSORS)) os.exit(4) end @@ -188,12 +188,12 @@ for i = 1, MAX_SENSORS do if flukso[tostring(i)] == nil then cmd = string.format(SET_METERCONST, toc(i), 0) - elseif flukso[tostring(i)]['type'] == 'analog' then + elseif flukso[tostring(i)]['class'] == 'analog' then local voltage = tonumber(flukso[tostring(i)].voltage) local current = tonumber(flukso[tostring(i)].current) cmd = string.format(SET_METERCONST, toc(i), math.floor(METERCONST_FACTOR * voltage * current)) - elseif flukso[tostring(i)]['type'] == 'pulse'then + elseif flukso[tostring(i)]['class'] == 'pulse'then local meterconst = tonumber(flukso[tostring(i)].constant) cmd = string.format(SET_METERCONST, toc(i), meterconst) else