diff --git a/.github/workflows/test-on-rpi.yml b/.github/workflows/test-on-rpi.yml index 720a64e..5e3f014 100644 --- a/.github/workflows/test-on-rpi.yml +++ b/.github/workflows/test-on-rpi.yml @@ -1,4 +1,4 @@ -name: Raspberry Pi build +name: Test on Raspberry Pi OS on: push: @@ -29,7 +29,7 @@ jobs: TINDIE_USERNAME: ${{ secrets.TINDIE_USERNAME }} with: # Set the base_image to the desired Raspberry Pi OS version - base_image: https://downloads.raspberrypi.com/raspios_lite_armhf/images/raspios_lite_armhf-2023-12-11/2023-12-11-raspios-bookworm-armhf-lite.img.xz + base_image: https://downloads.raspberrypi.com/raspios_lite_armhf/images/raspios_lite_armhf-2024-03-15/2024-03-15-raspios-bookworm-armhf-lite.img.xz image_additional_mb: 3072 # enlarge free space to 3GB optimize_image: true # user: inky --> not supported? @@ -42,10 +42,9 @@ jobs: whoami cd /home/inky sudo apt-get update -y - - sudo apt-get install zlib1g libjpeg-dev libatlas-base-dev rustc libopenjp2-7 python3-dev scons libssl-dev python3-venv python3-pip git libfreetype6-dev wkhtmltopdf libopenblas-dev -y + sudo apt-get install git zlib1g libjpeg-dev libatlas-base-dev rustc libopenjp2-7 python3-dev scons libssl-dev python3-venv python3-pip git libfreetype6-dev wkhtmltopdf libopenblas-dev -y echo $PWD && ls - git clone --branch main --single-branch https://github.com/aceinnolab/Inkycal + git clone https://github.com/aceinnolab/Inkycal cd Inkycal python3.11 -m venv venv . venv/bin/activate diff --git a/.github/workflows/update-os.yml b/.github/workflows/update-os.yml index 00d8b3e..49ea466 100644 --- a/.github/workflows/update-os.yml +++ b/.github/workflows/update-os.yml @@ -24,7 +24,7 @@ jobs: TINDIE_USERNAME: ${{ secrets.TINDIE_USERNAME }} with: # Set the base_image to the desired Raspberry Pi OS version - base_image: https://downloads.raspberrypi.com/raspios_lite_armhf/images/raspios_lite_armhf-2023-12-11/2023-12-11-raspios-bookworm-armhf-lite.img.xz + base_image: https://downloads.raspberrypi.com/raspios_lite_armhf/images/raspios_lite_armhf-2024-03-15/2024-03-15-raspios-bookworm-armhf-lite.img.xz image_additional_mb: 3072 # enlarge free space to 3 GB optimize_image: true commands: | @@ -40,7 +40,13 @@ jobs: sudo apt-get dist-upgrade -y sudo apt-get install -y python3-pip - sudo apt-get install zlib1g libjpeg-dev libatlas-base-dev rustc libopenjp2-7 python3-dev scons libssl-dev python3-venv python3-pip git libfreetype6-dev wkhtmltopdf libopenblas-dev libxml2-dev libxslt-dev python-dev-is-python3 -y + sudo apt-get install git zlib1g libjpeg-dev libatlas-base-dev rustc libopenjp2-7 python3-dev scons libssl-dev python3-venv python3-pip git libfreetype6-dev wkhtmltopdf libopenblas-dev libxml2-dev libxslt-dev python-dev-is-python3 -y + # #334 & #335 + git clone https://github.com/WiringPi/WiringPi + cd WiringPi + ./build + cd .. + echo $PWD && ls git clone https://github.com/aceinnolab/Inkycal cd Inkycal @@ -59,10 +65,6 @@ jobs: tar -xf bcm2835-1.71.tar cd bcm2835-1.71/ sudo ./configure && sudo make && sudo make check && sudo make install - cd .. - echo $CWD - wget https://project-downloads.drogon.net/wiringpi-latest.deb - sudo dpkg -i wiringpi-latest.deb cd .. echo $CWD diff --git a/README.md b/README.md index 7a3783b..6663b97 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ Inkycal is a software written in python for selected E-Paper displays. It converts these displays into useful information dashboards. It's open-source, free for personal use, fully modular and user-friendly. Despite all this, -Inkycal can run well even on the Raspberry Pi Zero. Oh, and it's open for third-party modules! Hooray! +Inkycal can run well even on the Raspberry Pi Zero W. Oh, and it's open for third-party modules! Hooray! ## ⚠️ Warning: long installation time expected! @@ -56,7 +56,7 @@ Watch the one-minute video on getting started with Inkycal: ## Hardware guide Before you can start, please ensure you have one of the supported displays and of the supported Raspberry -Pi: `|4|3A|3B|3B+|2B|0W|0WH|02W|`. We personally recommend the Raspberry Pi Zero W as this is relatively cheaper, uses +Pi: `|4|3A|3B|3B+|2B|ZeroW|ZeroWH|Zero2W|`. We personally recommend the Raspberry Pi Zero W as this is relatively cheaper, uses less power and is perfect to fit in a small photo frame once you have assembled everything. **Serial** displays are usually cheaper, but slower. Their main advantage is ease of use, like being able to communicate @@ -92,11 +92,6 @@ display!** | MicroSD card | Sandisk |  Search for `MicroSD card 8GB` on amazon or similar | ## Configuring the Raspberry Pi - -⚠️ Warning: You cannot use the latest version of Raspberry Pi OS as a kernel upgrade has caused many projects to fail. -Please only use the version mentioned below. -Download this specific version -of [Raspberry Pi OS (11-12-2023)](https://downloads.raspberrypi.com/raspios_lite_armhf/images/raspios_lite_armhf-2023-12-11/2023-12-11-raspios-bookworm-armhf-lite.img.xz) Flash Raspberry Pi OS on your microSD card (min. 4GB) with [Raspberry Pi Imager](https://rptl.io/imager). Use the following settings: @@ -138,8 +133,6 @@ wget http://www.airspayce.com/mikem/bcm2835/bcm2835-1.71.tar.gz tar zxvf bcm2835-1.71.tar.gz cd bcm2835-1.71/ sudo ./configure && sudo make && sudo make check && sudo make install -wget https://project-downloads.drogon.net/wiringpi-latest.deb -sudo dpkg -i wiringpi-latest.deb # If you are using the Raspberry Pi Zero models, you may need to increase the swapfile size to be able to install Inkycal: sudo dphys-swapfile swapoff @@ -175,10 +168,16 @@ This will help keep this project growing and cover the ongoing expenses too! Win Run the following steps to install Inkycal. Do **not** use sudo for this, except where explicitly specified. ```bash -# the next line is for the Raspberry Pi only -sudo apt-get install zlib1g libjpeg-dev libatlas-base-dev rustc libopenjp2-7 python-dev-is-python3 scons libssl-dev python3-venv python3-pip git libfreetype6-dev wkhtmltopdf libopenblas-dev +# Raspberry Pi specific section start +sudo apt-get install git zlib1g libjpeg-dev libatlas-base-dev rustc libopenjp2-7 python-dev-is-python3 scons libssl-dev python3-venv python3-pip git libfreetype6-dev wkhtmltopdf libopenblas-dev +git clone https://github.com/WiringPi/WiringPi +cd WiringPi +./build +cd .. +# Raspberry Pi specific section end + cd $HOME -git clone --branch main --single-branch https://github.com/aceinnolab/Inkycal +git clone https://github.com/aceinnolab/Inkycal cd Inkycal python3 -m venv venv source venv/bin/activate @@ -186,7 +185,8 @@ python -m pip install --upgrade pip pip install wheel pip install -e ./ -# If you are running on the Raspberry Pi, please install the following too to allow rendering on the display + +# only for Raspberry Pi: pip install RPi.GPIO==0.7.1 spidev==3.5 gpiozero==2.0 ``` diff --git a/inkycal/display/drivers/epd_12_in_48_lib_32bit.so b/inkycal/display/drivers/epd_12_in_48_lib_32bit.so index acdbb26..61482b5 100644 Binary files a/inkycal/display/drivers/epd_12_in_48_lib_32bit.so and b/inkycal/display/drivers/epd_12_in_48_lib_32bit.so differ diff --git a/inkycal/display/drivers/epd_12_in_48_lib_64bit.so b/inkycal/display/drivers/epd_12_in_48_lib_64bit.so index ed8ae87..99d44b9 100644 Binary files a/inkycal/display/drivers/epd_12_in_48_lib_64bit.so and b/inkycal/display/drivers/epd_12_in_48_lib_64bit.so differ diff --git a/inkycal/display/drivers/epdconfig_12_in_48.py b/inkycal/display/drivers/epdconfig_12_in_48.py index cdc84bc..276adab 100644 --- a/inkycal/display/drivers/epdconfig_12_in_48.py +++ b/inkycal/display/drivers/epdconfig_12_in_48.py @@ -31,6 +31,8 @@ import os import time from ctypes import * +import RPi.GPIO as GPIO + EPD_SCK_PIN = 11 EPD_MOSI_PIN = 10 @@ -71,11 +73,11 @@ if spi is None: def digital_write(pin, value): - spi.DEV_Digital_Write(pin, value) + GPIO.output(pin, value) def digital_read(pin): - return spi.DEV_Digital_Read(pin) + return GPIO.input(pin) def spi_writebyte(value): @@ -87,15 +89,68 @@ def delay_ms(delaytime): def module_init(): + GPIO.setmode(GPIO.BCM) + GPIO.setwarnings(False) + GPIO.setup(EPD_SCK_PIN, GPIO.OUT) + GPIO.setup(EPD_MOSI_PIN, GPIO.OUT) + + logging.debug("python call bcm2835 Lib") + + GPIO.setup(EPD_M2S2_RST_PIN, GPIO.OUT) + GPIO.setup(EPD_M1S1_RST_PIN, GPIO.OUT) + GPIO.setup(EPD_M2S2_DC_PIN, GPIO.OUT) + GPIO.setup(EPD_M1S1_DC_PIN, GPIO.OUT) + GPIO.setup(EPD_S1_CS_PIN, GPIO.OUT) + GPIO.setup(EPD_S2_CS_PIN, GPIO.OUT) + GPIO.setup(EPD_M1_CS_PIN, GPIO.OUT) + GPIO.setup(EPD_M2_CS_PIN, GPIO.OUT) + + GPIO.setup(EPD_S1_BUSY_PIN, GPIO.IN) + GPIO.setup(EPD_S2_BUSY_PIN, GPIO.IN) + GPIO.setup(EPD_M1_BUSY_PIN, GPIO.IN) + GPIO.setup(EPD_M2_BUSY_PIN, GPIO.IN) + + digital_write(EPD_M1_CS_PIN, 1) + digital_write(EPD_S1_CS_PIN, 1) + digital_write(EPD_M2_CS_PIN, 1) + digital_write(EPD_S2_CS_PIN, 1) + + digital_write(EPD_M2S2_RST_PIN, 0) + digital_write(EPD_M1S1_RST_PIN, 0) + digital_write(EPD_M2S2_DC_PIN, 1) + digital_write(EPD_M1S1_DC_PIN, 1) + spi.DEV_ModuleInit() def module_exit(): - spi.DEV_ModuleExit() + digital_write(EPD_M2S2_RST_PIN, 0) + digital_write(EPD_M1S1_RST_PIN, 0) + digital_write(EPD_M2S2_DC_PIN, 0) + digital_write(EPD_M1S1_DC_PIN, 0) + digital_write(EPD_S1_CS_PIN, 1) + digital_write(EPD_S2_CS_PIN, 1) + digital_write(EPD_M1_CS_PIN, 1) + digital_write(EPD_M2_CS_PIN, 1) def spi_readbyte(Reg): - return spi.DEV_SPI_ReadByte(Reg) + GPIO.setup(EPD_MOSI_PIN, GPIO.IN) + j = 0 + # time.sleep(0.01) + for i in range(0, 8): + GPIO.output(EPD_SCK_PIN, GPIO.LOW) + # time.sleep(0.01) + j = j << 1 + if (GPIO.input(EPD_MOSI_PIN) == GPIO.HIGH): + j |= 0x01 + else: + j &= 0xfe + # time.sleep(0.01) + GPIO.output(EPD_SCK_PIN, GPIO.HIGH) + # time.sleep(0.01) + GPIO.setup(EPD_MOSI_PIN, GPIO.OUT) + return j def delay_ms(delaytime):