Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Add was_touched & touch_calibrate for pins 0, 1, 2 & pin_logo. #802

Open
wants to merge 3 commits into
base: v2-docs
Choose a base branch
from

Conversation

microbit-carlos
Copy link
Collaborator

@microbit-carlos microbit-carlos commented Mar 4, 2024

@microbit-carlos
Copy link
Collaborator Author

Also took the opportunity to move the explanation of capacitive/resistive touch modes from is_touched() to set_touch_mode() and remove the duplicated note:

Before After
image image

@microbit-carlos microbit-carlos marked this pull request as ready for review March 4, 2024 17:08
@microbit-carlos microbit-carlos changed the title docs: Add was_touched method for pins 0, 1, 2 & §pin_logo. docs: Add was_touched method for pins 0, 1, 2 & pin_logo. Mar 7, 2024
# this method was called
pin_logo.was_touched()
# returns the running total of touches, and resets this counter to zero
pin.get_touches()
Copy link
Member

Choose a reason for hiding this comment

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

Should be pin_logo.get_touches(). Probably also the example below should be changed to pin_logo.set_touch_mode(value).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

These methods are also available for pins 0, 1 and 2, so we are using pin. here as it's been done for pin.is_touched().

Copy link
Member

Choose a reason for hiding this comment

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

But, this section/paragraph of the docs is all about pin_logo (see line 158/164 above). And the code snippets just above are for pin_logo.is_touched() and pin_logo.was_touched().

So, it should be pin_logo.get_touches() and pin_logo.set_touch_mode() for consistency within this paragraph.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Oh yes, you are right, I didn't notice in my last message that this was replicated in a pin_logo-only section.
Updated in https://github.com/bbcmicrobit/micropython/compare/4043fc290df1ef1cf281c8211995eca66e27a63f..1fbb7581cf90b6976b183cca855c2cc71989744f.

@dpgeorge
Copy link
Member

Also took the opportunity to move the explanation of capacitive/resistive touch modes from is_touched() to set_touch_mode() and remove the duplicated note:

Yes, that's a good clean up.

@microbit-carlos microbit-carlos changed the title docs: Add was_touched method for pins 0, 1, 2 & pin_logo. docs: Add was_touched & touch_calibrate for pins 0, 1, 2 & pin_logo. Sep 16, 2024
@microbit-carlos
Copy link
Collaborator Author

As well keep this PR unmerged until the next MicroPython v2 beta is released, and this PR already touches the pin page, I've also added here the touch_calibrate() method.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants