From 6ce7fe079a63cb1f3db3e4da15e96176ee47f306 Mon Sep 17 00:00:00 2001 From: ThomasR Date: Wed, 5 Feb 2025 17:06:23 +0100 Subject: [PATCH 1/2] Normalize method signatures across devices --- RaspberryPi_JetsonNano/python/examples/epd_2in7_V2_test.py | 2 +- RaspberryPi_JetsonNano/python/examples/epd_2in7_test.py | 2 +- RaspberryPi_JetsonNano/python/examples/epd_2in9_V2_test.py | 2 +- RaspberryPi_JetsonNano/python/examples/epd_4in2_V2_test.py | 2 +- RaspberryPi_JetsonNano/python/examples/epd_4in2_test.py | 2 +- RaspberryPi_JetsonNano/python/lib/waveshare_epd/epd2in7.py | 4 ++++ .../python/lib/waveshare_epd/epd2in7_V2.py | 4 ++++ .../python/lib/waveshare_epd/epd2in9_V2.py | 4 ++++ RaspberryPi_JetsonNano/python/lib/waveshare_epd/epd3in7.py | 5 +++-- RaspberryPi_JetsonNano/python/lib/waveshare_epd/epd4in2.py | 4 ++++ .../python/lib/waveshare_epd/epd4in2_V2.py | 6 ++++-- 11 files changed, 28 insertions(+), 9 deletions(-) diff --git a/RaspberryPi_JetsonNano/python/examples/epd_2in7_V2_test.py b/RaspberryPi_JetsonNano/python/examples/epd_2in7_V2_test.py index 629cf1bb0..0cefe2814 100644 --- a/RaspberryPi_JetsonNano/python/examples/epd_2in7_V2_test.py +++ b/RaspberryPi_JetsonNano/python/examples/epd_2in7_V2_test.py @@ -120,7 +120,7 @@ '''4Gray display''' logging.info("4Gray display--------------------------------") - epd.Init_4Gray() + epd.init_4Gray() Limage = Image.new('L', (epd.width, epd.height), 0) # 255: clear the frame draw = ImageDraw.Draw(Limage) diff --git a/RaspberryPi_JetsonNano/python/examples/epd_2in7_test.py b/RaspberryPi_JetsonNano/python/examples/epd_2in7_test.py index 138e24b48..bb58da0bb 100644 --- a/RaspberryPi_JetsonNano/python/examples/epd_2in7_test.py +++ b/RaspberryPi_JetsonNano/python/examples/epd_2in7_test.py @@ -75,7 +75,7 @@ '''4Gray display''' logging.info("4Gray display--------------------------------") - epd.Init_4Gray() + epd.init_4Gray() Limage = Image.new('L', (epd.width, epd.height), 0) # 255: clear the frame draw = ImageDraw.Draw(Limage) diff --git a/RaspberryPi_JetsonNano/python/examples/epd_2in9_V2_test.py b/RaspberryPi_JetsonNano/python/examples/epd_2in9_V2_test.py index 24f694157..839168f44 100644 --- a/RaspberryPi_JetsonNano/python/examples/epd_2in9_V2_test.py +++ b/RaspberryPi_JetsonNano/python/examples/epd_2in9_V2_test.py @@ -96,7 +96,7 @@ '''4Gray display''' logging.info("4Gray display--------------------------------") - epd.Init_4Gray() + epd.init_4Gray() Limage = Image.new('L', (epd.height, epd.width), 0) # 255: clear the frame draw = ImageDraw.Draw(Limage) diff --git a/RaspberryPi_JetsonNano/python/examples/epd_4in2_V2_test.py b/RaspberryPi_JetsonNano/python/examples/epd_4in2_V2_test.py index 02b491ea0..fa197b8e7 100644 --- a/RaspberryPi_JetsonNano/python/examples/epd_4in2_V2_test.py +++ b/RaspberryPi_JetsonNano/python/examples/epd_4in2_V2_test.py @@ -144,7 +144,7 @@ '''4Gray display''' logging.info("6.4Gray display--------------------------------") - epd.Init_4Gray() + epd.init_4Gray() Limage = Image.new('L', (epd.width, epd.height), 0) # 255: clear the frame draw = ImageDraw.Draw(Limage) diff --git a/RaspberryPi_JetsonNano/python/examples/epd_4in2_test.py b/RaspberryPi_JetsonNano/python/examples/epd_4in2_test.py index d56b6ec7c..f39f132c2 100644 --- a/RaspberryPi_JetsonNano/python/examples/epd_4in2_test.py +++ b/RaspberryPi_JetsonNano/python/examples/epd_4in2_test.py @@ -94,7 +94,7 @@ '''4Gray display''' logging.info("5.4Gray display--------------------------------") - epd.Init_4Gray() + epd.init_4Gray() Limage = Image.new('L', (epd.width, epd.height), 0) # 255: clear the frame draw = ImageDraw.Draw(Limage) diff --git a/RaspberryPi_JetsonNano/python/lib/waveshare_epd/epd2in7.py b/RaspberryPi_JetsonNano/python/lib/waveshare_epd/epd2in7.py index 831492b6b..bb0fca27d 100644 --- a/RaspberryPi_JetsonNano/python/lib/waveshare_epd/epd2in7.py +++ b/RaspberryPi_JetsonNano/python/lib/waveshare_epd/epd2in7.py @@ -294,7 +294,11 @@ def init(self): self.set_lut() return 0 + '''Deprecated. Use init_4Gray() instead''' def Init_4Gray(self): + return self.init_4Gray() + + def init_4Gray(self): if (epdconfig.module_init() != 0): return -1 self.reset() diff --git a/RaspberryPi_JetsonNano/python/lib/waveshare_epd/epd2in7_V2.py b/RaspberryPi_JetsonNano/python/lib/waveshare_epd/epd2in7_V2.py index 30074a6db..3dd1d7e24 100644 --- a/RaspberryPi_JetsonNano/python/lib/waveshare_epd/epd2in7_V2.py +++ b/RaspberryPi_JetsonNano/python/lib/waveshare_epd/epd2in7_V2.py @@ -202,7 +202,11 @@ def init_Fast(self): self.ReadBusy() return 0 + '''Deprecated. Use init_4Gray() instead''' def Init_4Gray(self): + return self.init_4Gray() + + def init_4Gray(self): if (epdconfig.module_init() != 0): return -1 self.reset() diff --git a/RaspberryPi_JetsonNano/python/lib/waveshare_epd/epd2in9_V2.py b/RaspberryPi_JetsonNano/python/lib/waveshare_epd/epd2in9_V2.py index d84510b3c..64f457962 100644 --- a/RaspberryPi_JetsonNano/python/lib/waveshare_epd/epd2in9_V2.py +++ b/RaspberryPi_JetsonNano/python/lib/waveshare_epd/epd2in9_V2.py @@ -290,7 +290,11 @@ def init_Fast(self): # EPD hardware init end return 0 + '''Deprecated. Use init_4Gray() instead''' def Init_4Gray(self): + return self.init_4Gray() + + def init_4Gray(self): if (epdconfig.module_init() != 0): return -1 self.reset() diff --git a/RaspberryPi_JetsonNano/python/lib/waveshare_epd/epd3in7.py b/RaspberryPi_JetsonNano/python/lib/waveshare_epd/epd3in7.py index 37685680b..15fa5700e 100644 --- a/RaspberryPi_JetsonNano/python/lib/waveshare_epd/epd3in7.py +++ b/RaspberryPi_JetsonNano/python/lib/waveshare_epd/epd3in7.py @@ -148,7 +148,7 @@ def ReadBusy(self): logger.debug("e-Paper busy release") - def init(self, mode): + def init(self, mode=1): if (epdconfig.module_init() != 0): return -1 # EPD hardware init start @@ -422,7 +422,8 @@ def display_1Gray(self, image): self.ReadBusy() - def Clear(self, color, mode): + '''The color argument is not supported on this screen.''' + def Clear(self, color, mode=1): self.send_command(0x4E) self.send_data(0x00) self.send_data(0x00) diff --git a/RaspberryPi_JetsonNano/python/lib/waveshare_epd/epd4in2.py b/RaspberryPi_JetsonNano/python/lib/waveshare_epd/epd4in2.py index ce1d057f8..edcb12800 100644 --- a/RaspberryPi_JetsonNano/python/lib/waveshare_epd/epd4in2.py +++ b/RaspberryPi_JetsonNano/python/lib/waveshare_epd/epd4in2.py @@ -393,7 +393,11 @@ def init_Partial(self): # EPD hardware init end return 0 + '''Deprecated. Use init_4Gray() instead''' def Init_4Gray(self): + return self.init_4Gray() + + def init_4Gray(self): if epdconfig.module_init() != 0: return -1 # EPD hardware init start diff --git a/RaspberryPi_JetsonNano/python/lib/waveshare_epd/epd4in2_V2.py b/RaspberryPi_JetsonNano/python/lib/waveshare_epd/epd4in2_V2.py index 105d57b2d..1c747d329 100644 --- a/RaspberryPi_JetsonNano/python/lib/waveshare_epd/epd4in2_V2.py +++ b/RaspberryPi_JetsonNano/python/lib/waveshare_epd/epd4in2_V2.py @@ -264,9 +264,11 @@ def Lut(self): self.send_command(0x2c) self.send_data(self.LUT_ALL[232]) - - + '''Deprecated. Use init_4Gray() instead''' def Init_4Gray(self): + return self.init_4Gray() + + def init_4Gray(self): if epdconfig.module_init() != 0: return -1 # EPD hardware init start From 4c5fb79ec2c04947e9ec52f6a7496c88a402783f Mon Sep 17 00:00:00 2001 From: ThomasR Date: Wed, 5 Feb 2025 17:22:22 +0100 Subject: [PATCH 2/2] Add deprecation warning --- RaspberryPi_JetsonNano/python/lib/waveshare_epd/epd2in7.py | 3 ++- RaspberryPi_JetsonNano/python/lib/waveshare_epd/epd2in7_V2.py | 3 ++- RaspberryPi_JetsonNano/python/lib/waveshare_epd/epd2in9_V2.py | 2 +- RaspberryPi_JetsonNano/python/lib/waveshare_epd/epd4in2.py | 2 +- RaspberryPi_JetsonNano/python/lib/waveshare_epd/epd4in2_V2.py | 2 +- 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/RaspberryPi_JetsonNano/python/lib/waveshare_epd/epd2in7.py b/RaspberryPi_JetsonNano/python/lib/waveshare_epd/epd2in7.py index bb0fca27d..24ecfc5af 100644 --- a/RaspberryPi_JetsonNano/python/lib/waveshare_epd/epd2in7.py +++ b/RaspberryPi_JetsonNano/python/lib/waveshare_epd/epd2in7.py @@ -294,10 +294,11 @@ def init(self): self.set_lut() return 0 - '''Deprecated. Use init_4Gray() instead''' def Init_4Gray(self): + logger.warning("The 'Init_4Gray' method is deprecated, use 'init_4Gray' instead") return self.init_4Gray() + def init_4Gray(self): if (epdconfig.module_init() != 0): return -1 diff --git a/RaspberryPi_JetsonNano/python/lib/waveshare_epd/epd2in7_V2.py b/RaspberryPi_JetsonNano/python/lib/waveshare_epd/epd2in7_V2.py index 3dd1d7e24..8257c63ca 100644 --- a/RaspberryPi_JetsonNano/python/lib/waveshare_epd/epd2in7_V2.py +++ b/RaspberryPi_JetsonNano/python/lib/waveshare_epd/epd2in7_V2.py @@ -202,10 +202,11 @@ def init_Fast(self): self.ReadBusy() return 0 - '''Deprecated. Use init_4Gray() instead''' def Init_4Gray(self): + logger.warning("The 'Init_4Gray' method is deprecated, use 'init_4Gray' instead") return self.init_4Gray() + def init_4Gray(self): if (epdconfig.module_init() != 0): return -1 diff --git a/RaspberryPi_JetsonNano/python/lib/waveshare_epd/epd2in9_V2.py b/RaspberryPi_JetsonNano/python/lib/waveshare_epd/epd2in9_V2.py index 64f457962..e5d8e8f69 100644 --- a/RaspberryPi_JetsonNano/python/lib/waveshare_epd/epd2in9_V2.py +++ b/RaspberryPi_JetsonNano/python/lib/waveshare_epd/epd2in9_V2.py @@ -290,8 +290,8 @@ def init_Fast(self): # EPD hardware init end return 0 - '''Deprecated. Use init_4Gray() instead''' def Init_4Gray(self): + logger.warning("The 'Init_4Gray' method is deprecated, use 'init_4Gray' instead") return self.init_4Gray() def init_4Gray(self): diff --git a/RaspberryPi_JetsonNano/python/lib/waveshare_epd/epd4in2.py b/RaspberryPi_JetsonNano/python/lib/waveshare_epd/epd4in2.py index edcb12800..f5ebf4476 100644 --- a/RaspberryPi_JetsonNano/python/lib/waveshare_epd/epd4in2.py +++ b/RaspberryPi_JetsonNano/python/lib/waveshare_epd/epd4in2.py @@ -393,8 +393,8 @@ def init_Partial(self): # EPD hardware init end return 0 - '''Deprecated. Use init_4Gray() instead''' def Init_4Gray(self): + logger.warning("The 'Init_4Gray' method is deprecated, use 'init_4Gray' instead") return self.init_4Gray() def init_4Gray(self): diff --git a/RaspberryPi_JetsonNano/python/lib/waveshare_epd/epd4in2_V2.py b/RaspberryPi_JetsonNano/python/lib/waveshare_epd/epd4in2_V2.py index 1c747d329..20dd47652 100644 --- a/RaspberryPi_JetsonNano/python/lib/waveshare_epd/epd4in2_V2.py +++ b/RaspberryPi_JetsonNano/python/lib/waveshare_epd/epd4in2_V2.py @@ -264,8 +264,8 @@ def Lut(self): self.send_command(0x2c) self.send_data(self.LUT_ALL[232]) - '''Deprecated. Use init_4Gray() instead''' def Init_4Gray(self): + logger.warning("The 'Init_4Gray' method is deprecated, use 'init_4Gray' instead") return self.init_4Gray() def init_4Gray(self):