V2.6.0b11 selftest fixes (#783)

* make sure to gpio_install_isr_service() in selftest

* fix the scrolling message on selftest pass/fail
This commit is contained in:
skot 2025-03-20 13:31:24 -04:00 committed by GitHub
parent 76692381f9
commit 1948f4bf87
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 28 additions and 21 deletions

View File

@ -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;

View File

@ -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");