diff --git a/changelog.md b/changelog.md index fea9d87..d688730 100644 --- a/changelog.md +++ b/changelog.md @@ -17,6 +17,16 @@ 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 +118,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 diff --git a/examples/gauge/main.py b/examples/gauge/main.py index 93b10aa..309b889 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,34 @@ 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 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 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: """ 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: """