Coder Social home page Coder Social logo

Comments (4)

Henry-277 avatar Henry-277 commented on May 30, 2024 1

When I'm running it with the console i am getting different errors:

Traceback (most recent call last):
File "weather.py", line 234, in
write_to_screen(screen_output_file, 600)
File "weather.py", line 34, in write_to_screen
epd.display(epd.getbuffer(h_image))
TypeError: display() missing 1 required positional argument: 'imagered'

from e_paper_weather_display.

AbnormalDistributions avatar AbnormalDistributions commented on May 30, 2024

Make sure you have downloaded and have access to the lib/waveshare_epd directory in the repository. See if that helps. :)

from e_paper_weather_display.

testataaaa avatar testataaaa commented on May 30, 2024

I had the same issue as OP, solved it by setting up dependencies as follows:

sudo apt update && sudo apt upgrade

sudo apt install git gsfonts python3 python3-pip cairosvg pigpio python3-pigpio

sudo pip3 install python-dateutil astral spidev RPi.GPIO Pillow google-api-python-client google-auth-httplib2 google-auth-oauthlib msal

sudo sed -i s/#dtparam=spi=on/dtparam=spi=on/ /boot/config.txt

sudo reboot

from e_paper_weather_display.

xelemorf avatar xelemorf commented on May 30, 2024

When I'm running it with the console i am getting different errors:

Traceback (most recent call last): File "weather.py", line 234, in write_to_screen(screen_output_file, 600) File "weather.py", line 34, in write_to_screen epd.display(epd.getbuffer(h_image)) TypeError: display() missing 1 required positional argument: 'imagered'

I think this "imagered" issue is coming from a multi-color screen which includes apart from BW an additional RED color, which also needs to be handled; unless I've misunderstood

In my example, I am working with these display drivers:
"epd2in13_V4" - which is black/white
"epd2in13b_V4" which is black/white/red.
The issue only appears when using the one with red color.

Here is the waveshare repo for various displays: https://github.com/waveshare/e-Paper/tree/master/RaspberryPi_JetsonNano/python/lib/waveshare_epd

The relevant imagered reference in the official example is the following, although this did not help me in any way

    # display image
    def display(self, imageblack, imagered):
        self.send_command(0x24)
        self.send_data2(imageblack)

        self.send_command(0x26)
        self.send_data2(imagered)

        self.ondisplay()

Eventually the following was the solution for me on a different project, based on the code provided by nerstak on his epaper-weather project I have added the redimage segments into it as it was originally designed for BW screen.

from PIL import Image

from lib_waveshare_epd import epd2in13b_V4

epd = epd2in13b_V4.EPD()

screenWidth = epd.height
#screenWidth = 250
screenHeight = epd.width
#screenHeight = 122

def clear_screen():
    """
    Clear the screen
    """
    #logging.info("Goto Sleep...")
    epd.init()
    epd.Clear()
    time.sleep(2)
    epd.sleep()
....
    #logging.info("init and Clear")
    #epd.init()
    #epd.Clear(0xFF)



def draw_image_on_hardware(img: Image):
    """
    Draw given image to hardware e-ink
    Does not close img
    :param img: Image
    """
    #img.show()
    epd.init()

    #black image
    img.save(os.path.join("/tmp", "image.png"))
....
    #blank redimage
    redimage = Image.new('1', (epd.height, epd.width), 255)  # 250*122

    #black image file
    screen_output_file = Image.open(os.path.join("/tmp", "image.png"))
    #epd.display(epd.getbuffer(screen_output_file))

    #first draw makes black image, second draw overlays red image (must to draw twice on BWR display), drawing the same image twice will result a red image
    epd.display(epd.getbuffer(screen_output_file), epd.getbuffer(redimage))

    #logging.info("Goto Sleep...")
    time.sleep(2)
    epd.sleep()

from e_paper_weather_display.

Related Issues (6)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.