Skip to content

Commit

Permalink
OLED Network speed change to eth1
Browse files Browse the repository at this point in the history
  • Loading branch information
wisdpi committed Aug 8, 2022
1 parent a949be8 commit 44a9001
Show file tree
Hide file tree
Showing 25 changed files with 5,601 additions and 1 deletion.
1 change: 0 additions & 1 deletion package/routerPi/luci-app-oled
Submodule luci-app-oled deleted from 304947
622 changes: 622 additions & 0 deletions package/routerPi/luci-app-oled/LICENSE

Large diffs are not rendered by default.

22 changes: 22 additions & 0 deletions package/routerPi/luci-app-oled/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#
# Copyright (C) 2020 Nate Ding
#
# This is free software, licensed under the GUN General Public License v3.
# See /LICENSE for more information.
#

include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-oled
LUCI_Title:=LuCI support for ssd1306 0.91\' 138x32 display
LUCI_PKGARCH:=all
LUCI_DEPENDS:=+i2c-tools +coreutils-nohup +libuci
PKG_VERSION:=1.0
PKG_RELEASE:=1.0

PKG_LICENSE:=GPLv3
PKG_LINCESE_FILES:=LICENSE
PKF_MAINTAINER:=natelol <[email protected]>

include $(TOPDIR)/feeds/luci/luci.mk

# call BuildPackage - OpenWrt buildroot signature
80 changes: 80 additions & 0 deletions package/routerPi/luci-app-oled/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# luci-app-oled

This is the LuCI app written for openwrt (**tested ~~only~~ on NanoPi R2S**) which supports ssd 1306 0.91' oled display.

**Raspberry Pi CM4**

This has been tested on Raspberry Pi CM4 as described in issue [#10](https://github.com/NateLol/luci-app-oled/issues/10#issuecomment-922245476).
You can find what revisions you need to make to have it work on your device.
Enjoy!

## Features|功能
---
### Dispaly Info|显示信息

**0. Enable|开启**

开启oled显示。

**1. Autoswitch|定时开关**

由于夜间oled的显示屏太亮,并且也几乎不会看它,所以应邀提供定时开关的功能,选中autoswitch之后,可以设置**显示**的起始和结束时间。

**2. Time|时间**

显示时间。

**3. IP|IP地址**

显示LAN口的IP地址,记得LAN口不可以去除**桥接**选项,否则失效。由于使用的是`br-lan`,因为不同固件可能会交换`eth0``eth1`

**4. CPU Temp|CPU温度**

显示CPU温度。

**5. CPU Freq|CPU频率**

显示实时CPU频率

**6. Network Speed|网速**

提供不同接口的选择,`eth0``eth1`,个人可以按需修改。网速单位基准为字节(Byte)而不是一般的位(bit),[MB/s, KB/s, B/s]这样显示的数字能够比较小,不至于过长。

**7. Display Interval|显示间隔**

为了延缓oled的光衰,提供屏保服务,每隔设定的时间运行一次屏保程序。

---
### Screensavers|屏保

屏保提供不同的选择,默认推荐的是`Scroll Text|文字滚动`,其他的选择自行探索。

## Q&A

Q0. 如何使用该程序?|在那里找到luci界面?

A0. 该程序安装位置在luci界面的`services|服务`下的`OLED`,点击即可找到。

---

Q1. 是否会支持其他oled屏幕,例如同系列的0.96'的?

A1. 由于开发者身边并没有相应的屏幕去调试,所以是暂时不考虑吧。如果你想贡献代码,非常欢迎,请开PR。

---


Q2. 为什么我的IP地址显示错误?

A2. 很大原因是你修改了LAN接口的属性,例如去除了该接口的**桥接**属性。

---


Q3. 为什么我的oled不显示?

A3. 很有可能是您的固件内核驱动不完整,该程序的运行需要在内核驱动中加上**kmod-i2c-xxx**,见issue [#10](https://github.com/NateLol/luci-app-oled/issues/10)

---

如果你在使用过程中还遇到问题,请开issue。
17 changes: 17 additions & 0 deletions package/routerPi/luci-app-oled/luasrc/controller/oled.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
module("luci.controller.oled", package.seeall)

function index()
if not nixio.fs.access("/etc/config/oled") then
return
end
entry({"admin", "services", "oled"}, alias("admin", "services", "oled", "setting"),_("OLED"), 10).dependent = true
entry({"admin", "services", "oled", "status"}, call("act_status"))
entry({"admin", "services", "oled", "setting"}, cbi("oled/setting"),_("Setting"),30).leaf = true
end

function act_status()
local e={}
e.running = luci.sys.call("pgrep -f /usr/bin/oled > /dev/null")==0
luci.http.prepare_content("application/json")
luci.http.write_json(e)
end
100 changes: 100 additions & 0 deletions package/routerPi/luci-app-oled/luasrc/model/cbi/oled/setting.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
m = Map("oled", translate("OLED"), translate("A LuCI app that helps you config your oled display (SSD1306, 0.91', 128X32) with screensavers! <br /> <br /> Any issues, please go to: ")..[[<a href="https://github.com/natelol/luci-app-oled" target="_blank">luci-app-oled</a>]])

--m.chain("luci")

m:section(SimpleSection).template="oled/status"

s = m:section(TypedSection, "oled", translate(""))
s.anonymous=true
s.addremove=false

--OPTIONS
s:tab("info", translate("Info Display"))
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
o = s:taboption("info", Flag, "lanip", translate("IP"), translate("LAN IP address"))
o.default=0
o = s:taboption("info", Flag, "cputemp", translate("CPU temperature"))
o.default=0
o = s:taboption("info", Flag, "cpufreq", translate("CPU frequency"))
o.default=0
o = s:taboption("info", Flag, "netspeed", translate("Network speed"), translate("1Mbps(m/s)=1,000Kbps(k/s)=1,000,000bps(b/s)"))
o.default=0
o = s:taboption("info", ListValue, "netsource", translate("which eth to monitor"))
o:value("eth0","eth0")
o:value("eth1","eth1")
o:depends("netspeed",'1')
o.default='eth0'
o = s:taboption("info", Value, "time", translate("Display interval(s)"), translate('Screensaver will activate in set seconds'))
o.default=0

--screensaver options--
o = s:taboption("screensaver", Flag, "scroll", translate("Scroll Text"))
o.default=1
o = s:taboption("screensaver", Value, "text", translate("Text you want to scroll"))
o:depends("scroll",'1')
o.default='OPENWRT'
o = s:taboption("screensaver", Flag, "drawline", translate("Draw Many Lines"))
o.default=0
o = s:taboption("screensaver", Flag, "drawrect", translate("Draw Rectangles"))
o.default=0
o = s:taboption("screensaver", Flag, "fillrect", translate("Draw Multiple Rectangles"))
o.default=0
o = s:taboption("screensaver", Flag, "drawcircle", translate("Draw Multiple Circles"))
o.default=0
o = s:taboption("screensaver", Flag, "drawroundrect", translate("Draw a white circle, 10 pixel radius"))
o.default=0
o = s:taboption("screensaver", Flag, "fillroundrect", translate("Fill the Round Rectangles"))
o.default=0
o = s:taboption("screensaver", Flag, "drawtriangle", translate("Draw Triangles"))
o.default=0
o = s:taboption("screensaver", Flag, "filltriangle", translate("Fill Triangles"))
o.default=0
o = s:taboption("screensaver", Flag, "displaybitmap", translate("Display miniature bitmap"))
o.default=0
o = s:taboption("screensaver", Flag, "displayinvertnormal", translate("Invert Display Normalize it"))
o.default=0
o = s:taboption("screensaver", Flag, "drawbitmapeg", translate("Draw a bitmap and animate"))
o.default=0

return m

















---
22 changes: 22 additions & 0 deletions package/routerPi/luci-app-oled/luasrc/view/oled/status.htm
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<script type="text/javascript">//<![CDATA[
XHR.poll(3, '<%=url([[admin]], [[services]], [[oled]], [[status]])%>', null,
function(x, data) {
var tb = document.getElementById('oled_status');
if (data && tb) {
if (data.running) {
var links = '<em><b><font color=green>OLED <%:RUNNING%></font></b></em>';
tb.innerHTML = links;
} else {
tb.innerHTML = '<em><b><font color=red>OLED <%:NOT RUNNING%></font></b></em>';
}
}
}
);
//]]>
</script>
<style>.mar-10 {margin-left: 50px; margin-right: 10px;}</style>
<fieldset class="cbi-section">
<p id="oled_status">
<em><%:Collecting data...%></em>
</p>
</fieldset>
143 changes: 143 additions & 0 deletions package/routerPi/luci-app-oled/po/zh_Hans/oled.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
msgid ""
msgstr "Content-Type: text/plain; charset=UTF-8"

#: ../../package/new/luci-app-oled/luasrc/model/cbi/oled/setting.lua:1
msgid ""
"A LuCI app that helps you config your oled display (SSD1306, 0.91', 128X32) "
"with screensavers! <br /> <br /> Any issues, please go to:"
msgstr "这是一款支持在ssd1306,0.91寸,128x32像素的oled显示屏上显示你要的信息,包含屏保的程序。<br /> <br />任何问题请到:"

#: ../../package/new/luci-app-oled/luasrc/model/cbi/oled/setting.lua:24
msgid "CPU frequency"
msgstr "CPU频率"

#: ../../package/new/luci-app-oled/luasrc/model/cbi/oled/setting.lua:22
msgid "CPU temperature"
msgstr "CPU温度"

msgid "Scroll Text"
msgstr "文字滚动"

msgid "Enable Auto switch"
msgstr "启用定时开关"

msgid "From"
msgstr "起始时间"

msgid "To"
msgstr "结束时间"

msgid "Text you want to scroll"
msgstr "你想要显示的文字"

msgid "which eth to monitor"
msgstr "选择监控哪个网口"

#: ../../package/new/luci-app-oled/luasrc/view/oled/status.htm:20
msgid "Collecting data..."
msgstr ""

#: ../../package/new/luci-app-oled/luasrc/model/cbi/oled/setting.lua:18
msgid "Date"
msgstr "时间"

#: ../../package/new/luci-app-oled/luasrc/model/cbi/oled/setting.lua:48
msgid "Display miniature bitmap"
msgstr "小图案"

#: ../../package/new/luci-app-oled/luasrc/model/cbi/oled/setting.lua:28
msgid "Display interval(s)"
msgstr "信息显示间隔(秒)"

#: ../../package/new/luci-app-oled/luasrc/model/cbi/oled/setting.lua:28
msgid "Screensaver will activate in set seconds"
msgstr "屏保每间隔设置的时间运行一次"
#: ../../package/new/luci-app-oled/luasrc/model/cbi/oled/setting.lua:32
msgid "Draw Many Lines"
msgstr "直线"

#: ../../package/new/luci-app-oled/luasrc/model/cbi/oled/setting.lua:38
msgid "Draw Multiple Circles"
msgstr "多圆"

#: ../../package/new/luci-app-oled/luasrc/model/cbi/oled/setting.lua:36
msgid "Draw Multiple Rectangles"
msgstr "多方块"

#: ../../package/new/luci-app-oled/luasrc/model/cbi/oled/setting.lua:34
msgid "Draw Rectangles"
msgstr "方块"

#: ../../package/new/luci-app-oled/luasrc/model/cbi/oled/setting.lua:44
msgid "Draw Triangles"
msgstr "三角形"

#: ../../package/new/luci-app-oled/luasrc/model/cbi/oled/setting.lua:54
msgid "Draw a bitmap and animate"
msgstr "动图"

#: ../../package/new/luci-app-oled/luasrc/model/cbi/oled/setting.lua:52
msgid "Draw a bitmap and animate movement"
msgstr "变化图"

#: ../../package/new/luci-app-oled/luasrc/model/cbi/oled/setting.lua:40
msgid "Draw a white circle, 10 pixel radius"
msgstr "实心圆"

#: ../../package/new/luci-app-oled/luasrc/model/cbi/oled/setting.lua:15
msgid "Enable"
msgstr "启用"

#: ../../package/new/luci-app-oled/luasrc/model/cbi/oled/setting.lua:46
msgid "Fill Triangles"
msgstr "三角填充"

#: ../../package/new/luci-app-oled/luasrc/model/cbi/oled/setting.lua:42
msgid "Fill the Round Rectangles"
msgstr "方形填充"

#: ../../package/new/luci-app-oled/luasrc/model/cbi/oled/setting.lua:18
msgid "Format YYYY-MM-DD HH:MM:SS"
msgstr "日期格式 YYYY-MM-DD HH:MM:SS"

#: ../../package/new/luci-app-oled/luasrc/model/cbi/oled/setting.lua:20
msgid "IP"
msgstr ""

#: ../../package/new/luci-app-oled/luasrc/model/cbi/oled/setting.lua:12
msgid "Info Display"
msgstr "显示信息"

#: ../../package/new/luci-app-oled/luasrc/model/cbi/oled/setting.lua:50
msgid "Invert Display Normalize it"
msgstr "反转"

#: ../../package/new/luci-app-oled/luasrc/model/cbi/oled/setting.lua:20
msgid "LAN IP address"
msgstr "LAN地址"

#: ../../package/new/luci-app-oled/luasrc/view/oled/status.htm:10
msgid "NOT RUNNING"
msgstr ""

#: ../../package/new/luci-app-oled/luasrc/model/cbi/oled/setting.lua:26
msgid "Network speed"
msgstr "网速"

#: ../../package/new/luci-app-oled/luasrc/controller/oled.lua:7
#: ../../package/new/luci-app-oled/luasrc/model/cbi/oled/setting.lua:1
#: ../../package/new/luci-app-oled/luasrc/model/cbi/oled/setting.lua:7
msgid "OLED"
msgstr ""

#: ../../package/new/luci-app-oled/luasrc/view/oled/status.htm:7
msgid "RUNNING"
msgstr ""

#: ../../package/new/luci-app-oled/luasrc/controller/oled.lua:9
msgid "Setting"
msgstr "设置"

#: ../../package/new/luci-app-oled/luasrc/model/cbi/oled/setting.lua:13
msgid "screensaver"
msgstr "屏保"
Loading

0 comments on commit 44a9001

Please sign in to comment.