Skip to content
This repository was archived by the owner on Dec 23, 2021. It is now read-only.

Fix state of switch for CPX #345

Merged
merged 2 commits into from
Apr 20, 2020
Merged

Fix state of switch for CPX #345

merged 2 commits into from
Apr 20, 2020

Conversation

xnkevinnguyen
Copy link
Contributor

Description:

After revision of the doc, the True state of the switch should be at the left and False at the right. See https://learn.adafruit.com/circuitpython-made-easy-on-circuit-playground-express/slide-switch.

Reported here: #344

Repro steps:
1.Run this code

from adafruit_circuitplayground import cp

while True:
    if cp.switch:
        cp.pixels[0] = (0, 0, 255)
    else:
        cp.pixels[0] = (0, 0, 0)


  1. toggle the switch
    Current behaviour: The led will turn ON if the switch is on the right

Expected behaviour: The led will turn ON if the swith is on the left.

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Limitations:

Please describe limitations of this PR

Testing:

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Test A
  • Test B

Checklist:

  • My code follows the style guidelines of this project
  • My code has been formatted with npm run format and passes the checks in npm run check
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • Any dependent changes have been merged and published in downstream modules

@@ -37,7 +37,7 @@ def __init__(self):
(0, 0, 0),
]
self.__state[CONSTANTS.EXPRESS_STATE.RED_LED] = False
self.__state[CONSTANTS.EXPRESS_STATE.SWITCH] = False
self.__state[CONSTANTS.EXPRESS_STATE.SWITCH] = True
Copy link

@nasadigital nasadigital Apr 20, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would expect the switch to be turned off by default, would you agree?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right. After looking at the pictures, it seems that default is off.

@nasadigital
Copy link

Just a comment, the switch is red when turned off and grey when turned on. That's fine with me, since previously it used to be red when turned on but you might want to think about it.

@xnkevinnguyen
Copy link
Contributor Author

Just a comment, the switch is red when turned off and grey when turned on. That's fine with me, since previously it used to be red when turned on but you might want to think about it.

Yea, we wanted to inverse it since users were expecting the opposite. Maybe Green would be a better choice then gray for ON. But will be thought of in the future

@xnkevinnguyen xnkevinnguyen merged commit 1b25710 into dev Apr 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants