User Tools

Site Tools


curves

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
curves [2020/07/31 12:53] atolstovcurves [2022/01/14 13:40] – ↷ Links adapted because of a move operation emozolyak
Line 1: Line 1:
 +{{ network:menu-icon-curves.png?nolink&60|}}
 ======Curves====== ======Curves======
 =====Introduction===== =====Introduction=====
Line 55: Line 56:
 {{ :curve:c6.png?direct&600 |}}\\  {{ :curve:c6.png?direct&600 |}}\\ 
 =====Select a curve to put in register===== =====Select a curve to put in register=====
-<del>First, to get value from curve you need the curves and the register pre-created.</del> 
- 
 To get the value you need: To get the value you need:
   - Have a curve   - Have a curve
Line 90: Line 89:
 {{ :curve:reg_filled_with_equat.png?direct&600 |}} {{ :curve:reg_filled_with_equat.png?direct&600 |}}
  
-=====Get value from the curve=====+=====Get value from the curve via Lua =====
  
 To get the **OUTPUT y value** from existing(pre-created) curve, you need: To get the **OUTPUT y value** from existing(pre-created) curve, you need:
Line 136: Line 135:
 <code lua - Getter> <code lua - Getter>
 include "curves.lib" include "curves.lib"
 +SAFE_VALUE = 10
  
 function main (userId) function main (userId)
Line 142: Line 142:
     current_hour = tonumber(t.hour)     current_hour = tonumber(t.hour)
     curve_status, y = GetCurveValue( "curve_for_current_hour", current_hour )     curve_status, y = GetCurveValue( "curve_for_current_hour", current_hour )
-    WriteReg("value_for_current_hour", y) +    if curve_status then 
 +        WriteReg("value_for_current_hour", y) 
 +    else 
 +        WriteReg("value_for_current_hour", SAFE_VALUE) 
 +    end 
 +        
  
 end end
curves.txt · Last modified: 2022/05/24 08:52 by emozolyak

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki