fluidcanvas_r2pi:tft_boot_splash_and_status_display_guide
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| fluidcanvas_r2pi:tft_boot_splash_and_status_display_guide [2026/03/21 23:25] – hyjeong | fluidcanvas_r2pi:tft_boot_splash_and_status_display_guide [2026/03/27 21:40] (current) – [9. 문제 해결] hyjeong | ||
|---|---|---|---|
| Line 4: | Line 4: | ||
| ## 개요 | ## 개요 | ||
| - | 이 문서는 Raspberry Pi에서 SPI TFT (/ | + | 이 문서는 Raspberry Pi에서 |
| - | 1. 부팅 시 splash 이미지 표시 | + | 1. 부팅 시 splash 이미지 표시 |
| - | 2. 부팅 완료 후 shell에서 fluidardule_status.py를 실행하여 | + | 2. 부팅 완료 후 시스템 정보(시간, |
| --- | --- | ||
| Line 13: | Line 13: | ||
| ## 1. 필요한 패키지 설치 | ## 1. 필요한 패키지 설치 | ||
| + | fbi는 이미 설치되어 있다고 가정한다. | ||
| ```bash | ```bash | ||
| Line 21: | Line 22: | ||
| --- | --- | ||
| - | ## 2. Splash 이미지 | + | ## 2. Splash 이미지 |
| + | |||
| + | [480x320p Splash 이미지]( | ||
| + | https:// | ||
| ```bash | ```bash | ||
| - | ls -l / | + | ls -l / |
| ``` | ``` | ||
| --- | --- | ||
| - | ## 3. Splash 스크립트 | + | ## 3. Splash |
| ```bash | ```bash | ||
| - | sudo nano /usr/ | + | nano |
| + | ~/scripts/ | ||
| ``` | ``` | ||
| Line 43: | Line 48: | ||
| ```bash | ```bash | ||
| - | sudo chmod +x /usr/ | + | sudo chmod +x ~/scripts/ |
| ``` | ``` | ||
| Line 50: | Line 55: | ||
| ## 4. 상태 화면 스크립트(~/ | ## 4. 상태 화면 스크립트(~/ | ||
| + | ```` | ||
| + | # | ||
| + | from PIL import Image, ImageDraw, ImageFont | ||
| + | import subprocess | ||
| + | from pathlib import Path | ||
| + | W, H = 480, 320 | ||
| + | OUT = Path("/ | ||
| + | |||
| + | FONT_BOLD = "/ | ||
| + | FONT_REG | ||
| + | |||
| + | def run_cmd(cmd): | ||
| + | try: | ||
| + | result = subprocess.run( | ||
| + | cmd, shell=True, capture_output=True, | ||
| + | ) | ||
| + | return result.stdout.strip() | ||
| + | except Exception: | ||
| + | return "" | ||
| + | |||
| + | def get_status(): | ||
| + | hostname = run_cmd(" | ||
| + | time_str = run_cmd(" | ||
| + | ip_str = run_cmd(" | ||
| + | if not ip_str: | ||
| + | ip_str = "no network" | ||
| + | |||
| + | cpu_load = run_cmd(" | ||
| + | cpu_temp = run_cmd(" | ||
| + | mem = run_cmd(" | ||
| + | |||
| + | return { | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | } | ||
| + | |||
| + | def render(status): | ||
| + | img = Image.new(" | ||
| + | draw = ImageDraw.Draw(img) | ||
| + | |||
| + | font_title = ImageFont.truetype(FONT_BOLD, | ||
| + | font_label = ImageFont.truetype(FONT_BOLD, | ||
| + | font_text | ||
| + | |||
| + | # 제목 | ||
| + | draw.text((W // 2, 18), " | ||
| + | draw.line((20, | ||
| + | |||
| + | items = [ | ||
| + | (" | ||
| + | (" | ||
| + | (" | ||
| + | (" | ||
| + | (" | ||
| + | (" | ||
| + | ] | ||
| + | |||
| + | y = 70 | ||
| + | for label, value in items: | ||
| + | draw.text((24, | ||
| + | draw.text((110, | ||
| + | y += 36 | ||
| + | |||
| + | draw.line((20, | ||
| + | draw.text((W // 2, H - 28), " | ||
| + | |||
| + | img.save(OUT) | ||
| + | |||
| + | def show(): | ||
| + | subprocess.run( | ||
| + | [" | ||
| + | check=False | ||
| + | ) | ||
| + | |||
| + | def main(): | ||
| + | status = get_status() | ||
| + | render(status) | ||
| + | show() | ||
| + | |||
| + | if __name__ == " | ||
| + | main() | ||
| + | ```` | ||
| + | |||
| + | ```bash | ||
| + | sudo chmod +x ~/ | ||
| + | ``` | ||
| --- | --- | ||
| Line 67: | Line 162: | ||
| [Service] | [Service] | ||
| Type=oneshot | Type=oneshot | ||
| - | ExecStart=/usr/local/bin/ | + | ExecStart=/home/pi/scripts/ |
| RemainAfterExit=yes | RemainAfterExit=yes | ||
| Line 79: | Line 174: | ||
| ```bash | ```bash | ||
| - | sudo nano / | + | sudo nano / |
| ``` | ``` | ||
| Line 90: | Line 185: | ||
| [Service] | [Service] | ||
| Type=oneshot | Type=oneshot | ||
| - | ExecStart=/usr/local/bin/tft-status.sh | + | ExecStart=/home/pi/scripts/fluidardule_status.py |
| [Install] | [Install] | ||
| Line 103: | Line 198: | ||
| sudo systemctl daemon-reload | sudo systemctl daemon-reload | ||
| sudo systemctl enable tft-splash.service | sudo systemctl enable tft-splash.service | ||
| + | sudo systemctl enable fluid_ardule.service | ||
| ``` | ``` | ||
| Line 120: | Line 216: | ||
| systemctl status tft-splash.service | systemctl status tft-splash.service | ||
| journalctl -u tft-splash.service -b | journalctl -u tft-splash.service -b | ||
| + | systemctl status fluid_ardule.service -b | ||
| + | journalctl -u fluid_ard | ||
| + | ule.service -b | ||
| ``` | ``` | ||
| + | --- | ||
| + | ## 서비스를 아예 끄려면(재부팅 후에도 불활성화) | ||
| + | ```` | ||
| + | sudo systemctl stop tft-splash.service | ||
| + | sudo systemctl stop fluid_ardule.service | ||
| + | sudo systemctl disable tft-splash.service | ||
| + | sudo systemctl disable fluid_ardule.service | ||
| + | ```` | ||
| --- | --- | ||
| Line 135: | Line 242: | ||
| ## 핵심 요약 | ## 핵심 요약 | ||
| - | * splash는 fbi로 빠르게 표시 | + | * splash는 fbi로 |
| + | 빠르게 표시 | ||
| * systemd로 자동 실행 | * systemd로 자동 실행 | ||
| * fbi는 항상 덮어쓰기 방식 사용 | * fbi는 항상 덮어쓰기 방식 사용 | ||
fluidcanvas_r2pi/tft_boot_splash_and_status_display_guide.1774103131.txt.gz · Last modified: by hyjeong
