From c9192c952231c133dfb3fc5331804e0692fd9f6d Mon Sep 17 00:00:00 2001 From: Ycarus Date: Thu, 4 Apr 2019 09:40:08 +0200 Subject: [PATCH] Fix checkbox for SQM --- .../luasrc/controller/openmptcprouter.lua | 11 ++++++----- .../luasrc/view/openmptcprouter/wizard.htm | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/luci-app-openmptcprouter/luasrc/controller/openmptcprouter.lua b/luci-app-openmptcprouter/luasrc/controller/openmptcprouter.lua index 63ca0a782..d3fcb9978 100644 --- a/luci-app-openmptcprouter/luasrc/controller/openmptcprouter.lua +++ b/luci-app-openmptcprouter/luasrc/controller/openmptcprouter.lua @@ -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 diff --git a/luci-app-openmptcprouter/luasrc/view/openmptcprouter/wizard.htm b/luci-app-openmptcprouter/luasrc/view/openmptcprouter/wizard.htm index d7791c00e..620577633 100644 --- a/luci-app-openmptcprouter/luasrc/view/openmptcprouter/wizard.htm +++ b/luci-app-openmptcprouter/luasrc/view/openmptcprouter/wizard.htm @@ -307,7 +307,7 @@ end
- checked<% end %> /> + checked<% end %> />
<%:You should disable SQM for LTE or any interfaces with variable speed.%>