From 9470ad8138768d89d7e7b26a966f4bc904af9826 Mon Sep 17 00:00:00 2001 From: charles37 Date: Fri, 8 Nov 2024 12:00:05 -0500 Subject: [PATCH] change button print --- hwci/tests/button_print.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/hwci/tests/button_print.py b/hwci/tests/button_print.py index f1ea348..c3aa5b4 100644 --- a/hwci/tests/button_print.py +++ b/hwci/tests/button_print.py @@ -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") @@ -37,13 +37,6 @@ 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) @@ -51,6 +44,13 @@ def oneshot_test(self, board): 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")