[fsync] enable/disable cmd works on sensors, not on ports

This commit is contained in:
Bart Van Der Meerssche 2011-01-28 20:38:19 +01:00
parent 035bc2d4fe
commit 55ecdd3451
1 changed files with 5 additions and 10 deletions

View File

@ -144,9 +144,7 @@ end
local phy_to_log = {}
for i = 1, MAX_SENSORS do
local set = { analog = true, pulse = true }
if flukso[tostring(i)] ~= nil and set[flukso[tostring(i)]['type']] then
if flukso[tostring(i)] ~= nil then
local ports = flukso[tostring(i)].port or {}
for j = 1, #ports do
@ -160,6 +158,7 @@ for i = 1, MAX_SENSORS do
end
end
-- ports that are not in use are mapped to sensor id 0xff
for i = 0, MAX_SENSORS - 1 do
if not phy_to_log[i] then
phy_to_log[i] = 0xff
@ -202,16 +201,12 @@ if flukso.main.reset_counters == '1' then
uci:commit('flukso')
end
-- enable configured ports
-- enable configured sensors
for i = 1, MAX_SENSORS do
if flukso[tostring(i)] ~= nil and flukso[tostring(i)].enable == '1' then
local ports = flukso[tostring(i)].port or {}
for j = 1, #ports do
cmd = string.format(SET_ENABLE, toc(tonumber(ports[j])), 1)
cmd = string.format(SET_ENABLE, toc(i), 1)
send(ctrl, cmd)
end
end
end
-- clean up