[fluksod] rename type option to class in the flukso uci file

This commit is contained in:
Bart Van Der Meerssche 2011-04-01 15:54:55 +02:00
parent 0e84af3d04
commit 350a373b72
3 changed files with 13 additions and 13 deletions

View File

@ -10,7 +10,7 @@ config settings main
### sensor config options
# config sensor <1..6>
# option id <uuid>
# option type <analog|pulse|uart>
# option class <analog|pulse|uart>
# list port <1..6>
# option constant [<meterconstant>]
# option voltage [<volts>]
@ -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

View File

@ -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

View File

@ -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