mirror of
https://github.com/kxgx/2.13-Ink-screen-clock.git
synced 2026-03-15 07:03:16 +08:00
Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
29de2a7d77 | ||
|
|
b6422c9afa | ||
|
|
9be8d1ac22 | ||
|
|
3d724ac527 | ||
|
|
35facc30f0 | ||
|
|
af205dc591 | ||
|
|
ef387ebf4b | ||
|
|
6ac8e7d4b7 | ||
|
|
a869fc1911 | ||
|
|
a2e657a182 | ||
|
|
a29377cfa7 | ||
|
|
08111ca4fa |
@@ -1,8 +1,9 @@
|
||||
# 墨水屏展示当前时间及天气数据
|
||||
|
||||
首先感谢上游https://github.com/Seek-Huang/2.13-Ink-screen-clock 的代码仓库
|
||||
本项目复刻自[Seek-Huang](https://github.com/Seek-Huang/2.13-Ink-screen-clock)的代码仓库
|
||||
并在此基础上进行改进
|
||||
|
||||
## 本仓库已添加一键安装部署脚本
|
||||
## 本仓库已添加[一键安装部署脚本](https://github.com/kxgx/2.13-Ink-screen-clock#%E4%BD%BF%E7%94%A8%E8%84%9A%E6%9C%AC%E7%9B%B4%E6%8E%A5%E5%AE%89%E8%A3%85%E6%8E%A8%E8%8D%90)
|
||||
注意:请先配置完需要的硬件以及系统配置操作再运行脚本
|
||||
|
||||
## API说明:
|
||||
@@ -29,7 +30,7 @@
|
||||
ps:如果没有使用此模块则需要更改代码内容,以避免运行出错。
|
||||
以上可能python脚本已解决
|
||||
|
||||
ps:代码里需要nc命令需要安装netcat,安装内容已集成到“需要安装的软件和依赖“https://github.com/kxgx/2.13-Ink-screen-clock#%E9%9C%80%E8%A6%81%E5%AE%89%E8%A3%85%E7%9A%84%E8%BD%AF%E4%BB%B6%E5%92%8C%E4%BE%9D%E8%B5%96
|
||||
ps:代码里需要nc命令需要安装netcat,安装内容已集成到“[需要安装的软件和依赖](https://github.com/kxgx/2.13-Ink-screen-clock#%E9%9C%80%E8%A6%81%E5%AE%89%E8%A3%85%E7%9A%84%E8%BD%AF%E4%BB%B6%E5%92%8C%E4%BE%9D%E8%B5%96)"
|
||||
|
||||
### 墨水屏2.13inch e-Paper HAT+硬件连接
|
||||
连接树莓派的时候,可以直接将板子插到树莓派的 40PIN 排针上去,注意对好引脚。
|
||||
|
||||
11
bin/clean.sh
11
bin/clean.sh
@@ -5,6 +5,14 @@ dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
|
||||
logdir=${dir%/*}
|
||||
screen_name="clean_screen"
|
||||
service_name="raspi_e-Paper.service"
|
||||
hold_time_seconds=5 # 设置维持时间,例如300秒(5分钟)
|
||||
|
||||
# 创建一个新的screen会话并运行Python脚本
|
||||
screen -dmS $screen_name /usr/bin/python3 -u $dir/$f_name > $logdir/log/clean-info.log 2>&1
|
||||
|
||||
# 等待维持时间
|
||||
echo "正在运行脚本,将在 ${hold_time_seconds} 秒后停止服务..."
|
||||
sleep $hold_time_seconds
|
||||
|
||||
# 停止raspi_e-Paper服务
|
||||
echo "正在停止$service_name服务..."
|
||||
@@ -16,5 +24,4 @@ for pid in $pids; do
|
||||
screen -S $pid -X quit
|
||||
done
|
||||
|
||||
# 创建一个新的screen会话并运行Python脚本
|
||||
screen -dmS $screen_name /usr/bin/python3 -u $dir/$f_name > $logdir/log/clean-info.log 2>&1
|
||||
echo "脚本运行完成,服务已停止,screen会话已结束。"
|
||||
|
||||
@@ -8,7 +8,7 @@ Before=reboot.target
|
||||
Type=oneshot
|
||||
ExecStart=/bin/bash /root/2.13-Ink-screen-clock/bin/clean.sh
|
||||
RemainAfterExit=yes
|
||||
TimeoutSec=5s
|
||||
TimeoutSec=5
|
||||
|
||||
[Install]
|
||||
WantedBy=shutdown.target
|
||||
|
||||
@@ -147,7 +147,7 @@ install_packages() {
|
||||
echo "系统更新失败" >&2
|
||||
exit 1
|
||||
fi
|
||||
if ! sudo apt-get install -y git pigpio raspi-config netcat gawk python3-dev python3-pip python3-pil python3-numpy python3-gpiozero python3-pigpio build-essential screen; then
|
||||
if ! sudo apt-get install -y git pigpio raspi-config netcat* gawk python3-dev python3-pip python3-pil python3-numpy python3-gpiozero python3-pigpio build-essential screen; then
|
||||
echo "软件包安装失败" >&2
|
||||
exit 1
|
||||
fi
|
||||
@@ -155,8 +155,9 @@ install_packages() {
|
||||
|
||||
# 安装pip包函数
|
||||
install_pip_packages() {
|
||||
if ! sudo pip3 install -i "$PIPY_MIRROR" spidev borax pillow requests; then
|
||||
if ! sudo pip3 install -i "$PIPY_MIRROR" spidev borax pillow requests --break-system-packages; then
|
||||
echo "pip软件包安装包失败" >&2
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
[Unit]
|
||||
Description=Raspi e-Paper Service
|
||||
After=network-online.target
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=forking
|
||||
# 等待网络完全启动
|
||||
#ExecStartPre=systemd-networkd-wait-online --timeout=30
|
||||
ExecStartPre=/bin/bash -c 'until ping -c1 baidu.com &>/dev/null; do sleep 1; done'
|
||||
ExecStart=/root/2.13-Ink-screen-clock/bin/start.sh
|
||||
ExecStop=/usr/bin/screen -S main_screen -X quit
|
||||
Restart=on-failure
|
||||
|
||||
Reference in New Issue
Block a user