12 Commits

Author SHA1 Message Date
星光-k
29de2a7d77 Update install.sh 2025-01-12 01:47:10 +08:00
星光-k
b6422c9afa Update install.sh 2025-01-12 01:39:08 +08:00
星光-k
9be8d1ac22 Update e-Paper_clean.service 2025-01-12 01:12:08 +08:00
星光-k
3d724ac527 Update clean.sh 2025-01-12 01:01:16 +08:00
星光-k
35facc30f0 Update clean.sh 2025-01-12 01:00:55 +08:00
星光-k
af205dc591 Update clean.sh 2025-01-12 00:58:42 +08:00
星光-k
ef387ebf4b Update e-Paper_clean.service 2025-01-12 00:28:27 +08:00
星光-k
6ac8e7d4b7 Update raspi_e-Paper.service 2025-01-12 00:26:59 +08:00
星光-k
a869fc1911 Update e-Paper_clean.service 2025-01-12 00:03:53 +08:00
星光-k
a2e657a182 Update README.md 2025-01-11 23:47:42 +08:00
星光-k
a29377cfa7 Update README.md 2025-01-11 23:46:05 +08:00
星光-k
08111ca4fa Update e-Paper_clean.service 2025-01-11 23:19:42 +08:00
5 changed files with 19 additions and 10 deletions

View File

@@ -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 排针上去,注意对好引脚。

View File

@@ -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会话已结束。"

View File

@@ -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

View File

@@ -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
}

View File

@@ -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