forked from sqm-autorate/sqm-autorate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpretty_speeds.lua
54 lines (45 loc) · 1.91 KB
/
pretty_speeds.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
--[[
pretty_speeds.lua: make the CAKE speed settings 'prettier'
Copyright © 2022
Charles Corrigan mailto:[email protected] (github @chas-iot)
This source code file contains a minimal functional demonstration of the
plugin interface for the sqm-autorate program. This file is licensed for
plugin development under any Open Source license that is compatible with
the MPLv2 of the sqm-autorate programs and, for that purpose, this file
may be re-used, with or without the copyright statement above.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.
]] --
-- The module table to export
local pretty_speeds = {}
-- utility function to import in pretty_speeds.initialise
local ceil = nil
-- function initialise(requires, settings)
-- parameters
-- requires -- table of requires from main
-- settings -- table of settings values from main
-- returns
-- pretty_speeds -- the module, for a fluent interface
function pretty_speeds.initialise(requires, settings)
local math = requires.math
ceil = math.ceil
return pretty_speeds
end
-- function process(readings)
-- parameters
-- readings -- table of readings values from main
-- returns
-- results -- table of results
function pretty_speeds.process(readings)
return {
next_ul_rate = ceil(readings.next_ul_rate / 1000) * 1000,
next_dl_rate = ceil(readings.next_dl_rate / 1000) * 1000,
}
end
-- return the module
return pretty_speeds