# PI4B_oled_page **Repository Path**: tonsen-wei/pi4-b_oled_page ## Basic Information - **Project Name**: PI4B_oled_page - **Description**: 在树莓派4B上移植WouoUI-PageVersion框架,并在此框架基础上增加树莓派4B的一些功能。 - **Primary Language**: Unknown - **License**: MPL-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-07-07 - **Last Updated**: 2025-07-09 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 树莓派4B OLED菜单框架移植 ## 简介 硬件: - 树莓派4B - 128x64 OLED(I2C),驱动IC SSD1306 - EC11编码器 软件及框架: - 树莓派GPIO库: pigpio - 树莓派I2C库: smbus2 - OLED UI库: WouoUI-Page ## 硬件连接 | 树莓派IO | 外设 | | ----------- | ----------- | | GPIO2(SDA) | OLED SDA | | GPIO3(SCL) | OLED SCL | | GPIO4 | EC11 A | | GPIO17 | EC11 B | | GPIO27 | EC11 Push | ## 编译运行 树莓派系统环境:CPU已超频至2GHz, I2C配置为1Mhz. 树莓派操作系统信息: ```shell uname -a Linux rpi 6.12.34+rpt-rpi-v8 #1 SMP PREEMPT Debian 1:6.12.34-1+rpt1~bookworm (2025-06-26) aarch64 GNU/Linux ``` ![uname](docs/images/image.png) 安装依赖(树莓派常用依赖,记不住都安装了哪些了,视情况安装): ```shell sudo apt install -y pigpio libi2c-dev i2c-tools build-essential ``` 编译: ```shell mkdir build cd build cmake .. make ``` ![build](docs/images/image-1.png) 运行程序: ```shell sudo ./bin/oled_page ``` ![run](docs/images/image-2.png) ## 展示 ![pic1](docs/images/image-3.png) ![pic2](docs/images/image-4.png) 操作说明: - 编码器单击:对应确定 - 编码器正转:对应向上 - 编码器反转:对应向下 - 编码器双击:对应返回 - 编码器长按:进入现实系统信息页面,或者返回菜单 ## 更新 - 2025-07-07 增加默认显示系统信息页面:IP和cpu温度和使用率、内存使用率、硬盘使用率页面,单击进入菜单,再次长按返回显示系统信息页面。 ![infoPage](docs/images/image-5.png) ## 其他说明 1. 当前使用i2c,动画比较卡 可修改WouoUI.c中g_default_ui_para的ani_param中的动画速度为跟WouoUI_Proc(5)一致则表示没有动画,可以提高帧率 2. 配置程序开机自启动 创建并编辑文件: ```shell sudo touch /etc/systemd/system/oled-page.service sudo vim /etc/systemd/system/oled-page.service ``` 文件内容: ```shell [Unit] Description=OLED Page Service After=multi-user.target [Service] ExecStart=/home/admin/prjs/bak/oled_page/build/bin/oled_page ExecStop=/bin/kill -SIGTERM $MAINPID TimeoutStopSec=5 KillMode=process WorkingDirectory=/home/admin/prjs/bak/oled_page/build/bin/ User=root Group=root Restart=always StandardOutput=syslog StandardError=syslog SyslogIdentifier=oled_page [Install] WantedBy=multi-user.target ``` 编辑完整后启动服务: ```shell sudo systemctl daemon-reexec sudo systemctl daemon-reload sudo systemctl enable oled-page.service sudo systemctl start oled-page.service sudo systemctl status oled-page.service ``` 常用命令: ```shell sudo systemctl daemon-reexec sudo systemctl daemon-reload sudo systemctl enable oled-page.service sudo systemctl start oled-page.service sudo systemctl status oled-page.service sudo systemctl daemon-reload sudo systemctl restart oled-page.service sudo systemctl stop oled-page.service sudo systemctl disable oled-page.service sudo journalctl -u oled-page.service //查看日志 stress-ng --cpu 0 // CPU压测指令 ``` ## 参考(鸣谢) [https://github.com/Sheep118/WouoUI-PageVersion](https://github.com/Sheep118/WouoUI-PageVersion)