From 099c86716e745cdc121e9a926762aea51ac65d3e Mon Sep 17 00:00:00 2001 From: Jonas Scharpf Date: Fri, 29 Jul 2022 09:55:04 +0200 Subject: [PATCH 1/7] support pointer thickness changes in gauge --- nextion/nextion_gauge.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nextion/nextion_gauge.py b/nextion/nextion_gauge.py index 8b73220..d0e77bc 100644 --- a/nextion/nextion_gauge.py +++ b/nextion/nextion_gauge.py @@ -8,7 +8,7 @@ """ # custom packages -from .common import Common, CommonBackgroundColorMixin, CommonFontMixin, CommonValueMixin +from .common import Common, CommonBackgroundColorMixin, CommonFontMixin, CommonPointerMixin, CommonValueMixin class NexGaugeError(Exception): @@ -16,7 +16,7 @@ class NexGaugeError(Exception): pass -class NexGauge(Common, CommonBackgroundColorMixin, CommonFontMixin, CommonValueMixin): +class NexGauge(Common, CommonBackgroundColorMixin, CommonFontMixin, CommonPointerMixin, CommonValueMixin): """docstring for NexGauge""" def __init__(self, nh, pid: int, cid: int, name: str) -> None: """ From 75a737d5a2d289b58553cae49bd18d3312aadb6d Mon Sep 17 00:00:00 2001 From: Jonas Scharpf Date: Fri, 29 Jul 2022 09:55:34 +0200 Subject: [PATCH 2/7] extend gauge example with pointer thickness functions --- examples/gauge/main.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/examples/gauge/main.py b/examples/gauge/main.py index 93b10aa..6baf9b6 100644 --- a/examples/gauge/main.py +++ b/examples/gauge/main.py @@ -33,6 +33,7 @@ gauge_value = randint(10, 350) background_color_value = 63488 # red font_color_value = 31 # blue +pointer_thickness = 5 # request the value of gauge "z0" print('Requesting gauge "{}" value ...'.format(z0.name)) @@ -114,6 +115,33 @@ if response != font_color_value: print('WARNING: GET value did not match SET value') +time.sleep(1) + +# request the pointer thickness of gauge "z0" +print('Requesting pointer thickness of gauge "{}" ...'.format(z0.name)) +response = z0.Get_pointer_thickness_wid() +print('Pointer thickness of gauge "{}" is: "{}"'.format(z0.name, response)) +print() + +time.sleep(1) + +# modify the pointer thickness of gauge "z0" +print('Set pointer thickness of gauge "{}" to "{}"'.format(z0.name, pointer_thickness)) +z0.Set_pointer_thickness_wid(pointer_thickness) +print() + +time.sleep(1) + +# request the pointer thickness of gauge "z0" again +print('Requesting pointer thickness of gauge "{}" ...'.format(z0.name)) +response = z0.Get_pointer_thickness_wid() +print('Pointer thickness of gauge "{}" is: "{}"'.format(z0.name, response)) +print() + +# sanity check +if response != pointer_thickness: + print('WARNING: GET value did not match SET value') + print('Returning to REPL in 5 seconds') # wait for 5 more seconds to safely finish the may still running threads From 4bfbde9b8ddd3b3553ccb03e013dee71dc436302 Mon Sep 17 00:00:00 2001 From: Jonas Scharpf Date: Fri, 29 Jul 2022 09:56:15 +0200 Subject: [PATCH 3/7] support pointer thickness changes in slider --- nextion/nextion_slider.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nextion/nextion_slider.py b/nextion/nextion_slider.py index 4d8e61d..f47d034 100644 --- a/nextion/nextion_slider.py +++ b/nextion/nextion_slider.py @@ -8,7 +8,7 @@ """ # custom packages -from .common import Common, CommonBackgroundColorMixin, CommonFontMixin, CommonValueMixin +from .common import Common, CommonBackgroundColorMixin, CommonFontMixin, CommonPointerMixin, CommonValueMixin class NexSliderError(Exception): @@ -16,7 +16,7 @@ class NexSliderError(Exception): pass -class NexSlider(Common, CommonBackgroundColorMixin, CommonFontMixin, CommonValueMixin): +class NexSlider(Common, CommonBackgroundColorMixin, CommonFontMixin, CommonPointerMixin, CommonValueMixin): """docstring for NexSlider""" def __init__(self, nh, pid: int, cid: int, name: str) -> None: """ From 0541793ec958c47e7bc314f4d89af8697447c312 Mon Sep 17 00:00:00 2001 From: Jonas Scharpf Date: Fri, 29 Jul 2022 09:57:42 +0200 Subject: [PATCH 4/7] fix flake8 warning in gauge example --- examples/gauge/main.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/gauge/main.py b/examples/gauge/main.py index 6baf9b6..309b889 100644 --- a/examples/gauge/main.py +++ b/examples/gauge/main.py @@ -126,7 +126,8 @@ time.sleep(1) # modify the pointer thickness of gauge "z0" -print('Set pointer thickness of gauge "{}" to "{}"'.format(z0.name, pointer_thickness)) +print('Set pointer thickness of gauge "{}" to "{}"'. + format(z0.name, pointer_thickness)) z0.Set_pointer_thickness_wid(pointer_thickness) print() From c43008ea25fdd99f0adb91b82fec700f7deb3a10 Mon Sep 17 00:00:00 2001 From: Jonas Scharpf Date: Fri, 29 Jul 2022 09:59:20 +0200 Subject: [PATCH 5/7] extend slider example with pointer thickness functions --- examples/slider/main.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/examples/slider/main.py b/examples/slider/main.py index d00462b..a11705f 100644 --- a/examples/slider/main.py +++ b/examples/slider/main.py @@ -34,6 +34,7 @@ slider_value = choice([randint(5, 40), randint(60, 100)]) background_color_value = 63488 # red font_color_value = 31 # blue +pointer_thickness = 5 # request the value of slider "h0" print('Requesting slider "{}" value ...'.format(h0.name)) @@ -118,6 +119,34 @@ if response != font_color_value: print('WARNING: GET value did not match SET value') +time.sleep(1) + +# request the pointer thickness of slider "h0" +print('Requesting pointer thickness of slider "{}" ...'.format(h0.name)) +response = h0.Get_pointer_thickness_wid() +print('Pointer thickness of slider "{}" is: "{}"'.format(h0.name, response)) +print() + +time.sleep(1) + +# modify the pointer thickness of slider "h0" +print('Set pointer thickness of slider "{}" to "{}"'. + format(h0.name, pointer_thickness)) +h0.Set_pointer_thickness_wid(pointer_thickness) +print() + +time.sleep(1) + +# request the pointer thickness of slider "h0" again +print('Requesting pointer thickness of slider "{}" ...'.format(h0.name)) +response = h0.Get_pointer_thickness_wid() +print('Pointer thickness of slider "{}" is: "{}"'.format(h0.name, response)) +print() + +# sanity check +if response != pointer_thickness: + print('WARNING: GET value did not match SET value') + print('Returning to REPL in 5 seconds') # wait for 5 more seconds to safely finish the may still running threads From 811a00e402cb24f390104acf1250eb1f13301649 Mon Sep 17 00:00:00 2001 From: Jonas Scharpf Date: Fri, 29 Jul 2022 09:59:57 +0200 Subject: [PATCH 6/7] update changelog for 0.7.0 --- changelog.md | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/changelog.md b/changelog.md index fea9d87..85f3745 100644 --- a/changelog.md +++ b/changelog.md @@ -17,6 +17,17 @@ r"^\#\# \[\d{1,}[.]\d{1,}[.]\d{1,}\] \- \d{4}\-\d{2}-\d{2}$" --> ## Released +## [0.7.0] - 2022-07-29 +### Added +- Support `Get_pointer_thickness_wid` and `Set_pointer_thickness_wid` by new + class `CommonPointerMixin` in + [`common`](nextion/common.py) + +### Changed +- Inherit from `CommonPointerMixin` in + - Gauge + - Slider + ## [0.6.0] - 2022-07-29 ### Added - Support `Get_place_xcen`, `Set_place_xcen`, `Get_place_ycen` and @@ -108,8 +119,9 @@ r"^\#\# \[\d{1,}[.]\d{1,}[.]\d{1,}\] \- \d{4}\-\d{2}-\d{2}$" - [Example HMI file](examples/everything.HMI) to be used for all examples -[Unreleased]: https://github.com/brainelectronics/micropython-nextion/compare/0.6.0...develop +[Unreleased]: https://github.com/brainelectronics/micropython-nextion/compare/0.7.0...develop +[0.7.0]: https://github.com/brainelectronics/micropython-nextion/tree/0.7.0 [0.6.0]: https://github.com/brainelectronics/micropython-nextion/tree/0.6.0 [0.5.0]: https://github.com/brainelectronics/micropython-nextion/tree/0.5.0 [0.4.0]: https://github.com/brainelectronics/micropython-nextion/tree/0.4.0 From a30e6d89409bebb590f1a663d463e3d570954b2d Mon Sep 17 00:00:00 2001 From: Jonas Scharpf Date: Fri, 29 Jul 2022 10:01:31 +0200 Subject: [PATCH 7/7] fix changelog entry --- changelog.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/changelog.md b/changelog.md index 85f3745..d688730 100644 --- a/changelog.md +++ b/changelog.md @@ -20,8 +20,7 @@ r"^\#\# \[\d{1,}[.]\d{1,}[.]\d{1,}\] \- \d{4}\-\d{2}-\d{2}$" ## [0.7.0] - 2022-07-29 ### Added - Support `Get_pointer_thickness_wid` and `Set_pointer_thickness_wid` by new - class `CommonPointerMixin` in - [`common`](nextion/common.py) + class `CommonPointerMixin` in [`common`](nextion/common.py) ### Changed - Inherit from `CommonPointerMixin` in