Skip to content

Commit

Permalink
change button print
Browse files Browse the repository at this point in the history
  • Loading branch information
charles37 committed Nov 8, 2024
1 parent def9783 commit 9470ad8
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions hwci/tests/button_print.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def oneshot_test(self, board):
button_pin = gpio.pin("P0.11")
# Set the pin as output to simulate button press (active low)
button_pin.set_mode("output")
button_pin.write(1) # Ensure button is not pressed initially
# button_pin.write(1)

# Start the test
logging.info("Starting Button Press Test")
Expand All @@ -37,20 +37,20 @@ def oneshot_test(self, board):
button_pin.write(0) # Active low, so writing 0 simulates press
logging.info("Button pressed (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")

# 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")

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


Expand Down

0 comments on commit 9470ad8

Please sign in to comment.