luci-app-oled: sync with upstream source
This commit is contained in:
parent
932c0dd436
commit
56ae997a7a
@ -14,6 +14,23 @@ s:tab("screensaver", translate("screensaver"))
|
||||
|
||||
o = s:taboption("info", Flag, "enable", translate("Enable"))
|
||||
o.default=0
|
||||
o = s:taboption("info", Flag, "autoswitch", translate("Enable Auto switch"))
|
||||
o.default=0
|
||||
from = s:taboption("info", ListValue, "from", translate("From"))
|
||||
to = s:taboption("info", ListValue, "to", translate("To"))
|
||||
for i=0,23 do
|
||||
for j=0,30,30 do
|
||||
from:value(i*60+j,string.format("%02d:%02d",i,j))
|
||||
to:value(i*60+j,string.format("%02d:%02d",i,j))
|
||||
end
|
||||
end
|
||||
from:value(1440,"24:00")
|
||||
to:value(1440,"24:00")
|
||||
from:depends("autoswitch",'1')
|
||||
to:depends("autoswitch",'1')
|
||||
from.default=0
|
||||
to.default=1440
|
||||
|
||||
--informtion options----
|
||||
o = s:taboption("info", Flag, "date", translate("Date"), translate('Format YYYY-MM-DD HH:MM:SS'))
|
||||
o.default=0
|
||||
|
||||
@ -18,6 +18,15 @@ msgstr "CPU温度"
|
||||
msgid "Scroll Text"
|
||||
msgstr "文字滚动"
|
||||
|
||||
msgid "Enable Auto switch"
|
||||
msgstr "启用定时开关"
|
||||
|
||||
msgid "From"
|
||||
msgstr "起始时间"
|
||||
|
||||
msgid "To"
|
||||
msgstr "结束时间"
|
||||
|
||||
msgid "Text you want to scroll"
|
||||
msgstr "你想要显示的文字"
|
||||
|
||||
|
||||
@ -17,4 +17,6 @@ config oled
|
||||
option cputemp '1'
|
||||
option time '60'
|
||||
option enable '0'
|
||||
|
||||
option from '0'
|
||||
option to '1440'
|
||||
option autoswitch '0'
|
||||
|
||||
@ -3,11 +3,34 @@ START=1OO
|
||||
|
||||
PROG=/usr/bin/oled
|
||||
|
||||
stop() {
|
||||
kill -2 $(pgrep /usr/bin/oled)
|
||||
kill -9 $(pgrep -f /usr/sbin/netspeed)
|
||||
echo "oled exit..."
|
||||
}
|
||||
|
||||
start() {
|
||||
enabled=$(uci get oled.@oled[0].enable)
|
||||
if [ $enabled -eq 0 ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
autoswitch=$(uci get oled.@oled[0].autoswitch)
|
||||
from=$(uci get oled.@oled[0].from)
|
||||
to=$(uci get oled.@oled[0].to)
|
||||
|
||||
if [ ${autoswitch} -eq 1 ]; then
|
||||
hour=$(date +"%H")
|
||||
min=$(date +"%M")
|
||||
ihour=`expr $hour + 0`
|
||||
imin=`expr $min + 0`
|
||||
now=$(($ihour*60+$imin))
|
||||
if [[ $now -lt $from || $now -gt $to ]]; then
|
||||
stop
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
#crontab daemon
|
||||
if ! grep "/etc/init.d/oled \+restart" /etc/crontabs/root >/dev/null 2>&1; then
|
||||
echo "*/5 * * * * /etc/init.d/oled restart >/dev/null 2>&1" >> /etc/crontabs/root
|
||||
@ -33,6 +56,8 @@ start() {
|
||||
scroll=$(uci get oled.@oled[0].scroll)
|
||||
text=$(uci get oled.@oled[0].text)
|
||||
netsource=$(uci get oled.@oled[0].netsource)
|
||||
|
||||
|
||||
if [ ${netspeed} -eq 1 ]; then
|
||||
nohup /usr/sbin/netspeed ${netsource} >/dev/null 2>&1 &
|
||||
else
|
||||
@ -43,19 +68,27 @@ start() {
|
||||
}
|
||||
|
||||
|
||||
stop() {
|
||||
kill -2 $(pgrep /usr/bin/oled)
|
||||
kill -9 $(pgrep -f /usr/sbin/netspeed)
|
||||
echo "oled exit..."
|
||||
}
|
||||
|
||||
|
||||
restart(){
|
||||
enabled=$(uci get oled.@oled[0].enable)
|
||||
pgrep -f ${PROG} >/dev/null
|
||||
if [ $? -eq 0 ]; then
|
||||
if [ $enabled -eq 1 ]; then
|
||||
kill -9 $(pgrep /usr/bin/oled)
|
||||
kill -9 $(pgrep -f /usr/sbin/netspeed)
|
||||
autoswitch=$(uci get oled.@oled[0].autoswitch)
|
||||
from=$(uci get oled.@oled[0].from)
|
||||
to=$(uci get oled.@oled[0].to)
|
||||
if [ ${autoswitch} -eq 1 ]; then
|
||||
hour=$(date +"%H")
|
||||
min=$(date +"%M")
|
||||
ihour=`expr $hour + 0`
|
||||
imin=`expr $min + 0`
|
||||
now=$(($ihour*60+$imin))
|
||||
if [[ $now -lt $from || $now -gt $to ]]; then
|
||||
stop
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
date=$(uci get oled.@oled[0].date)
|
||||
lanip=$(uci get oled.@oled[0].lanip)
|
||||
@ -77,6 +110,11 @@ restart(){
|
||||
scroll=$(uci get oled.@oled[0].scroll)
|
||||
text=$(uci get oled.@oled[0].text)
|
||||
netsource=$(uci get oled.@oled[0].netsource)
|
||||
|
||||
|
||||
kill -9 $(pgrep /usr/bin/oled)
|
||||
kill -9 $(pgrep -f /usr/sbin/netspeed)
|
||||
|
||||
if [ ${netspeed} -eq 1 ]; then
|
||||
nohup /usr/sbin/netspeed ${netsource} >/dev/null 2>&1 &
|
||||
else
|
||||
|
||||
Loading…
Reference in New Issue
Block a user