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

Fixed print() statements for CLUE display in debug mode #351

Merged
merged 3 commits into from
Apr 21, 2020

Conversation

andreamah
Copy link
Contributor

@andreamah andreamah commented Apr 21, 2020

Description:

Previously, print statements did not show on the CLUE's display while in debug mode. I added a wrapper for print() in debug_user_code.py so that prints would also be sent to the clue display.

I also added starting and ending print statements to each run to match non-debug mode.

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

Testing:

Prints should appear both on the clue screen and in vscode's terminal.

from adafruit_clue import clue
import datetime
import time

clue_data = clue.simple_text_display(title="Data Screen!", title_scale=1, text_scale=3)

val = 100
for i in range(12):
    val += 1
    clue_data.show_terminal()
    time.sleep(0.5)
    print(val)
    print(f"time {datetime.datetime.now(datetime.timezone.utc).strftime('%Y-%m-%d %H:%M:%S.%f')[:-3]}")


for i in range(10):
    val += 1
    clue_data[3].text = "Count: {}".format(val)
    clue_data.show()
    print("shouldn't show until the end")
    time.sleep(0.5)
    

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

Copy link
Collaborator

@sagarmanchanda sagarmanchanda left a comment

Choose a reason for hiding this comment

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

lgtm :)

Copy link
Contributor

@vandyliu vandyliu left a comment

Choose a reason for hiding this comment

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

Lgtm

@andreamah andreamah merged commit a2e6c53 into dev Apr 21, 2020
@andreamah andreamah deleted the users/t-anmah/clue-debugger-prints branch April 21, 2020 16:53
andreamah added a commit that referenced this pull request Apr 21, 2020
* Add precision to input slider

* Fix inverse switch

* Refactor

* Switch default is false

* Modify precision value for cpx and clue

* Table of Contents for README (#349)

* Slideshow Backwards/Forwards Bug Fix (#350)

* slideshow nav fixed

* Fixed print() statements for CLUE display in debug mode (#351)

* fixed debug_user_code.py to capture print statements

* added starting and ending print statements

* new release note apr 21

* added a few fixes

Co-authored-by: Vandy Liu <[email protected]>
Co-authored-by: Andrea Mah <[email protected]>
Co-authored-by: andreamah <[email protected]>
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.

3 participants