diff options
| author | Dan Halbert <halbert@halwitz.org> | 2019-04-18 13:57:27 -0400 |
|---|---|---|
| committer | Dan Halbert <halbert@halwitz.org> | 2019-04-18 13:57:27 -0400 |
| commit | 4fc0f8b25c53d5eb05cd2b4e124c22d999fc506a (patch) | |
| tree | 7014c3c5e477e9105567465f0a448aac73773040 /shared-bindings/displayio | |
| parent | 49c4c1e2ac10df42685b6242f11d752d5e69ebd1 (diff) | |
Turn off auto_brightness if brightness is set
Diffstat (limited to 'shared-bindings/displayio')
| -rw-r--r-- | shared-bindings/displayio/Display.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/shared-bindings/displayio/Display.c b/shared-bindings/displayio/Display.c index 17f275bc0..071b9441f 100644 --- a/shared-bindings/displayio/Display.c +++ b/shared-bindings/displayio/Display.c @@ -209,8 +209,8 @@ MP_DEFINE_CONST_FUN_OBJ_1(displayio_display_wait_for_frame_obj, displayio_displa //| .. attribute:: brightness //| //| The brightness of the display as a float. 0.0 is off and 1.0 is full brightness. When -//| `auto_brightness` is True this value will change automatically and setting it will have no -//| effect. To control the brightness, auto_brightness must be false. +//| `auto_brightness` is True, the value of `brightness` will change automatically. +//| If `brightness` is set, `auto_brightness` will be disabled and will be set to False. //| STATIC mp_obj_t displayio_display_obj_get_brightness(mp_obj_t self_in) { displayio_display_obj_t *self = native_display(self_in); @@ -224,6 +224,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(displayio_display_get_brightness_obj, displayio_displa STATIC mp_obj_t displayio_display_obj_set_brightness(mp_obj_t self_in, mp_obj_t brightness) { displayio_display_obj_t *self = native_display(self_in); + common_hal_displayio_display_set_auto_brightness(self, false); bool ok = common_hal_displayio_display_set_brightness(self, mp_obj_get_float(brightness)); if (!ok) { mp_raise_RuntimeError(translate("Brightness not adjustable")); @@ -241,7 +242,10 @@ const mp_obj_property_t displayio_display_brightness_obj = { //| .. attribute:: auto_brightness //| -//| True when the display brightness is auto adjusted. +//| True when the display brightness is adjusted automatically, based on an ambient +//| light sensor or other method. Note that some displays may have this set to True by default, +//| but not actually implement automatic brightness adjustment. `auto_brightness` is set to False +//| if `brightness` is set manually. //| STATIC mp_obj_t displayio_display_obj_get_auto_brightness(mp_obj_t self_in) { displayio_display_obj_t *self = native_display(self_in); |
