def _set_pallet_black(self):
     # This is darker and good for text, but there is some bleed into
     # adjacent pixels on the grid.
     log("set pallet")
     start_time = time.time()
     self.paper.send(SetPallet(SetPallet.BLACK, SetPallet.WHITE))
     log("set pallet: %0.2f seconds" % (time.time() - start_time))
Example #2
0
def send(path):
    start = time.time()
    lines = _read_image(path)
    logger.info(F"Send Image.. Split Image to {len(lines)} lines")

    with EPaper() as paper:
        paper.send(Handshake())
        time.sleep(2)
        paper.send(SetPallet(SetPallet.DARK_GRAY, SetPallet.WHITE))  # use of dark_gray for a more clear image
        paper.send(SetCurrentDisplayRotation(SetCurrentDisplayRotation.FLIP))
        paper.send(SetEnFontSize(SetEnFontSize.THIRTYTWO))
        paper.read_responses(timeout=10)

        progress_bar(0, len(lines), prefix='Progress:')
        update_rate = len(lines)//100

        for idx, line in enumerate(lines):
            paper.send(FillRectangle(*line))
            if idx%update_rate==0:
                progress_bar(idx+1, len(lines), prefix='Progress:')
        progress_bar(len(lines), len(lines), prefix='Progress:')
        paper.send(RefreshAndUpdate())
        paper.read_responses()

        logger.info(F"Refreshing took {time.time() - start:.3} s")
Example #3
0
 def _set_pallet_gray(self):
     # this is the most accurate for staying in the pixel grid
     #logging.info("set pallet")
     start_time = time.time()
     self.paper.send(SetPallet(SetPallet.DARK_GRAY, SetPallet.WHITE))
Example #4
0
 def _set_pallet_black(self):
     # This is darker and good for text, but there is some bleed into
     # adjacent pixels on the grid.
     #logging.info("set pallet")
     start_time = time.time()
     self.paper.send(SetPallet(SetPallet.BLACK, SetPallet.WHITE))
 def _set_pallet_gray(self):
     # this is the most accurate for staying in the pixel grid
     log("set pallet")
     start_time = time.time()
     self.paper.send(SetPallet(SetPallet.DARK_GRAY, SetPallet.WHITE))
     log("set pallet: %0.2f seconds" % (time.time() - start_time))
Example #6
0
from waveshare.epaper import DrawRectangle
from waveshare.epaper import FillRectangle
from waveshare.epaper import DrawTriangle
from waveshare.epaper import FillTriangle
from waveshare.epaper import DisplayText
from waveshare.epaper import SetCurrentDisplayRotation
from waveshare.epaper import SetEnFontSize
from waveshare.epaper import SetZhFontSize
from waveshare.epaper import ClearScreen

if __name__ == '__main__':
    with EPaper() as paper:

        paper.send(Handshake())
        time.sleep(2)
        paper.send(SetPallet(SetPallet.BLACK, SetPallet.WHITE))
        paper.send(SetCurrentDisplayRotation(SetCurrentDisplayRotation.FLIP))
        paper.send(SetEnFontSize(SetEnFontSize.THIRTYTWO))
        paper.send(SetZhFontSize(SetZhFontSize.THIRTYTWO))
        paper.read_responses(timeout=10)

        paper.send(DisplayText(20, 10, "Hello".encode("gb2312")))
        paper.send(DisplayText(20, 50, '你好'.encode("gb2312")))
        paper.send(DisplayText(20, 90, 'Здравствуйте'.encode("gb2312")))
        paper.send(DisplayText(20, 120, 'Привет'.encode("gb2312")))
        paper.send(DisplayText(20, 160, 'こんにちは'.encode("gb2312")))

        paper.send(DrawRectangle(30, 300, 60, 330))
        paper.send(FillRectangle(90, 300, 120, 330))

        paper.send(DrawTriangle(30, 400, 30, 430, 60, 430))