diff --git a/main/EMC2101.h b/main/EMC2101.h index f5dc9474..30525556 100644 --- a/main/EMC2101.h +++ b/main/EMC2101.h @@ -78,8 +78,8 @@ #define EMC2101_IDEALITY_1_0566 0x37 #define EMC2101_DEFAULT_IDEALITY EMC2101_IDEALITY_1_0319 ///< Default ideality factor -#define EMC2101_DEFAULT_BETA EMC2101_BETA_11 ///< Default beta compensation -#define EMC2101_DEFAULT_FILTER EMC2101_FILTER_1 ///< Default temp filter setting +#define EMC2101_DEFAULT_BETA EMC2101_BETA_11 ///< Default beta compensation +#define EMC2101_DEFAULT_FILTER EMC2101_FILTER_1 ///< Default temp filter setting #define EMC2101_DEFAULT_DATARATE EMC2101_DATARATE_32_HZ ///< Default temp conversion rate #define EMC2101_I2CADDR_DEFAULT 0x4C ///< EMC2101 default i2c address diff --git a/main/self_test/self_test.c b/main/self_test/self_test.c index 68bf2fac..e2ac62c6 100644 --- a/main/self_test/self_test.c +++ b/main/self_test/self_test.c @@ -18,12 +18,11 @@ #define POWER_CONSUMPTION_TARGET_GAMMA 11 //watts #define POWER_CONSUMPTION_MARGIN 3 //+/- watts -#define TEMP_CAL_LIMIT 1200 +//define this to just print die temp endlessly +//#define TEMP_TESTING static const char * TAG = "self_test"; -static void run_temp_cal(void); - bool should_test(GlobalState * GLOBAL_STATE) { bool is_max = GLOBAL_STATE->asic_model == ASIC_BM1397; uint64_t best_diff = nvs_config_get_u64(NVS_CONFIG_BEST_DIFF, 0); @@ -122,6 +121,21 @@ static bool core_voltage_pass(GlobalState * GLOBAL_STATE) return false; } +#ifdef TEMP_TESTING + static void run_temp_cal(void) { + float external = 0, internal = 0; + + while (1) { + external = EMC2101_get_external_temp(); + internal = EMC2101_get_internal_temp(); + ESP_LOGI(TAG, "ASIC: %.3f, AIR: %.3f [%.3f]", external, internal, external - internal); + vTaskDelay(500 / portTICK_PERIOD_MS); + } + + } +#endif + + void self_test(void * pvParameters) { GlobalState * GLOBAL_STATE = (GlobalState *) pvParameters; @@ -226,18 +240,13 @@ void self_test(void * pvParameters) uint8_t chips_detected = 0; - SERIAL_init(); - //chips_detected = (GLOBAL_STATE->ASIC_functions.init_fn)(0, GLOBAL_STATE->asic_count); chips_detected = (GLOBAL_STATE->ASIC_functions.init_fn)(GLOBAL_STATE->POWER_MANAGEMENT_MODULE.frequency_value, GLOBAL_STATE->asic_count); ESP_LOGI(TAG, "%u chips detected, %u expected", chips_detected, GLOBAL_STATE->asic_count); - //The following is used for temp testing - // //turn off vcore - // VCORE_set_voltage(0, GLOBAL_STATE); - // //delay 1 second to stabilize - // vTaskDelay(1000 / portTICK_PERIOD_MS); - // run_temp_cal(); + #ifdef TEMP_TESTING + run_temp_cal(); + #endif int baud = (*GLOBAL_STATE->ASIC_functions.set_max_baud_fn)(); @@ -387,15 +396,3 @@ void self_test(void * pvParameters) vTaskDelay(500 / portTICK_PERIOD_MS); } } - -// static void run_temp_cal(void) { -// float external = 0, internal = 0; - -// while (1) { -// external = EMC2101_get_external_temp(); -// internal = EMC2101_get_internal_temp(); -// ESP_LOGI(TAG, "ASIC: %.3f, AIR: %.3f [%.3f]", external, internal, external - internal); -// vTaskDelay(500 / portTICK_PERIOD_MS); -// } - -// }