1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-02-14 19:41:51 +00:00

Fix checkbox for SQM

This commit is contained in:
Ycarus 2019-04-04 09:40:08 +02:00
parent f28313e61d
commit c9192c9522
2 changed files with 7 additions and 6 deletions

View file

@ -1,9 +1,10 @@
local math = require "math"
local tools = require "luci.tools.status"
local sys = require "luci.sys"
local json = require("luci.json")
local fs = require("nixio.fs")
local net = require "luci.model.network".init()
local ucic = luci.model.uci.cursor()
local ucic = luci.model.uci.cursor()
module("luci.controller.openmptcprouter", package.seeall)
function index()
@ -219,15 +220,15 @@ function wizard_add()
if downloadspeed ~= "0" and uploadspeed ~= "0" then
ucic:set("network",intf,"downloadspeed",downloadspeed)
ucic:set("network",intf,"uploadspeed",uploadspeed)
ucic:set("sqm",intf,"download",downloadspeed*95/100)
ucic:set("sqm",intf,"upload",uploadspeed*95/100)
ucic:set("sqm",intf,"download",math.ceil(downloadspeed*95/100))
ucic:set("sqm",intf,"upload",math.ceil(uploadspeed*95/100))
if sqmenabled == "1" then
ucic:set("sqm",intf,"enabled","1")
else
ucic:set("sqm",intf,"enabled","0")
end
ucic:set("qos",intf,"download",downloadspeed*95/100)
ucic:set("qos",intf,"upload",uploadspeed*95/100)
ucic:set("qos",intf,"download",math.ceil(downloadspeed*95/100))
ucic:set("qos",intf,"upload",math.ceil(uploadspeed*95/100))
if sqmenabled == "1" then
ucic:set("qos",intf,"enabled","1")
else

View file

@ -307,7 +307,7 @@ end
<div class="cbi-value" data-index="5">
<label class="cbi-value-title"><%:Enable SQM%></label>
<div class="cbi-value-field">
<input class="cbi-input-checkbox" type="checkbox" name="sqmenabled" value="1" <% if uci:get("sqm",ifname,"enabled") == 1 then %>checked<% end %> />
<input class="cbi-input-checkbox" type="checkbox" name="cbid.sqm.enabled" value="1" <% if uci:get("sqm",ifname,"enabled") == 1 then %>checked<% end %> />
<br />
<div class="cbi-value-description">
<%:You should disable SQM for LTE or any interfaces with variable speed.%>