BV HiZ: improve tests
This commit is contained in:
parent
ee184b0144
commit
91e085d6a6
|
@ -382,6 +382,7 @@ static bool busvoodoo_hiz_test_self(bool halt)
|
|||
}
|
||||
|
||||
to_return = true; // all tests are successful
|
||||
printf("self-test succeeded\n"); // notify user
|
||||
error:
|
||||
if (!to_return) {
|
||||
if (halt) { // halt on error if requested
|
||||
|
@ -407,6 +408,7 @@ static bool busvoodoo_hiz_test_pins(bool halt)
|
|||
|
||||
const char* lv_to = "connect I/O pin 4 to "; // most outputs will be tested using LV ADC
|
||||
char* pinout[10] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}; // pinout to display
|
||||
pinout[3] = "O"; // set main testing pin
|
||||
busvoodoo_oled_text_right("pins test"); // display test on display
|
||||
busvoodoo_oled_update(); // update screen
|
||||
|
||||
|
@ -415,7 +417,6 @@ static bool busvoodoo_hiz_test_pins(bool halt)
|
|||
gpio_set_mode(GPIO(BUSVOODOO_LVCTL_PORT), GPIO_MODE_OUTPUT_2_MHZ, GPIO_CNF_OUTPUT_PUSHPULL, GPIO(BUSVOODOO_LVCTL_PIN)); // set LV control pin as output
|
||||
printf("%sI/O pin 1\n", lv_to); // ask user for action
|
||||
led_red(); // notify user to perform action
|
||||
pinout[3] = "O"; // set main testing pin
|
||||
pinout[0] = "O"; // set target testing pin
|
||||
busvoodoo_oled_text_pinout((const char**)pinout, true); // display pins to user
|
||||
busvoodoo_oled_update(); // update screen
|
||||
|
@ -466,8 +467,11 @@ static bool busvoodoo_hiz_test_pins(bool halt)
|
|||
busvoodoo_oled_text_pinout((const char**)pinout, true); // display pins to user
|
||||
busvoodoo_oled_update(); // update screen
|
||||
do {
|
||||
sleep_ms(100); // wait for user to make connection
|
||||
} while ((busvoodoo_vreg_get(BUSVOODOO_LV_CHANNEL)<0.2 || busvoodoo_vreg_get(BUSVOODOO_LV_CHANNEL)>3.5) && !user_input_available); // wait until pin is connected
|
||||
do {
|
||||
sleep_ms(100); // wait for user to make connection
|
||||
} while ((busvoodoo_vreg_get(BUSVOODOO_LV_CHANNEL)<0.2 || busvoodoo_vreg_get(BUSVOODOO_LV_CHANNEL)>3.5) && !user_input_available); // wait until pin is connected
|
||||
sleep_ms(100); // wait for stable connection
|
||||
} while ((busvoodoo_vreg_get(BUSVOODOO_LV_CHANNEL)<0.2 || busvoodoo_vreg_get(BUSVOODOO_LV_CHANNEL)>3.5) && !user_input_available); // check to be sure it really is not on the 5V pin
|
||||
led_blue(); // notify user test is running
|
||||
if (user_input_available) { // user interruption
|
||||
goto error;
|
||||
|
@ -740,9 +744,6 @@ error:
|
|||
}
|
||||
}
|
||||
busvoodoo_safe_state(); // go back to safe state
|
||||
busvoodoo_oled_text_left("HiZ"); // reset mode text
|
||||
busvoodoo_oled_text_pinout(busvoodoo_global_pinout_io, true); // reset pinout
|
||||
busvoodoo_oled_update(); // update display to show text and pinout
|
||||
|
||||
return to_return;
|
||||
}
|
||||
|
@ -796,9 +797,9 @@ static void busvoodoo_hiz_command_test_self(void* argument)
|
|||
printf("remove all cables from connectors and press space to start (or any other key to abort)\n");
|
||||
led_red(); // show red LED to indicate test started
|
||||
if (' '==user_input_get()) { // space entered
|
||||
printf("self-test running\n");
|
||||
if (busvoodoo_hiz_test_self(halt)) { // perform self-test
|
||||
led_blue(); // show blue to indicate test passed
|
||||
printf("self-test succeeded\n"); // notify user
|
||||
} else {
|
||||
led_blink(0.5, 0.5); // show error on LEDs
|
||||
printf("self-test failed\n"); // notify user
|
||||
|
@ -829,8 +830,13 @@ static void busvoodoo_hiz_command_test_pins(void* argument)
|
|||
if (halt) {
|
||||
printf("WARNING: halting on error can cause hardware damages (press any key to exit halt state)\n");
|
||||
}
|
||||
printf("remove all cables from connectors and press space to start (or any other key to abort)\n");
|
||||
led_red(); // show red LED to indicate test started
|
||||
char* pinout[10] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}; // pinout to display
|
||||
pinout[3] = "O"; // set main testing pin
|
||||
busvoodoo_oled_text_right("pins test"); // display test on display
|
||||
busvoodoo_oled_text_pinout((const char**)pinout, true); // reset pinout
|
||||
busvoodoo_oled_update(); // update screen
|
||||
printf("connect one lead of jumper wire to I/O pin 4 and press space to start (or any other key to abort)\n");
|
||||
if (' '==user_input_get()) { // space entered
|
||||
if (busvoodoo_hiz_test_pins(halt)) { // perform pin test
|
||||
led_blue(); // show blue OK LED
|
||||
|
@ -844,7 +850,11 @@ static void busvoodoo_hiz_command_test_pins(void* argument)
|
|||
}
|
||||
} else {
|
||||
printf("pins test aborted\n");
|
||||
led_blue(); // switch back to main blue LED
|
||||
}
|
||||
busvoodoo_oled_text_left("HiZ"); // reset mode text
|
||||
busvoodoo_oled_text_pinout(busvoodoo_global_pinout_io, true); // reset pinout
|
||||
busvoodoo_oled_update(); // update display to show text and pinout
|
||||
}
|
||||
|
||||
/** HiZ menu commands */
|
||||
|
|
Loading…
Reference in New Issue