From 1948f4bf87e8d18f10f35ac93a5ad7fb48edf69b Mon Sep 17 00:00:00 2001 From: skot <140785+skot@users.noreply.github.com> Date: Thu, 20 Mar 2025 13:31:24 -0400 Subject: [PATCH] V2.6.0b11 selftest fixes (#783) * make sure to gpio_install_isr_service() in selftest * fix the scrolling message on selftest pass/fail --- main/screen.c | 30 ++++++++++++++++++++---------- main/self_test/self_test.c | 19 ++++++++----------- 2 files changed, 28 insertions(+), 21 deletions(-) diff --git a/main/screen.c b/main/screen.c index af206215..c9352f13 100644 --- a/main/screen.c +++ b/main/screen.c @@ -32,7 +32,8 @@ static lv_obj_t *wifi_status_label; static lv_obj_t *self_test_message_label; static lv_obj_t *self_test_result_label; -static lv_obj_t *self_test_finished_label; +static lv_obj_t *self_test_finished_label_pass; +static lv_obj_t *self_test_finished_label_fail; static double current_hashrate; static float current_power; @@ -54,14 +55,19 @@ static lv_obj_t * create_scr_self_test() { lv_label_set_text(label1, "BITAXE SELF TEST"); self_test_message_label = lv_label_create(scr); - self_test_result_label = lv_label_create(scr); - self_test_finished_label = lv_label_create(scr); - lv_obj_set_width(self_test_finished_label, LV_HOR_RES); - lv_obj_add_flag(self_test_finished_label, LV_OBJ_FLAG_HIDDEN); - lv_label_set_long_mode(self_test_finished_label, LV_LABEL_LONG_SCROLL_CIRCULAR); - lv_label_set_text(self_test_finished_label, "Hold BOOT button for 2 seconds to cancel self test, or press RESET to run again."); + self_test_finished_label_pass = lv_label_create(scr); + lv_obj_set_width(self_test_finished_label_pass, LV_HOR_RES); + lv_obj_add_flag(self_test_finished_label_pass, LV_OBJ_FLAG_HIDDEN); + lv_label_set_long_mode(self_test_finished_label_pass, LV_LABEL_LONG_SCROLL_CIRCULAR); + lv_label_set_text(self_test_finished_label_pass, "Press RESET button to start Bitaxe."); + + self_test_finished_label_fail = lv_label_create(scr); + lv_obj_set_width(self_test_finished_label_fail, LV_HOR_RES); + lv_obj_add_flag(self_test_finished_label_fail, LV_OBJ_FLAG_HIDDEN); + lv_label_set_long_mode(self_test_finished_label_fail, LV_LABEL_LONG_SCROLL_CIRCULAR); + lv_label_set_text(self_test_finished_label_fail, "Hold BOOT button for 2 seconds to cancel self test, or press RESET to run again."); return scr; } @@ -251,9 +257,13 @@ static void screen_update_cb(lv_timer_t * timer) lv_label_set_text(self_test_message_label, self_test->message); if (self_test->finished) { - lv_label_set_text(self_test_result_label, self_test->result ? "TESTS PASS!" : "TESTS FAIL!"); - - lv_obj_remove_flag(self_test_finished_label, LV_OBJ_FLAG_HIDDEN); + if (self_test->result) { + lv_label_set_text(self_test_result_label, "TESTS PASS!"); + lv_obj_remove_flag(self_test_finished_label_pass, LV_OBJ_FLAG_HIDDEN); + } else { + lv_label_set_text(self_test_result_label, "TESTS FAIL!"); + lv_obj_remove_flag(self_test_finished_label_fail, LV_OBJ_FLAG_HIDDEN); + } } return; diff --git a/main/self_test/self_test.c b/main/self_test/self_test.c index cd5399a8..eccff017 100644 --- a/main/self_test/self_test.c +++ b/main/self_test/self_test.c @@ -2,7 +2,7 @@ // #include "freertos/event_groups.h" // #include "freertos/timers.h" -// #include "driver/gpio.h" +#include "driver/gpio.h" #include "esp_log.h" #include "esp_timer.h" @@ -22,6 +22,7 @@ #include "utils.h" #include "TPS546.h" #include "esp_psram.h" +#include "power.h" #include "asic.h" @@ -321,6 +322,8 @@ void self_test(void * pvParameters) // Create a binary semaphore BootSemaphore = xSemaphoreCreateBinary(); + gpio_install_isr_service(0); + if (BootSemaphore == NULL) { ESP_LOGE(TAG, "Failed to create semaphore"); return; @@ -534,16 +537,10 @@ void self_test(void * pvParameters) static void tests_done(GlobalState * GLOBAL_STATE, bool test_result) { - switch (GLOBAL_STATE->device_model) { - case DEVICE_MAX: - case DEVICE_ULTRA: - case DEVICE_SUPRA: - case DEVICE_GAMMA: - GLOBAL_STATE->SELF_TEST_MODULE.result = test_result; - GLOBAL_STATE->SELF_TEST_MODULE.finished = true; - break; - default: - } + + GLOBAL_STATE->SELF_TEST_MODULE.result = test_result; + GLOBAL_STATE->SELF_TEST_MODULE.finished = true; + Power_disable(GLOBAL_STATE); if (test_result == TESTS_FAILED) { ESP_LOGI(TAG, "SELF TESTS FAIL -- Press RESET to continue");