FBEditor log write - Thomas - 30.04.2018
Hi
There's a log write in fbe_hysteresis_3_limits function. Can I disable this log write? I use this function for brightness evaluation and it can write 70 pages of log every day.
Code: require('custom.fbeditor20.Control')
Input = 555
Limit_1_ON = 400
Limit_1_OFF = 300
Limit_2_ON = nil
Limit_2_OFF = nil
Limit_3_ON = nil
Limit_3_OFF = nil
threshold1, threshold2, threshold3 = fbe_hysteresis_3_limits(Input, Limit_1_ON, Limit_1_OFF, Limit_2_ON, Limit_2_OFF, Limit_3_ON, Limit_3_OFF, 'fb__New_diagram__fbe_hysteresis_3_limits__id')
In log I see:
Code: * table:
[1]
* number: 1
[2]
* number: 0
[3]
* number: 0
RE: FBEditor log write - Daniel - 30.04.2018
Hi
Here are all the functions used in FB Editor
https://forum.logicmachine.net/showthread.php?tid=818&highlight=fb+editor
Find yours, import to user libraries, correct what you need and you can use it in FB under user blocks.
BR
RE: FBEditor log write - Thomas - 30.04.2018
Thank you
FYI FBE_Blocks_Control.luas
is the issue
Code: --- [Function] fbe_hysteresis_3_limits
--- Hysteresis with 3 limits
--- [Comment]
--- The module evaluates an input value in dependence on 3 freely definable limits (3 switch-on and 3 switch-off values).
--- When the limits are exceeded or dropped below, the outputs 1-3 are controlled operated.
--- If a limit has been exceeded (dropped below), first the limit must be dropped below (exceeded) again, before the output can be sent again if the limit is exceeded (dropped below) again.
--- [Input]
--- Input [object]
--- Limit 1 ON [value]
--- Limit 1 OFF [value]
--- Limit 2 ON [value]
--- Limit 2 OFF [value]
--- Limit 3 ON [value]
--- Limit 3 OFF [value]
--- [Output]
--- threshold1 - Threshold 1 [object, storage]
--- threshold2 - Threshold 2 [object, storage]
--- threshold3 - Threshold 3 [object, storage]
function fbe_hysteresis_3_limits(input, on1, off1, on2, off2, on3, off3, blockID)
local on = { on1, on2, on3 }
local off = { off1, off2, off3 }
local prevState = storage.get(blockID .. "_prevState") or {}
local out = {}
log(on)
log(off)
log(prevState)
for i=1,3 do
local state = 0
if on[i] ~= nil and input > on[i] then
state = 1
elseif off[i] ~= nil and input < off[i] then
state = -1
end
if state == 0 or prevState[i] == nil or prevState[i] == state then
out[i] = nil
else
out[i] = state > 0
end
prevState[i] = state
end
storage.set(blockID .. "_prevState", prevState)
return out[1], out[2], out[3]
end
|