Skip to content

Commit

Permalink
adjust timing of button press and release in button_print
Browse files Browse the repository at this point in the history
  • Loading branch information
charles37 committed Nov 11, 2024
1 parent 76fd700 commit cfaf1c6
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions hwci/tests/button_print.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,27 +30,24 @@ def oneshot_test(self, board):
if not output:
raise Exception("Did not receive expected test start message")

# Longer delay before button press to ensure board is ready
time.sleep(2.0)

# Simulate button press
button_pin.write(0) # Active low, so writing 0 simulates press
logging.info("Button pressed (simulated)")

# Hold button press longer before release
time.sleep(1.0)

# Release button
button_pin.write(1)
logging.info("Button released (simulated)")

# Wait longer for the expected output
output = serial.expect(r"Button Press! Button: 0 Status: 0", timeout=10)
if not output:
raise Exception("Did not receive expected button press message")

logging.info("Button press message received")

# Release button
button_pin.write(1)
logging.info("Button released (simulated)")

logging.info("Button Press Test completed successfully")


Expand Down

0 comments on commit cfaf1c6

Please sign in to comment.