From 84ecc16632cf3f4ce2655e684636d2033f05d970 Mon Sep 17 00:00:00 2001 From: Skot Date: Thu, 14 Nov 2024 18:02:49 -0500 Subject: [PATCH 01/56] added several configs to EMC2101 init --- components/asic/bm1370.c | 5 +++++ main/EMC2101.c | 16 +++++++++++++++- main/EMC2101.h | 5 +++++ main/self_test/self_test.c | 27 +++++++++++++++++++++++++-- 4 files changed, 50 insertions(+), 3 deletions(-) diff --git a/components/asic/bm1370.c b/components/asic/bm1370.c index 7ab12d506..2e61383f8 100644 --- a/components/asic/bm1370.c +++ b/components/asic/bm1370.c @@ -196,6 +196,11 @@ static void do_frequency_ramp_up(float target_frequency) { float current = 56.25; float step = 6.25; + if (target_frequency == 0) { + ESP_LOGI(TAG, "Skipping frequency ramp"); + return; + } + ESP_LOGI(TAG, "Ramping up frequency from %.2f MHz to %.2f MHz with step %.2f MHz", current, target_frequency, step); BM1370_send_hash_frequency(-1, current, 0.001); diff --git a/main/EMC2101.c b/main/EMC2101.c index daf1237ee..992e8c0c6 100644 --- a/main/EMC2101.c +++ b/main/EMC2101.c @@ -29,6 +29,18 @@ esp_err_t EMC2101_init(bool invertPolarity) { ESP_ERROR_CHECK(i2c_bitaxe_register_write_byte(emc2101_dev_handle, EMC2101_FAN_CONFIG, 0b00100011)); } + //set Ideality Factor + ESP_ERROR_CHECK(i2c_bitaxe_register_write_byte(emc2101_dev_handle, EMC2101_IDEALITY_FACTOR, EMC2101_DEFAULT_IDEALITY)); + + //set Beta Compensation + ESP_ERROR_CHECK(i2c_bitaxe_register_write_byte(emc2101_dev_handle, EMC2101_BETA_COMPENSATION, EMC2101_DEFAULT_BETA)); + + //set filtering + ESP_ERROR_CHECK(i2c_bitaxe_register_write_byte(emc2101_dev_handle, EMC2101_TEMP_FILTER, 0x06)); + + //set conversion rate + ESP_ERROR_CHECK(i2c_bitaxe_register_write_byte(emc2101_dev_handle, EMC2101_REG_DATA_RATE, 0x09)); + return ESP_OK; } @@ -86,8 +98,10 @@ float EMC2101_get_external_temp(void) // Greater than 200C is probably an erroneous reading... if (result > 200){ - return EMC2101_get_internal_temp(); + ESP_LOGE(TAG, "EMC2101 Invalid result: %04X", reading); + result = 0; } + return result; } diff --git a/main/EMC2101.h b/main/EMC2101.h index 00c82a471..fbdbcdfba 100644 --- a/main/EMC2101.h +++ b/main/EMC2101.h @@ -3,6 +3,9 @@ #include "i2c_bitaxe.h" +#define EMC2101_DEFAULT_IDEALITY 0x12 ///< Default ideality factor +#define EMC2101_DEFAULT_BETA 0x00 ///< Default beta compensation + #define EMC2101_I2CADDR_DEFAULT 0x4C ///< EMC2101 default i2c address #define EMC2101_CHIP_ID 0x16 ///< EMC2101 default device id from part id #define EMC2101_ALT_CHIP_ID 0x28 ///< EMC2101 alternate device id from part id @@ -18,6 +21,8 @@ #define EMC2101_REG_CONFIG 0x03 ///< configuration register #define EMC2101_REG_DATA_RATE 0x04 ///< Data rate config #define EMC2101_TEMP_FORCE 0x0C ///< Temp force setting for LUT testing +#define EMC2101_IDEALITY_FACTOR 0x17 ///< Beta Compensation Register +#define EMC2101_BETA_COMPENSATION 0x18 ///< Beta Compensation Register #define EMC2101_TACH_LSB 0x46 ///< Tach RPM data low byte #define EMC2101_TACH_MSB 0x47 ///< Tach RPM data high byte #define EMC2101_TACH_LIMIT_LSB 0x48 ///< Tach low-speed setting low byte. INVERSE OF THE SPEED diff --git a/main/self_test/self_test.c b/main/self_test/self_test.c index 89fcc9d5e..59f6659d8 100644 --- a/main/self_test/self_test.c +++ b/main/self_test/self_test.c @@ -18,8 +18,12 @@ #define POWER_CONSUMPTION_TARGET_GAMMA 11 //watts #define POWER_CONSUMPTION_MARGIN 3 //+/- watts +#define TEMP_CAL_LIMIT 1200 + 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); @@ -175,7 +179,7 @@ void self_test(void * pvParameters) } uint8_t result = VCORE_init(GLOBAL_STATE); - VCORE_set_voltage(nvs_config_get_u16(NVS_CONFIG_ASIC_VOLTAGE, CONFIG_ASIC_VOLTAGE) / 1000.0, GLOBAL_STATE); + VCORE_set_voltage(1150 / 1000.0, GLOBAL_STATE); // VCore regulator testing switch (GLOBAL_STATE->device_model) { @@ -222,9 +226,16 @@ void self_test(void * pvParameters) SERIAL_init(); - uint8_t chips_detected = (GLOBAL_STATE->ASIC_functions.init_fn)(GLOBAL_STATE->POWER_MANAGEMENT_MODULE.frequency_value, GLOBAL_STATE->asic_count); + uint8_t chips_detected = (GLOBAL_STATE->ASIC_functions.init_fn)(0, GLOBAL_STATE->asic_count); ESP_LOGI(TAG, "%u chips detected, %u expected", chips_detected, GLOBAL_STATE->asic_count); + //turn off vcore + VCORE_set_voltage(0, GLOBAL_STATE); + //delay 1 second to stabilize + vTaskDelay(1000 / portTICK_PERIOD_MS); + run_temp_cal(); + + int baud = (*GLOBAL_STATE->ASIC_functions.set_max_baud_fn)(); vTaskDelay(10 / portTICK_PERIOD_MS); SERIAL_set_baud(baud); @@ -372,3 +383,15 @@ 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); + } + +} From a184e1ed6b681f86cf7f9e1f363af068f7cbcf04 Mon Sep 17 00:00:00 2001 From: Skot Date: Thu, 14 Nov 2024 19:55:17 -0500 Subject: [PATCH 02/56] changed back to defaults --- main/EMC2101.c | 4 ++-- main/EMC2101.h | 16 ++++++++++++++-- main/self_test/self_test.c | 17 +++++++++++------ 3 files changed, 27 insertions(+), 10 deletions(-) diff --git a/main/EMC2101.c b/main/EMC2101.c index 992e8c0c6..b941ea814 100644 --- a/main/EMC2101.c +++ b/main/EMC2101.c @@ -36,10 +36,10 @@ esp_err_t EMC2101_init(bool invertPolarity) { ESP_ERROR_CHECK(i2c_bitaxe_register_write_byte(emc2101_dev_handle, EMC2101_BETA_COMPENSATION, EMC2101_DEFAULT_BETA)); //set filtering - ESP_ERROR_CHECK(i2c_bitaxe_register_write_byte(emc2101_dev_handle, EMC2101_TEMP_FILTER, 0x06)); + ESP_ERROR_CHECK(i2c_bitaxe_register_write_byte(emc2101_dev_handle, EMC2101_TEMP_FILTER, EMC2101_DEFAULT_FILTER)); //set conversion rate - ESP_ERROR_CHECK(i2c_bitaxe_register_write_byte(emc2101_dev_handle, EMC2101_REG_DATA_RATE, 0x09)); + ESP_ERROR_CHECK(i2c_bitaxe_register_write_byte(emc2101_dev_handle, EMC2101_REG_DATA_RATE, EMC2101_DEFAULT_DATARATE)); return ESP_OK; diff --git a/main/EMC2101.h b/main/EMC2101.h index fbdbcdfba..fe6a860bc 100644 --- a/main/EMC2101.h +++ b/main/EMC2101.h @@ -3,8 +3,20 @@ #include "i2c_bitaxe.h" -#define EMC2101_DEFAULT_IDEALITY 0x12 ///< Default ideality factor -#define EMC2101_DEFAULT_BETA 0x00 ///< Default beta compensation +#define EMC2101_CPU_BETA_11 0x00 +#define EMC2101_CPU_BETA_18 0x01 +#define EMC2101_CPU_BETA_25 0x02 +#define EMC2101_CPU_BETA_33 0x03 +#define EMC2101_CPU_BETA_43 0x04 +#define EMC2101_CPU_BETA_100 0x05 +#define EMC2101_CPU_BETA_233 0x06 +#define EMC2101_CPU_BETA_DISABLED 0x07 +#define EMC2101_CPU_BETA_AUTO 0x08 + +#define EMC2101_DEFAULT_IDEALITY 0x12 ///< Default ideality factor [1.008 -> 0x12] +#define EMC2101_DEFAULT_BETA EMC2101_CPU_BETA_AUTO ///< Default beta compensation +#define EMC2101_DEFAULT_FILTER 0x06 ///< Default temp filter setting +#define EMC2101_DEFAULT_DATARATE 0x09 ///< Default temp conversion rate #define EMC2101_I2CADDR_DEFAULT 0x4C ///< EMC2101 default i2c address #define EMC2101_CHIP_ID 0x16 ///< EMC2101 default device id from part id diff --git a/main/self_test/self_test.c b/main/self_test/self_test.c index 59f6659d8..30dabe468 100644 --- a/main/self_test/self_test.c +++ b/main/self_test/self_test.c @@ -224,16 +224,21 @@ void self_test(void * pvParameters) default: } + uint8_t chips_detected = 0; + SERIAL_init(); - uint8_t chips_detected = (GLOBAL_STATE->ASIC_functions.init_fn)(0, GLOBAL_STATE->asic_count); + //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); - //turn off vcore - VCORE_set_voltage(0, GLOBAL_STATE); - //delay 1 second to stabilize - vTaskDelay(1000 / portTICK_PERIOD_MS); - run_temp_cal(); + // //turn off vcore + // VCORE_set_voltage(0, GLOBAL_STATE); + // //delay 1 second to stabilize + // vTaskDelay(1000 / portTICK_PERIOD_MS); + + + //run_temp_cal(); int baud = (*GLOBAL_STATE->ASIC_functions.set_max_baud_fn)(); From 050a18c1e4e820d57fe8114abcb497d6dd89bc88 Mon Sep 17 00:00:00 2001 From: Skot Date: Fri, 15 Nov 2024 13:30:27 -0500 Subject: [PATCH 03/56] added missing BM1370 init registers --- components/asic/bm1370.c | 48 ++++++++++++++++++++++++-------------- main/EMC2101.h | 39 +++++++++++++++++++++---------- main/self_test/self_test.c | 2 +- 3 files changed, 58 insertions(+), 31 deletions(-) diff --git a/components/asic/bm1370.c b/components/asic/bm1370.c index 2e61383f8..f1c027279 100644 --- a/components/asic/bm1370.c +++ b/components/asic/bm1370.c @@ -111,7 +111,7 @@ static void _send_simple(uint8_t * data, uint8_t total_length) { unsigned char * buf = malloc(total_length); memcpy(buf, data, total_length); - SERIAL_send(buf, total_length, false); + SERIAL_send(buf, total_length, BM1370_SERIALTX_DEBUG); free(buf); } @@ -243,8 +243,8 @@ static uint8_t _send_init(uint64_t frequency, uint16_t asic_count) //Misc Control //**TX: 55 AA 51 09 00 18 F0 00 C1 00 04 //command all chips, write chip address 00, register 18, data F0 00 C1 00 - Misc Control - //unsigned char init6[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x18, 0xF0, 0x00, 0xC1, 0x00, 0x04}; //from S21Pro dump - unsigned char init6[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x18, 0xFF, 0x0F, 0xC1, 0x00, 0x00}; + unsigned char init6[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x18, 0xF0, 0x00, 0xC1, 0x00, 0x04}; //from S21Pro dump + //unsigned char init6[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x18, 0xFF, 0x0F, 0xC1, 0x00, 0x00}; _send_simple(init6, 11); //chain inactive @@ -266,8 +266,8 @@ static uint8_t _send_init(uint64_t frequency, uint16_t asic_count) //Core Register Control //**TX: 55 AA 51 09 00 3C 80 00 80 0C 11 //command all chips, write chip address 00, register 3C, data 80 00 80 0C - Core Register Control - //unsigned char init10[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x3C, 0x80, 0x00, 0x80, 0x0C, 0x11}; //from S21Pro dump - unsigned char init10[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x3C, 0x80, 0x00, 0x80, 0x18, 0x1F}; + unsigned char init10[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x3C, 0x80, 0x00, 0x80, 0x0C, 0x11}; //from S21Pro dump + //unsigned char init10[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x3C, 0x80, 0x00, 0x80, 0x18, 0x1F}; _send_simple(init10, 11); //set ticket mask @@ -275,35 +275,47 @@ static uint8_t _send_init(uint64_t frequency, uint16_t asic_count) // _send_simple(init11, 11); BM1370_set_job_difficulty_mask(BM1370_ASIC_DIFFICULTY); - //Analog Mux Control - unsigned char init12[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x54, 0x00, 0x00, 0x00, 0x03, 0x1D}; - _send_simple(init12, 11); + //Analog Mux Control -- not sent on S21 Pro? + // unsigned char init12[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x54, 0x00, 0x00, 0x00, 0x03, 0x1D}; + // _send_simple(init12, 11); //Set the IO Driver Strength on chip 00 - //**TX: 55 AA 51 09 00 58 00 01 11 11 0D //command all chips, write chip address 00, register 58, data 01 11 11 11 - Set the IO Driver Strength on chip 00 - //unsigned char init13[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x58, 0x00, 0x01, 0x11, 0x11, 0x0D}; //from S21Pro dump - unsigned char init13[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x58, 0x02, 0x11, 0x11, 0x11, 0x06}; + //TX: 55 AA 51 09 00 58 00 01 11 11 0D //command all chips, write chip address 00, register 58, data 01 11 11 11 - Set the IO Driver Strength on chip 00 + unsigned char init13[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x58, 0x00, 0x01, 0x11, 0x11, 0x0D}; //from S21Pro dump + //unsigned char init13[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x58, 0x02, 0x11, 0x11, 0x11, 0x06}; _send_simple(init13, 11); for (uint8_t i = 0; i < chip_counter; i++) { - //Reg_A8 + //TX: 55 AA 41 09 00 [A8 00 07 01 F0] 15 // Reg_A8 unsigned char set_a8_register[6] = {i * address_interval, 0xA8, 0x00, 0x07, 0x01, 0xF0}; _send_BM1370((TYPE_CMD | GROUP_SINGLE | CMD_WRITE), set_a8_register, 6, BM1370_SERIALTX_DEBUG); - //Misc Control + //TX: 55 AA 41 09 00 [18 F0 00 C1 00] 0C // Misc Control unsigned char set_18_register[6] = {i * address_interval, 0x18, 0xF0, 0x00, 0xC1, 0x00}; _send_BM1370((TYPE_CMD | GROUP_SINGLE | CMD_WRITE), set_18_register, 6, BM1370_SERIALTX_DEBUG); - //Core Register Control + //TX: 55 AA 41 09 00 [3C 80 00 8B 00] 1A // Core Register Control unsigned char set_3c_register_first[6] = {i * address_interval, 0x3C, 0x80, 0x00, 0x8B, 0x00}; _send_BM1370((TYPE_CMD | GROUP_SINGLE | CMD_WRITE), set_3c_register_first, 6, BM1370_SERIALTX_DEBUG); - //Core Register Control - //unsigned char set_3c_register_second[6] = {i * address_interval, 0x3C, 0x80, 0x00, 0x80, 0x0C}; //from S21Pro dump - unsigned char set_3c_register_second[6] = {i * address_interval, 0x3C, 0x80, 0x00, 0x80, 0x18}; + //TX: 55 AA 41 09 00 [3C 80 00 80 0C] 19 // Core Register Control + unsigned char set_3c_register_second[6] = {i * address_interval, 0x3C, 0x80, 0x00, 0x80, 0x0C}; _send_BM1370((TYPE_CMD | GROUP_SINGLE | CMD_WRITE), set_3c_register_second, 6, BM1370_SERIALTX_DEBUG); - //Core Register Control + //TX: 55 AA 41 09 00 [3C 80 00 82 AA] 05 // Core Register Control unsigned char set_3c_register_third[6] = {i * address_interval, 0x3C, 0x80, 0x00, 0x82, 0xAA}; _send_BM1370((TYPE_CMD | GROUP_SINGLE | CMD_WRITE), set_3c_register_third, 6, BM1370_SERIALTX_DEBUG); } + //Some misc settings? + // TX: 55 AA 51 09 00 B9 00 00 44 80 0D //command all chips, write chip address 00, register B9, data 00 00 44 80 + unsigned char init14[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0xB9, 0x00, 0x00, 0x44, 0x80, 0x0D}; + _send_simple(init14, 11); + // TX: 55 AA 51 09 00 [54 00 00 00 02] 18 //command all chips, write chip address 00, register 54, data 00 00 00 02 - Analog Mux Control - S21 does this earlier on + _send_BM1370((TYPE_CMD | GROUP_ALL | CMD_WRITE), (uint8_t[]){0x54, 0x00, 0x00, 0x00, 0x02}, 6, BM1370_SERIALTX_DEBUG); + // TX: 55 AA 51 09 00 B9 00 00 44 80 0D //command all chips, write chip address 00, register B9, data 00 00 44 80 -- duplicate of first command in series + unsigned char init16[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0xB9, 0x00, 0x00, 0x44, 0x80, 0x0D}; + _send_simple(init16, 11); + // TX: 55 AA 51 09 00 3C 80 00 8D EE 1B //command all chips, write chip address 00, register 3C, data 80 00 8D EE + unsigned char init17[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x3C, 0x80, 0x00, 0x8D, 0xEE, 0x1B}; + _send_simple(init17, 11); + do_frequency_ramp_up(frequency); //BM1370_send_hash_frequency(frequency); diff --git a/main/EMC2101.h b/main/EMC2101.h index fe6a860bc..8b423cb17 100644 --- a/main/EMC2101.h +++ b/main/EMC2101.h @@ -3,20 +3,35 @@ #include "i2c_bitaxe.h" -#define EMC2101_CPU_BETA_11 0x00 -#define EMC2101_CPU_BETA_18 0x01 -#define EMC2101_CPU_BETA_25 0x02 -#define EMC2101_CPU_BETA_33 0x03 -#define EMC2101_CPU_BETA_43 0x04 -#define EMC2101_CPU_BETA_100 0x05 -#define EMC2101_CPU_BETA_233 0x06 -#define EMC2101_CPU_BETA_DISABLED 0x07 -#define EMC2101_CPU_BETA_AUTO 0x08 +#define EMC2101_BETA_11 0x00 +#define EMC2101_BETA_18 0x01 +#define EMC2101_BETA_25 0x02 +#define EMC2101_BETA_33 0x03 +#define EMC2101_BETA_43 0x04 +#define EMC2101_BETA_100 0x05 +#define EMC2101_BETA_233 0x06 +#define EMC2101_BETA_DISABLED 0x07 +#define EMC2101_BETA_AUTO 0x08 + +#define EMC2101_FILTER_DISABLED 0x00 +#define EMC2101_FILTER_1 0x01 +#define EMC2101_FILTER_2 0x02 + +#define EMC2101_DATARATE_1_16_HZ 0x00 +#define EMC2101_DATARATE_1_8_HZ 0x01 +#define EMC2101_DATARATE_1_4_HZ 0x02 +#define EMC2101_DATARATE_1_2_HZ 0x03 +#define EMC2101_DATARATE_1_HZ 0x04 +#define EMC2101_DATARATE_2_HZ 0x05 +#define EMC2101_DATARATE_4_HZ 0x06 +#define EMC2101_DATARATE_8_HZ 0x07 +#define EMC2101_DATARATE_16_HZ 0x08 //default +#define EMC2101_DATARATE_32_HZ 0x09 #define EMC2101_DEFAULT_IDEALITY 0x12 ///< Default ideality factor [1.008 -> 0x12] -#define EMC2101_DEFAULT_BETA EMC2101_CPU_BETA_AUTO ///< Default beta compensation -#define EMC2101_DEFAULT_FILTER 0x06 ///< Default temp filter setting -#define EMC2101_DEFAULT_DATARATE 0x09 ///< Default temp conversion rate +#define EMC2101_DEFAULT_BETA EMC2101_BETA_AUTO ///< Default beta compensation +#define EMC2101_DEFAULT_FILTER EMC2101_FILTER_DISABLED ///< Default temp filter setting +#define EMC2101_DEFAULT_DATARATE EMC2101_DATARATE_16_HZ ///< Default temp conversion rate #define EMC2101_I2CADDR_DEFAULT 0x4C ///< EMC2101 default i2c address #define EMC2101_CHIP_ID 0x16 ///< EMC2101 default device id from part id diff --git a/main/self_test/self_test.c b/main/self_test/self_test.c index 30dabe468..1dd00e0ac 100644 --- a/main/self_test/self_test.c +++ b/main/self_test/self_test.c @@ -238,7 +238,7 @@ void self_test(void * pvParameters) // vTaskDelay(1000 / portTICK_PERIOD_MS); - //run_temp_cal(); + run_temp_cal(); int baud = (*GLOBAL_STATE->ASIC_functions.set_max_baud_fn)(); From a76bc530c8cec23948617d72fd2f4c43d84bf0d2 Mon Sep 17 00:00:00 2001 From: Skot Date: Fri, 15 Nov 2024 14:23:58 -0500 Subject: [PATCH 04/56] typo in BM1370 init misc bytes --- components/asic/bm1370.c | 23 ++++++++++------------- main/EMC2101.h | 2 +- main/self_test/self_test.c | 2 +- 3 files changed, 12 insertions(+), 15 deletions(-) diff --git a/components/asic/bm1370.c b/components/asic/bm1370.c index f1c027279..8831cd797 100644 --- a/components/asic/bm1370.c +++ b/components/asic/bm1370.c @@ -242,7 +242,7 @@ static uint8_t _send_init(uint64_t frequency, uint16_t asic_count) _send_simple(init5, 11); //Misc Control - //**TX: 55 AA 51 09 00 18 F0 00 C1 00 04 //command all chips, write chip address 00, register 18, data F0 00 C1 00 - Misc Control + //TX: 55 AA 51 09 00 18 F0 00 C1 00 04 //command all chips, write chip address 00, register 18, data F0 00 C1 00 - Misc Control unsigned char init6[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x18, 0xF0, 0x00, 0xC1, 0x00, 0x04}; //from S21Pro dump //unsigned char init6[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x18, 0xFF, 0x0F, 0xC1, 0x00, 0x00}; _send_simple(init6, 11); @@ -265,7 +265,7 @@ static uint8_t _send_init(uint64_t frequency, uint16_t asic_count) _send_simple(init9, 11); //Core Register Control - //**TX: 55 AA 51 09 00 3C 80 00 80 0C 11 //command all chips, write chip address 00, register 3C, data 80 00 80 0C - Core Register Control + //TX: 55 AA 51 09 00 3C 80 00 80 0C 11 //command all chips, write chip address 00, register 3C, data 80 00 80 0C - Core Register Control unsigned char init10[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x3C, 0x80, 0x00, 0x80, 0x0C, 0x11}; //from S21Pro dump //unsigned char init10[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x3C, 0x80, 0x00, 0x80, 0x18, 0x1F}; _send_simple(init10, 11); @@ -304,17 +304,14 @@ static uint8_t _send_init(uint64_t frequency, uint16_t asic_count) } //Some misc settings? - // TX: 55 AA 51 09 00 B9 00 00 44 80 0D //command all chips, write chip address 00, register B9, data 00 00 44 80 - unsigned char init14[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0xB9, 0x00, 0x00, 0x44, 0x80, 0x0D}; - _send_simple(init14, 11); - // TX: 55 AA 51 09 00 [54 00 00 00 02] 18 //command all chips, write chip address 00, register 54, data 00 00 00 02 - Analog Mux Control - S21 does this earlier on - _send_BM1370((TYPE_CMD | GROUP_ALL | CMD_WRITE), (uint8_t[]){0x54, 0x00, 0x00, 0x00, 0x02}, 6, BM1370_SERIALTX_DEBUG); - // TX: 55 AA 51 09 00 B9 00 00 44 80 0D //command all chips, write chip address 00, register B9, data 00 00 44 80 -- duplicate of first command in series - unsigned char init16[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0xB9, 0x00, 0x00, 0x44, 0x80, 0x0D}; - _send_simple(init16, 11); - // TX: 55 AA 51 09 00 3C 80 00 8D EE 1B //command all chips, write chip address 00, register 3C, data 80 00 8D EE - unsigned char init17[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x3C, 0x80, 0x00, 0x8D, 0xEE, 0x1B}; - _send_simple(init17, 11); + // TX: 55 AA 51 09 [00 B9 00 00 44 80] 0D //command all chips, write chip address 00, register B9, data 00 00 44 80 + _send_BM1370((TYPE_CMD | GROUP_ALL | CMD_WRITE), (uint8_t[]){0x00, 0xB9, 0x00, 0x00, 0x44, 0x80}, 6, BM1370_SERIALTX_DEBUG); + // TX: 55 AA 51 09 [00 54 00 00 00 02] 18 //command all chips, write chip address 00, register 54, data 00 00 00 02 - Analog Mux Control - S21 does this earlier on + _send_BM1370((TYPE_CMD | GROUP_ALL | CMD_WRITE), (uint8_t[]){0x00, 0x54, 0x00, 0x00, 0x00, 0x02}, 6, BM1370_SERIALTX_DEBUG); + // TX: 55 AA 51 09 [00 B9 00 00 44 80] 0D //command all chips, write chip address 00, register B9, data 00 00 44 80 -- duplicate of first command in series + _send_BM1370((TYPE_CMD | GROUP_ALL | CMD_WRITE), (uint8_t[]){0x00, 0xB9, 0x00, 0x00, 0x44, 0x80}, 6, BM1370_SERIALTX_DEBUG); + // TX: 55 AA 51 09 [00 3C 80 00 8D EE] 1B //command all chips, write chip address 00, register 3C, data 80 00 8D EE + _send_BM1370((TYPE_CMD | GROUP_ALL | CMD_WRITE), (uint8_t[]){0x00, 0x3C, 0x80, 0x00, 0x8D, 0xEE}, 6, BM1370_SERIALTX_DEBUG); do_frequency_ramp_up(frequency); diff --git a/main/EMC2101.h b/main/EMC2101.h index 8b423cb17..7931a1e22 100644 --- a/main/EMC2101.h +++ b/main/EMC2101.h @@ -30,7 +30,7 @@ #define EMC2101_DEFAULT_IDEALITY 0x12 ///< Default ideality factor [1.008 -> 0x12] #define EMC2101_DEFAULT_BETA EMC2101_BETA_AUTO ///< Default beta compensation -#define EMC2101_DEFAULT_FILTER EMC2101_FILTER_DISABLED ///< Default temp filter setting +#define EMC2101_DEFAULT_FILTER EMC2101_FILTER_DISABLED ///< Default temp filter setting #define EMC2101_DEFAULT_DATARATE EMC2101_DATARATE_16_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 1dd00e0ac..e575cc40e 100644 --- a/main/self_test/self_test.c +++ b/main/self_test/self_test.c @@ -238,7 +238,7 @@ void self_test(void * pvParameters) // vTaskDelay(1000 / portTICK_PERIOD_MS); - run_temp_cal(); + // run_temp_cal(); int baud = (*GLOBAL_STATE->ASIC_functions.set_max_baud_fn)(); From 489c7f6a500350f02010f8e1d7c0d384f5f48e84 Mon Sep 17 00:00:00 2001 From: Skot Date: Fri, 15 Nov 2024 16:44:13 -0500 Subject: [PATCH 05/56] added emc2101 ideality defines --- components/asic/bm1368.c | 2 +- components/asic/bm1370.c | 5 ++-- main/EMC2101.h | 57 +++++++++++++++++++++++++++++++++++--- main/self_test/self_test.c | 2 +- 4 files changed, 57 insertions(+), 9 deletions(-) diff --git a/components/asic/bm1368.c b/components/asic/bm1368.c index 12ec8c4a5..802a70dfb 100644 --- a/components/asic/bm1368.c +++ b/components/asic/bm1368.c @@ -265,7 +265,7 @@ uint8_t BM1368_init(uint64_t frequency, uint16_t asic_count) {0x00, 0x3C, 0x80, 0x00, 0x8b, 0x00}, {0x00, 0x3C, 0x80, 0x00, 0x80, 0x18}, {0x00, 0x14, 0x00, 0x00, 0x00, 0xFF}, - {0x00, 0x54, 0x00, 0x00, 0x00, 0x03}, + {0x00, 0x54, 0x00, 0x00, 0x00, 0x03}, //Analog Mux {0x00, 0x58, 0x02, 0x11, 0x11, 0x11} }; diff --git a/components/asic/bm1370.c b/components/asic/bm1370.c index 8831cd797..d94563137 100644 --- a/components/asic/bm1370.c +++ b/components/asic/bm1370.c @@ -306,17 +306,16 @@ static uint8_t _send_init(uint64_t frequency, uint16_t asic_count) //Some misc settings? // TX: 55 AA 51 09 [00 B9 00 00 44 80] 0D //command all chips, write chip address 00, register B9, data 00 00 44 80 _send_BM1370((TYPE_CMD | GROUP_ALL | CMD_WRITE), (uint8_t[]){0x00, 0xB9, 0x00, 0x00, 0x44, 0x80}, 6, BM1370_SERIALTX_DEBUG); - // TX: 55 AA 51 09 [00 54 00 00 00 02] 18 //command all chips, write chip address 00, register 54, data 00 00 00 02 - Analog Mux Control - S21 does this earlier on + // TX: 55 AA 51 09 [00 54 00 00 00 02] 18 //command all chips, write chip address 00, register 54, data 00 00 00 02 - Analog Mux Control - rumored to control the temp diode _send_BM1370((TYPE_CMD | GROUP_ALL | CMD_WRITE), (uint8_t[]){0x00, 0x54, 0x00, 0x00, 0x00, 0x02}, 6, BM1370_SERIALTX_DEBUG); // TX: 55 AA 51 09 [00 B9 00 00 44 80] 0D //command all chips, write chip address 00, register B9, data 00 00 44 80 -- duplicate of first command in series _send_BM1370((TYPE_CMD | GROUP_ALL | CMD_WRITE), (uint8_t[]){0x00, 0xB9, 0x00, 0x00, 0x44, 0x80}, 6, BM1370_SERIALTX_DEBUG); // TX: 55 AA 51 09 [00 3C 80 00 8D EE] 1B //command all chips, write chip address 00, register 3C, data 80 00 8D EE _send_BM1370((TYPE_CMD | GROUP_ALL | CMD_WRITE), (uint8_t[]){0x00, 0x3C, 0x80, 0x00, 0x8D, 0xEE}, 6, BM1370_SERIALTX_DEBUG); + //ramp up the hash frequency do_frequency_ramp_up(frequency); - //BM1370_send_hash_frequency(frequency); - //register 10 is still a bit of a mystery. discussion: https://github.com/skot/ESP-Miner/pull/167 // unsigned char set_10_hash_counting[6] = {0x00, 0x10, 0x00, 0x00, 0x11, 0x5A}; //S19k Pro Default diff --git a/main/EMC2101.h b/main/EMC2101.h index 7931a1e22..2b470e702 100644 --- a/main/EMC2101.h +++ b/main/EMC2101.h @@ -28,10 +28,59 @@ #define EMC2101_DATARATE_16_HZ 0x08 //default #define EMC2101_DATARATE_32_HZ 0x09 -#define EMC2101_DEFAULT_IDEALITY 0x12 ///< Default ideality factor [1.008 -> 0x12] -#define EMC2101_DEFAULT_BETA EMC2101_BETA_AUTO ///< Default beta compensation -#define EMC2101_DEFAULT_FILTER EMC2101_FILTER_DISABLED ///< Default temp filter setting -#define EMC2101_DEFAULT_DATARATE EMC2101_DATARATE_16_HZ ///< Default temp conversion rate +#define EMC2101_IDEALITY_0_9949 0x08 +#define EMC2101_IDEALITY_0_9962 0x09 +#define EMC2101_IDEALITY_0_9975 0x0A +#define EMC2101_IDEALITY_0_9988 0x0B +#define EMC2101_IDEALITY_1_0001 0x0C +#define EMC2101_IDEALITY_1_0014 0x0D +#define EMC2101_IDEALITY_1_0027 0x0E +#define EMC2101_IDEALITY_1_0040 0x0F +#define EMC2101_IDEALITY_1_0053 0x10 +#define EMC2101_IDEALITY_1_0066 0x11 +#define EMC2101_IDEALITY_1_0080 0x12 //default +#define EMC2101_IDEALITY_1_0093 0x13 +#define EMC2101_IDEALITY_1_0106 0x14 +#define EMC2101_IDEALITY_1_0119 0x15 +#define EMC2101_IDEALITY_1_0133 0x16 +#define EMC2101_IDEALITY_1_0146 0x17 +#define EMC2101_IDEALITY_1_0159 0x18 +#define EMC2101_IDEALITY_1_0172 0x19 +#define EMC2101_IDEALITY_1_0185 0x1A +#define EMC2101_IDEALITY_1_0200 0x1B +#define EMC2101_IDEALITY_1_0212 0x1C +#define EMC2101_IDEALITY_1_0226 0x1D +#define EMC2101_IDEALITY_1_0239 0x1E +#define EMC2101_IDEALITY_1_0253 0x1F +#define EMC2101_IDEALITY_1_0267 0x20 +#define EMC2101_IDEALITY_1_0280 0x21 +#define EMC2101_IDEALITY_1_0293 0x22 +#define EMC2101_IDEALITY_1_0306 0x23 +#define EMC2101_IDEALITY_1_0319 0x24 +#define EMC2101_IDEALITY_1_0332 0x25 +#define EMC2101_IDEALITY_1_0345 0x26 +#define EMC2101_IDEALITY_1_0358 0x27 +#define EMC2101_IDEALITY_1_0371 0x28 +#define EMC2101_IDEALITY_1_0384 0x29 +#define EMC2101_IDEALITY_1_0397 0x2A +#define EMC2101_IDEALITY_1_0410 0x2B +#define EMC2101_IDEALITY_1_0423 0x2C +#define EMC2101_IDEALITY_1_0436 0x2D +#define EMC2101_IDEALITY_1_0449 0x2E +#define EMC2101_IDEALITY_1_0462 0x2F +#define EMC2101_IDEALITY_1_0475 0x30 +#define EMC2101_IDEALITY_1_0488 0x31 +#define EMC2101_IDEALITY_1_0501 0x32 +#define EMC2101_IDEALITY_1_0514 0x33 +#define EMC2101_IDEALITY_1_0527 0x34 +#define EMC2101_IDEALITY_1_0540 0x35 +#define EMC2101_IDEALITY_1_0553 0x36 +#define EMC2101_IDEALITY_1_0566 0x37 + +#define EMC2101_DEFAULT_IDEALITY EMC2101_IDEALITY_1_0306 ///< Default ideality factor +#define EMC2101_DEFAULT_BETA EMC2101_BETA_AUTO ///< 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 #define EMC2101_CHIP_ID 0x16 ///< EMC2101 default device id from part id diff --git a/main/self_test/self_test.c b/main/self_test/self_test.c index e575cc40e..1dd00e0ac 100644 --- a/main/self_test/self_test.c +++ b/main/self_test/self_test.c @@ -238,7 +238,7 @@ void self_test(void * pvParameters) // vTaskDelay(1000 / portTICK_PERIOD_MS); - // run_temp_cal(); + run_temp_cal(); int baud = (*GLOBAL_STATE->ASIC_functions.set_max_baud_fn)(); From 2550f766e2bfee761f5165f28a3cbcbe86b0014d Mon Sep 17 00:00:00 2001 From: Skot Date: Fri, 15 Nov 2024 17:18:28 -0500 Subject: [PATCH 06/56] set EMC2101 filter1, sample 32, max ideality. cleaned up serial packets in BM1370.c --- components/asic/bm1370.c | 31 ++++++++++++++----------------- main/EMC2101.h | 2 +- main/self_test/self_test.c | 23 +++++++++++------------ 3 files changed, 26 insertions(+), 30 deletions(-) diff --git a/components/asic/bm1370.c b/components/asic/bm1370.c index d94563137..05bc06788 100644 --- a/components/asic/bm1370.c +++ b/components/asic/bm1370.c @@ -238,14 +238,13 @@ static uint8_t _send_init(uint64_t frequency, uint16_t asic_count) BM1370_set_version_mask(STRATUM_DEFAULT_VERSION_MASK); //Reg_A8 - unsigned char init5[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0xA8, 0x00, 0x07, 0x00, 0x00, 0x03}; - _send_simple(init5, 11); + //unsigned char init5[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0xA8, 0x00, 0x07, 0x00, 0x00, 0x03}; + _send_BM1370((TYPE_CMD | GROUP_ALL | CMD_WRITE), (uint8_t[]){0x00, 0xA8, 0x00, 0x07, 0x00, 0x00}, 6, BM1370_SERIALTX_DEBUG); //Misc Control - //TX: 55 AA 51 09 00 18 F0 00 C1 00 04 //command all chips, write chip address 00, register 18, data F0 00 C1 00 - Misc Control - unsigned char init6[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x18, 0xF0, 0x00, 0xC1, 0x00, 0x04}; //from S21Pro dump - //unsigned char init6[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x18, 0xFF, 0x0F, 0xC1, 0x00, 0x00}; - _send_simple(init6, 11); + //TX: 55 AA 51 09 [00 18 F0 00 C1 00] 04 //command all chips, write chip address 00, register 18, data F0 00 C1 00 - Misc Control + _send_BM1370((TYPE_CMD | GROUP_ALL | CMD_WRITE), (uint8_t[]){0x00, 0x18, 0xF0, 0x00, 0xC1, 0x00}, 6, BM1370_SERIALTX_DEBUG); //from S21Pro dump + //_send_BM1370((TYPE_CMD | GROUP_ALL | CMD_WRITE), (uint8_t[]){0x00, 0x18, 0xFF, 0x0F, 0xC1, 0x00}, 6, BM1370_SERIALTX_DEBUG); //from S21 dump //chain inactive _send_chain_inactive(); @@ -261,18 +260,16 @@ static uint8_t _send_init(uint64_t frequency, uint16_t asic_count) } //Core Register Control - unsigned char init9[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x3C, 0x80, 0x00, 0x8B, 0x00, 0x12}; - _send_simple(init9, 11); + //unsigned char init9[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x3C, 0x80, 0x00, 0x8B, 0x00, 0x12}; + _send_BM1370((TYPE_CMD | GROUP_ALL | CMD_WRITE), (uint8_t[]){0x00, 0x3C, 0x80, 0x00, 0x8B, 0x00}, 6, BM1370_SERIALTX_DEBUG); //Core Register Control - //TX: 55 AA 51 09 00 3C 80 00 80 0C 11 //command all chips, write chip address 00, register 3C, data 80 00 80 0C - Core Register Control - unsigned char init10[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x3C, 0x80, 0x00, 0x80, 0x0C, 0x11}; //from S21Pro dump - //unsigned char init10[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x3C, 0x80, 0x00, 0x80, 0x18, 0x1F}; - _send_simple(init10, 11); + //TX: 55 AA 51 09 [00 3C 80 00 80 0C] 11 //command all chips, write chip address 00, register 3C, data 80 00 80 0C - Core Register Control + _send_BM1370((TYPE_CMD | GROUP_ALL | CMD_WRITE), (uint8_t[]){0x00, 0x3C, 0x80, 0x00, 0x80, 0x0C}, 6, BM1370_SERIALTX_DEBUG); //from S21Pro dump + //_send_BM1370((TYPE_CMD | GROUP_ALL | CMD_WRITE), (uint8_t[]){0x00, 0x3C, 0x80, 0x00, 0x80, 0x18}, 6, BM1370_SERIALTX_DEBUG); //from S21 dump //set ticket mask // unsigned char init11[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x14, 0x00, 0x00, 0x00, 0xFF, 0x08}; - // _send_simple(init11, 11); BM1370_set_job_difficulty_mask(BM1370_ASIC_DIFFICULTY); //Analog Mux Control -- not sent on S21 Pro? @@ -280,10 +277,10 @@ static uint8_t _send_init(uint64_t frequency, uint16_t asic_count) // _send_simple(init12, 11); //Set the IO Driver Strength on chip 00 - //TX: 55 AA 51 09 00 58 00 01 11 11 0D //command all chips, write chip address 00, register 58, data 01 11 11 11 - Set the IO Driver Strength on chip 00 - unsigned char init13[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x58, 0x00, 0x01, 0x11, 0x11, 0x0D}; //from S21Pro dump - //unsigned char init13[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x58, 0x02, 0x11, 0x11, 0x11, 0x06}; - _send_simple(init13, 11); + //TX: 55 AA 51 09 [00 58 00 01 11 11] 0D //command all chips, write chip address 00, register 58, data 01 11 11 11 - Set the IO Driver Strength on chip 00 + _send_BM1370((TYPE_CMD | GROUP_ALL | CMD_WRITE), (uint8_t[]){0x00, 0x58, 0x00, 0x01, 0x11, 0x11}, 6, BM1370_SERIALTX_DEBUG); //from S21Pro dump + //_send_BM1370((TYPE_CMD | GROUP_ALL | CMD_WRITE), (uint8_t[]){0x00, 0x58, 0x02, 0x11, 0x11, 0x11}, 6, BM1370_SERIALTX_DEBUG); //from S21Pro dump + for (uint8_t i = 0; i < chip_counter; i++) { //TX: 55 AA 41 09 00 [A8 00 07 01 F0] 15 // Reg_A8 diff --git a/main/EMC2101.h b/main/EMC2101.h index 2b470e702..cef6718ff 100644 --- a/main/EMC2101.h +++ b/main/EMC2101.h @@ -77,7 +77,7 @@ #define EMC2101_IDEALITY_1_0553 0x36 #define EMC2101_IDEALITY_1_0566 0x37 -#define EMC2101_DEFAULT_IDEALITY EMC2101_IDEALITY_1_0306 ///< Default ideality factor +#define EMC2101_DEFAULT_IDEALITY EMC2101_IDEALITY_1_0566 ///< Default ideality factor #define EMC2101_DEFAULT_BETA EMC2101_BETA_AUTO ///< 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 diff --git a/main/self_test/self_test.c b/main/self_test/self_test.c index 1dd00e0ac..68bf2facf 100644 --- a/main/self_test/self_test.c +++ b/main/self_test/self_test.c @@ -232,13 +232,12 @@ void self_test(void * pvParameters) 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(); + // run_temp_cal(); int baud = (*GLOBAL_STATE->ASIC_functions.set_max_baud_fn)(); @@ -389,14 +388,14 @@ void self_test(void * pvParameters) } } -static void run_temp_cal(void) { - float external = 0, internal = 0; +// 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); - } +// 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); +// } -} +// } From 4973542a6a07267f938c8b35fe77d3aa3a5f6362 Mon Sep 17 00:00:00 2001 From: Skot Date: Fri, 15 Nov 2024 17:30:04 -0500 Subject: [PATCH 07/56] changed to Ben's Beta and Ideality values --- main/EMC2101.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main/EMC2101.h b/main/EMC2101.h index cef6718ff..f5dc94741 100644 --- a/main/EMC2101.h +++ b/main/EMC2101.h @@ -77,8 +77,8 @@ #define EMC2101_IDEALITY_1_0553 0x36 #define EMC2101_IDEALITY_1_0566 0x37 -#define EMC2101_DEFAULT_IDEALITY EMC2101_IDEALITY_1_0566 ///< Default ideality factor -#define EMC2101_DEFAULT_BETA EMC2101_BETA_AUTO ///< Default beta compensation +#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_DATARATE EMC2101_DATARATE_32_HZ ///< Default temp conversion rate From 0271220979c6e20e09714380235f9adb5fa492d3 Mon Sep 17 00:00:00 2001 From: Skot Date: Fri, 15 Nov 2024 21:06:34 -0500 Subject: [PATCH 08/56] cleanup self_test.c --- main/EMC2101.h | 4 ++-- main/self_test/self_test.c | 43 ++++++++++++++++++-------------------- 2 files changed, 22 insertions(+), 25 deletions(-) diff --git a/main/EMC2101.h b/main/EMC2101.h index f5dc94741..305255561 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 68bf2facf..e2ac62c6b 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); -// } - -// } From 6c6bf239a2cf62bdc18b7f3884eafb88b1240f26 Mon Sep 17 00:00:00 2001 From: Erik Olof Gunnar Andersson Date: Sat, 12 Oct 2024 00:58:05 +0200 Subject: [PATCH 09/56] Prevent automatic builds from going live accidently --- .github/workflows/release-factory.yml | 1 + .github/workflows/release.yml | 2 ++ 2 files changed, 3 insertions(+) diff --git a/.github/workflows/release-factory.yml b/.github/workflows/release-factory.yml index f505b5845..d3e26f729 100644 --- a/.github/workflows/release-factory.yml +++ b/.github/workflows/release-factory.yml @@ -51,4 +51,5 @@ jobs: uses: softprops/action-gh-release@v2 if: startsWith(github.ref, 'refs/tags/') with: + prerelease: true files: "esp-miner-factory-${{ matrix.build_type }}-${{ github.ref_name }}.bin" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1a2c5159f..255147d25 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -53,9 +53,11 @@ jobs: uses: softprops/action-gh-release@v2 if: startsWith(github.ref, 'refs/tags/') with: + prerelease: true files: ./build/www.bin - name: Release esp-miner.bin uses: softprops/action-gh-release@v2 if: startsWith(github.ref, 'refs/tags/') with: + prerelease: true files: ./build/esp-miner.bin From c8d020f56e22c399db6af2f56dec2eb9b1ee20a0 Mon Sep 17 00:00:00 2001 From: Erik Olof Gunnar Andersson Date: Sat, 12 Oct 2024 17:09:43 +0200 Subject: [PATCH 10/56] Only publish when releasing --- .github/workflows/release-factory.yml | 9 ++++----- .github/workflows/release.yml | 11 +++++------ 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/.github/workflows/release-factory.yml b/.github/workflows/release-factory.yml index d3e26f729..39c283786 100644 --- a/.github/workflows/release-factory.yml +++ b/.github/workflows/release-factory.yml @@ -1,8 +1,8 @@ -name: Build & Release Factory Images +name: Build & Release Factory Images [Release] + on: - push: - tags: - - '*' + release: + types: [released] jobs: build: @@ -51,5 +51,4 @@ jobs: uses: softprops/action-gh-release@v2 if: startsWith(github.ref, 'refs/tags/') with: - prerelease: true files: "esp-miner-factory-${{ matrix.build_type }}-${{ github.ref_name }}.bin" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 255147d25..54ccff428 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,8 +1,9 @@ -name: Build & Release Firmware +name: Build & Release Firmware [Release] + on: - push: - tags: - - '*' + release: + types: [released] + jobs: build: runs-on: ubuntu-latest @@ -53,11 +54,9 @@ jobs: uses: softprops/action-gh-release@v2 if: startsWith(github.ref, 'refs/tags/') with: - prerelease: true files: ./build/www.bin - name: Release esp-miner.bin uses: softprops/action-gh-release@v2 if: startsWith(github.ref, 'refs/tags/') with: - prerelease: true files: ./build/esp-miner.bin From baa8f89d7287430ea2ce68fabe0c8ff8caa3500e Mon Sep 17 00:00:00 2001 From: Erik Olof Gunnar Andersson Date: Sat, 12 Oct 2024 17:10:26 +0200 Subject: [PATCH 11/56] Only publish when releasing --- .github/workflows/release-beta.yml | 64 ++++++++++++++++++++++ .github/workflows/release-factory-beta.yml | 55 +++++++++++++++++++ 2 files changed, 119 insertions(+) create mode 100644 .github/workflows/release-beta.yml create mode 100644 .github/workflows/release-factory-beta.yml diff --git a/.github/workflows/release-beta.yml b/.github/workflows/release-beta.yml new file mode 100644 index 000000000..b4488eacd --- /dev/null +++ b/.github/workflows/release-beta.yml @@ -0,0 +1,64 @@ +name: Build & Release Firmware [Pre-Release] + +on: + release: + types: [released] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout repo + uses: actions/checkout@v4 + with: + submodules: 'recursive' + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '22' + - name: Build web dist + working-directory: ./main/http_server/axe-os + run: | + npm ci + npm run build + - name: esp-idf build + uses: espressif/esp-idf-ci-action@v1 + with: + esp_idf_version: v5.3.1 + target: esp32s3 + command: GITHUB_ACTIONS="true" idf.py build + path: '.' + - uses: actions/setup-python@v5 + with: + python-version: '3.10' + cache: 'pip' + - run: pip install esptool + - name: "Create factory/merged image" + run: "./merge_bin.sh ./esp-miner-merged.bin" + - name: upload esp-miner-merged.bin + uses: actions/upload-artifact@v3 + with: + name: esp-miner-factory.bin + path: ./esp-miner-merged.bin + - name: upload esp-miner.bin + uses: actions/upload-artifact@v3 + with: + name: esp-miner.bin + path: ./build/esp-miner.bin + - name: upload www.bin + uses: actions/upload-artifact@v3 + with: + name: www.bin + path: ./build/www.bin + - name: Release www.bin + uses: softprops/action-gh-release@v2 + if: startsWith(github.ref, 'refs/tags/') + with: + prerelease: true + files: ./build/www.bin + - name: Release esp-miner.bin + uses: softprops/action-gh-release@v2 + if: startsWith(github.ref, 'refs/tags/') + with: + prerelease: true + files: ./build/esp-miner.bin diff --git a/.github/workflows/release-factory-beta.yml b/.github/workflows/release-factory-beta.yml new file mode 100644 index 000000000..19c4f4f5f --- /dev/null +++ b/.github/workflows/release-factory-beta.yml @@ -0,0 +1,55 @@ +name: Build & Release Factory Images [Pre-Release] + +on: + release: + types: [released] + +jobs: + build: + runs-on: ubuntu-latest + name: "Factory ${{ matrix.build_type }}" + strategy: + fail-fast: false + matrix: + build_type: ["102", "202", "204", "401", "402", "403", "601"] + steps: + - name: Checkout repo + uses: actions/checkout@v4 + with: + submodules: 'recursive' + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '22' + - name: Build web dist + working-directory: ./main/http_server/axe-os + run: | + npm ci + npm run build + - name: esp-idf build + uses: espressif/esp-idf-ci-action@v1 + with: + esp_idf_version: v5.3.1 + target: esp32s3 + command: GITHUB_ACTIONS="true" idf.py build + path: '.' + - name: "esp-idf build factory config for ${{ matrix.build_type }}" + uses: espressif/esp-idf-ci-action@v1 + with: + esp_idf_version: v5.3.1 + target: esp32s3 + command: /opt/esp/idf/components/nvs_flash/nvs_partition_generator/nvs_partition_gen.py generate config-${{ matrix.build_type }}.cvs config.bin 0x6000 + path: '.' + - uses: actions/setup-python@v5 + with: + python-version: '3.10' + cache: 'pip' + - run: pip install esptool + - name: "Create factory image for ${{ matrix.build_type }}-${{ github.ref_name }}" + run: "./merge_bin.sh -c esp-miner-factory-${{ matrix.build_type }}-${{ github.ref_name }}.bin" + - name: Release esp-miner.bin + uses: softprops/action-gh-release@v2 + if: startsWith(github.ref, 'refs/tags/') + with: + prerelease: true + files: "esp-miner-factory-${{ matrix.build_type }}-${{ github.ref_name }}.bin" From 5f235a77ca0bd44f0d7b8bdf27127ac5127e9cb1 Mon Sep 17 00:00:00 2001 From: Erik Olof Gunnar Andersson Date: Sat, 12 Oct 2024 17:11:25 +0200 Subject: [PATCH 12/56] Only publish when releasing --- .github/workflows/release-beta.yml | 2 +- .github/workflows/release-factory-beta.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release-beta.yml b/.github/workflows/release-beta.yml index b4488eacd..7838b32e8 100644 --- a/.github/workflows/release-beta.yml +++ b/.github/workflows/release-beta.yml @@ -2,7 +2,7 @@ name: Build & Release Firmware [Pre-Release] on: release: - types: [released] + types: [prereleased] jobs: build: diff --git a/.github/workflows/release-factory-beta.yml b/.github/workflows/release-factory-beta.yml index 19c4f4f5f..fe082e377 100644 --- a/.github/workflows/release-factory-beta.yml +++ b/.github/workflows/release-factory-beta.yml @@ -2,7 +2,7 @@ name: Build & Release Factory Images [Pre-Release] on: release: - types: [released] + types: [prereleased] jobs: build: From 9ec4531134bb0dbba2efb420af856d86b07ebea5 Mon Sep 17 00:00:00 2001 From: Erik Olof Gunnar Andersson Date: Thu, 24 Oct 2024 21:31:30 +0200 Subject: [PATCH 13/56] Use the same release for github and vscode --- .devcontainer/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 74b285c6b..c65f6a163 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,4 +1,4 @@ -FROM espressif/idf +FROM espressif/idf:v5.3.1 ARG DEBIAN_FRONTEND=nointeractive From 44c15b5fb4ff358e16d86aab29608ab2d213c793 Mon Sep 17 00:00:00 2001 From: mutatrum Date: Thu, 17 Oct 2024 15:14:05 +0200 Subject: [PATCH 14/56] Add OLED Bitaxe logo screen --- main/oled.c | 22 +++++++++++++++++++--- main/oled.h | 1 + main/system.c | 38 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 58 insertions(+), 3 deletions(-) diff --git a/main/oled.c b/main/oled.c index 2770d6fdf..801abda9f 100644 --- a/main/oled.c +++ b/main/oled.c @@ -172,13 +172,13 @@ static void oledSetPosition(int x, int y) } write_command(0xb0 | y); // go to page Y - write_command(0x00 | (x & 0xf)); // // lower col addr - write_command(0x10 | ((x >> 4) & 0xf)); // upper col addr + write_command(0x00 | (x & 0x0f)); // lower col addr + write_command(0x10 | ((x >> 4) & 0x0f));// upper col addr } // Write a block of pixel data to the OLED // Length can be anything from 1 to 1024 (whole display) -static void oledWriteDataBlock(uint8_t * ucBuf, int iLen) +static void oledWriteDataBlock(const uint8_t * ucBuf, int iLen) { uint8_t ucTemp[129]; @@ -217,6 +217,22 @@ int OLED_setPixel(int x, int y, uint8_t ucColor) return 0; } +// Write a bitmap to the screen +// The X position is in character widths (8 or 16) +// The Y position is in memory pages (8 lines each) +// Bitmap should be aligned vertical, 1 bit per pixel +// Width and Height must be per 8 pixels +// Conversion tool: https://javl.github.io/image2cpp/ +int OLED_showBitmap(int x, int y, const uint8_t *bitmap, int width, int height) +{ + for (int row = 0; row < (height >> 3); row++) { + oledSetPosition(x, y + row); + oledWriteDataBlock(&bitmap[row * width], width); + } + + return 0; +} + // // Draw a string of small (8x8), large (16x24), or very small (6x8) characters // At the given col+row diff --git a/main/oled.h b/main/oled.h index 538a14735..ba3d82c24 100644 --- a/main/oled.h +++ b/main/oled.h @@ -42,6 +42,7 @@ int OLED_writeString(int x, int y, const char *szText); // Sets a pixel to On (1) or Off (0) // Coordinate system is pixels, not text rows (0-127, 0-63) int OLED_setPixel(int x, int y, uint8_t ucPixel); +int OLED_showBitmap(int x, int y, const uint8_t *bitmap, int width, int height); // Sets the contrast (brightness) level of the display // Valid values are 0-255 where 0=off and 255=max brightness diff --git a/main/system.c b/main/system.c index 8fd87b69d..2fc7fb9f5 100644 --- a/main/system.c +++ b/main/system.c @@ -160,6 +160,41 @@ void SYSTEM_init_peripherals(GlobalState * GLOBAL_STATE) { _init_connection(GLOBAL_STATE); } +static const uint8_t bitaxe_splash[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x20, 0x10, 0x18, 0x3c, + 0x7e, 0xfc, 0xf8, 0xf0, 0x38, 0x3c, 0x3c, 0x7c, 0xf8, 0xf8, 0xf8, 0x30, 0x10, 0x08, 0x00, 0x08, + 0x9c, 0x3e, 0x1c, 0x08, 0x00, 0x00, 0x80, 0x80, 0xc0, 0xe0, 0xf0, 0x80, 0x80, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x10, 0x20, 0x20, 0x10, 0x08, + 0x00, 0xff, 0xff, 0xff, 0x80, 0xe0, 0xf0, 0xe0, 0xff, 0xff, 0xdf, 0xc0, 0x60, 0x00, 0x06, 0xff, + 0xff, 0xff, 0xfe, 0x02, 0x00, 0x01, 0x01, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x18, 0x18, + 0x3c, 0xfe, 0x87, 0x07, 0x0f, 0xff, 0xff, 0xfe, 0xfe, 0x06, 0x00, 0x04, 0xff, 0xff, 0xff, 0xfe, + 0x82, 0x00, 0x04, 0xff, 0xff, 0xff, 0xfe, 0x02, 0x00, 0x00, 0xf8, 0xfc, 0xfc, 0xfe, 0x07, 0x07, + 0x8f, 0xff, 0x7f, 0x3e, 0x1e, 0x12, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, + 0x82, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x01, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x02, 0xff, + 0xff, 0xff, 0xff, 0x02, 0x00, 0x00, 0x02, 0xff, 0xff, 0xff, 0xff, 0x02, 0x00, 0x00, 0xf0, 0xf0, + 0xf8, 0xf8, 0x0c, 0x06, 0x02, 0xff, 0xff, 0xff, 0xff, 0x02, 0x00, 0x04, 0xf3, 0xf7, 0xff, 0xff, + 0x0f, 0x0f, 0x1f, 0xff, 0xff, 0xfe, 0xfc, 0x02, 0x00, 0x02, 0xff, 0xff, 0xff, 0xff, 0x02, 0x03, + 0x01, 0x80, 0x80, 0xc0, 0xe0, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x46, 0x47, 0x03, 0x03, 0x07, + 0x07, 0x0f, 0x0f, 0x1f, 0x1e, 0x3e, 0x1c, 0x0c, 0x07, 0x03, 0x03, 0x03, 0x00, 0x00, 0x00, 0x0f, + 0x1f, 0x3f, 0x1f, 0x0c, 0x04, 0x00, 0x00, 0x0f, 0x1f, 0x3f, 0x1f, 0x0c, 0x04, 0x10, 0x0f, 0x0f, + 0x1f, 0x1f, 0x1e, 0x1e, 0x1c, 0x0f, 0x1f, 0x1f, 0x1f, 0x04, 0x00, 0x00, 0x0f, 0x1f, 0x1f, 0x0f, + 0x04, 0x00, 0x00, 0x0f, 0x1f, 0x1f, 0x0f, 0x04, 0x00, 0x10, 0x0f, 0x0f, 0x1f, 0x1f, 0x1e, 0x1e, + 0x1c, 0x0f, 0x07, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +}; + void SYSTEM_task(void * pvParameters) { GlobalState * GLOBAL_STATE = (GlobalState *) pvParameters; @@ -181,6 +216,9 @@ void SYSTEM_task(void * pvParameters) vTaskDelay(1000 / portTICK_PERIOD_MS); } + OLED_showBitmap(0, 0, bitaxe_splash, 128, 32); + vTaskDelay(5000 / portTICK_PERIOD_MS); + int current_screen = 0; TickType_t last_update_time = xTaskGetTickCount(); From b02062e3929091c78a9a4f99702ffab2cf917ae1 Mon Sep 17 00:00:00 2001 From: WantClue Date: Wed, 30 Oct 2024 15:24:07 +0100 Subject: [PATCH 15/56] add all in one factory file script --- merge_bin_all.sh | 92 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 merge_bin_all.sh diff --git a/merge_bin_all.sh b/merge_bin_all.sh new file mode 100644 index 000000000..067ed28d1 --- /dev/null +++ b/merge_bin_all.sh @@ -0,0 +1,92 @@ +#!/bin/bash + +# Binary file paths and addresses +BOOTLOADER_BIN="build/bootloader/bootloader.bin" +BOOTLOADER_BIN_ADDR=0x0 +PARTITION_TABLE="build/partition_table/partition-table.bin" +PARTITION_TABLE_ADDR=0x8000 +CONFIG_BIN_ADDR=0x9000 +MINER_BIN="build/esp-miner.bin" +MINER_BIN_ADDR=0x10000 +WWW_BIN="build/www.bin" +WWW_BIN_ADDR=0x410000 +OTA_BIN="build/ota_data_initial.bin" +OTA_BIN_ADDR=0xf10000 + +BINS_DEFAULT=($BOOTLOADER_BIN $PARTITION_TABLE $MINER_BIN $WWW_BIN $OTA_BIN) +BINS_AND_ADDRS_DEFAULT=($BOOTLOADER_BIN_ADDR $BOOTLOADER_BIN $PARTITION_TABLE_ADDR $PARTITION_TABLE $MINER_BIN_ADDR $MINER_BIN $WWW_BIN_ADDR $WWW_BIN $OTA_BIN_ADDR $OTA_BIN) + +function show_help() { + echo "Creates combined binaries using esptool's merge_bin command for multiple config files" + echo "Usage: $0 [OPTION]" + echo " Options:" + echo " -c: Process all config-*.bin files in the current directory" + echo " -h: Show this help message" + echo +} + +function print_with_error_header() { + echo "ERROR:" $1 +} + +#### MAIN #### + +# Check if esptool.py is installed and accessible +if ! command -v esptool.py &> /dev/null; then + echo "esptool.py is not installed or not in PATH. Please install it first." + echo "pip install esptool" + exit 1 +fi + +OPTIND=1 # Reset in case getops has been used previously + +# default values +process_configs=0 + +while getopts "hc" opt; do + case "$opt" in + h) + show_help + exit 0 + ;; + c) process_configs=1 + ;; + *) + show_help + exit 1 + esac +done + +shift $((OPTIND-1)) + +if [ "$process_configs" -eq 0 ]; then + print_with_error_header "No option specified. Use -c to process config files." + show_help + exit 2 +fi + +# Process all config-*.bin files +for config_file in config-*.bin; do + if [ -f "$config_file" ]; then + # Extract the number from the config filename + config_number=$(echo $config_file | sed 's/config-\(.*\)\.bin/\1/') + + # Create the output filename + output_file="esp-miner-factory-$config_number.bin" + + # Prepare the bins and addresses array with the current config file + BINS_AND_ADDRS_WITH_CONFIG=(${BINS_AND_ADDRS_DEFAULT[@]} $CONFIG_BIN_ADDR $config_file) + + # Call esptool.py with the specified arguments + esptool.py --chip esp32s3 merge_bin --flash_mode dio --flash_size 16MB --flash_freq 80m "${BINS_AND_ADDRS_WITH_CONFIG[@]}" -o "$output_file" + + # Check if esptool.py command was successful + if [ $? -eq 0 ]; then + echo "Successfully created $output_file" + else + print_with_error_header "Failed to create $output_file" + fi + fi +done + +echo "Processing complete." \ No newline at end of file From 9367644883a78e71d67c1ad2bd34366d92a8a98b Mon Sep 17 00:00:00 2001 From: Benjamin Wilson Date: Wed, 30 Oct 2024 11:01:08 -0400 Subject: [PATCH 16/56] Chart enhance (#433) Enhance the home chart with temperature display and line fills --- .../src/app/components/home/home.component.ts | 62 ++++++++++++++----- 1 file changed, 48 insertions(+), 14 deletions(-) diff --git a/main/http_server/axe-os/src/app/components/home/home.component.ts b/main/http_server/axe-os/src/app/components/home/home.component.ts index 5db7d65de..52d4781ca 100644 --- a/main/http_server/axe-os/src/app/components/home/home.component.ts +++ b/main/http_server/axe-os/src/app/components/home/home.component.ts @@ -21,7 +21,8 @@ export class HomeComponent { public chartOptions: any; public dataLabel: number[] = []; - public dataData: number[] = []; + public hashrateData: number[] = []; + public temperatureData: number[] = []; public dataDataAverage: number[] = []; public chartData?: any; @@ -39,6 +40,8 @@ export class HomeComponent { const surfaceBorder = documentStyle.getPropertyValue('--surface-border'); const primaryColor = documentStyle.getPropertyValue('--primary-color'); + console.log(primaryColor) + this.chartData = { labels: [], datasets: [ @@ -46,25 +49,40 @@ export class HomeComponent { type: 'line', label: 'Hashrate', data: [], - fill: false, - backgroundColor: primaryColor, + backgroundColor: primaryColor + '30', borderColor: primaryColor, tension: 0, pointRadius: 2, pointHoverRadius: 5, - borderWidth: 1 + borderWidth: 1, + yAxisID: 'y', + fill: true, }, { type: 'line', label: 'Average Hashrate', data: [], fill: false, - backgroundColor: textColorSecondary, - borderColor: textColorSecondary, + backgroundColor: primaryColor + '30', + borderColor: primaryColor + '30', tension: 0, pointRadius: 0, borderWidth: 2, - borderDash: [5, 5] + borderDash: [5, 5], + yAxisID: 'y', + }, + { + type: 'line', + label: 'ASIC Temp', + data: [], + fill: false, + backgroundColor: textColorSecondary, + borderColor: textColorSecondary, + tension: 0, + pointRadius: 2, + pointHoverRadius: 5, + borderWidth: 1, + yAxisID: 'y2', } ] }; @@ -80,7 +98,7 @@ export class HomeComponent { }, tooltip: { callbacks: { - label: function(tooltipItem: any) { + label: function (tooltipItem: any) { let label = tooltipItem.dataset.label || ''; if (label) { label += ': '; @@ -115,6 +133,19 @@ export class HomeComponent { color: surfaceBorder, drawBorder: false } + }, + y2: { + type: 'linear', + display: true, + position: 'right', + ticks: { + color: textColorSecondary + }, + grid: { + drawOnChartArea: false, + color: surfaceBorder + }, + suggestedMax: 80 } } }; @@ -126,20 +157,23 @@ export class HomeComponent { return this.systemService.getInfo() }), tap(info => { - this.dataData.push(info.hashRate * 1000000000); + this.hashrateData.push(info.hashRate * 1000000000); + this.temperatureData.push(info.temp); + this.dataLabel.push(new Date().getTime()); - if (this.dataData.length >= 720) { - this.dataData.shift(); + if (this.hashrateData.length >= 720) { + this.hashrateData.shift(); this.dataLabel.shift(); } this.chartData.labels = this.dataLabel; - this.chartData.datasets[0].data = this.dataData; + this.chartData.datasets[0].data = this.hashrateData; + this.chartData.datasets[2].data = this.temperatureData; // Calculate average hashrate and fill the array with the same value for the average line - const averageHashrate = this.calculateAverage(this.dataData); - this.chartData.datasets[1].data = Array(this.dataData.length).fill(averageHashrate); + const averageHashrate = this.calculateAverage(this.hashrateData); + this.chartData.datasets[1].data = Array(this.hashrateData.length).fill(averageHashrate); this.chartData = { ...this.chartData From 674ea0ce0a44bcc71c7bca69354458a2ea8a320d Mon Sep 17 00:00:00 2001 From: Benjamin Wilson Date: Fri, 1 Nov 2024 17:31:54 -0400 Subject: [PATCH 17/56] Redo swarm (#430) * Redo swarm Redo swarm to use network scanning and local storage rather than storing the set of IP's on device. * auto refresh --------- Co-authored-by: Benjamin Wilson --- .../app/components/swarm/swarm.component.html | 28 +-- .../app/components/swarm/swarm.component.ts | 204 +++++++++++------- .../src/app/local-storage.service.spec.ts | 16 ++ .../axe-os/src/app/local-storage.service.ts | 37 ++++ main/http_server/http_server.c | 54 ----- 5 files changed, 188 insertions(+), 151 deletions(-) create mode 100644 main/http_server/axe-os/src/app/local-storage.service.spec.ts create mode 100644 main/http_server/axe-os/src/app/local-storage.service.ts diff --git a/main/http_server/axe-os/src/app/components/swarm/swarm.component.html b/main/http_server/axe-os/src/app/components/swarm/swarm.component.html index e8973c217..8340595b0 100644 --- a/main/http_server/axe-os/src/app/components/swarm/swarm.component.html +++ b/main/http_server/axe-os/src/app/components/swarm/swarm.component.html @@ -1,11 +1,12 @@
+
- -
+ +
- - + +
@@ -13,11 +14,10 @@
+ +
- -
-
- +
@@ -31,9 +31,9 @@ - - - + + + @@ -41,7 +41,7 @@ - + @@ -52,6 +52,6 @@ \ No newline at end of file diff --git a/main/http_server/axe-os/src/app/components/swarm/swarm.component.ts b/main/http_server/axe-os/src/app/components/swarm/swarm.component.ts index ea51f16e1..5df3254e0 100644 --- a/main/http_server/axe-os/src/app/components/swarm/swarm.component.ts +++ b/main/http_server/axe-os/src/app/components/swarm/swarm.component.ts @@ -1,99 +1,129 @@ -import { Component } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; +import { Component, OnDestroy, OnInit } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; import { ToastrService } from 'ngx-toastr'; -import { BehaviorSubject, catchError, combineLatest, forkJoin, map, Observable, of, startWith, switchMap } from 'rxjs'; +import { BehaviorSubject, catchError, combineLatest, debounce, debounceTime, forkJoin, from, interval, map, mergeAll, mergeMap, Observable, of, startWith, switchMap, take, timeout, toArray } from 'rxjs'; +import { LocalStorageService } from 'src/app/local-storage.service'; import { SystemService } from 'src/app/services/system.service'; - +const REFRESH_TIME_SECONDS = 30; +const SWARM_DATA = 'SWARM_DATA' @Component({ selector: 'app-swarm', templateUrl: './swarm.component.html', styleUrls: ['./swarm.component.scss'] }) -export class SwarmComponent { - - public form: FormGroup; - - public swarm$: Observable[]>; +export class SwarmComponent implements OnInit, OnDestroy { - public refresh$: BehaviorSubject = new BehaviorSubject(null); + public swarm: any[] = []; public selectedAxeOs: any = null; public showEdit = false; + public form: FormGroup; + + public scanning = false; + + public refreshIntervalRef!: number; + public refreshIntervalTime = REFRESH_TIME_SECONDS; + constructor( private fb: FormBuilder, private systemService: SystemService, - private toastr: ToastrService + private toastr: ToastrService, + private localStorageService: LocalStorageService, + private httpClient: HttpClient ) { - this.form = this.fb.group({ - ip: [null, [Validators.required, Validators.pattern('(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)')]] - }); - - this.swarm$ = this.systemService.getSwarmInfo().pipe( - map(swarmInfo => { - return swarmInfo.map(({ ip }) => { - // Make individual API calls for each IP - return this.refresh$.pipe( - switchMap(() => { - return this.systemService.getInfo(`http://${ip}`); - }) - ).pipe( - startWith({ ip }), - map(info => { - return { - ip, - ...info - }; - }), - catchError(error => { - return of({ ip, error: true }); - }) - ); - }); - }) - ); + this.form = this.fb.group({ + manualAddIp: [null, [Validators.required, Validators.pattern('(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)')]] + }) } + ngOnInit(): void { + const swarmData = this.localStorageService.getObject(SWARM_DATA); + console.log(swarmData); + if (swarmData == null) { + this.scanNetwork(); + //this.swarm$ = this.scanNetwork('192.168.1.23', '255.255.255.0').pipe(take(1)); + } else { + this.swarm = swarmData; + } + + this.refreshIntervalRef = window.setInterval(() => { + this.refreshIntervalTime --; + if(this.refreshIntervalTime <= 0){ + this.refreshIntervalTime = REFRESH_TIME_SECONDS; + this.refreshList(); + } + }, 1000); + } - public add() { - const newIp = this.form.value.ip; - - combineLatest([this.systemService.getSwarmInfo('http://' + newIp), this.systemService.getSwarmInfo()]).pipe( - switchMap(([newSwarmInfo, existingSwarmInfo]) => { + ngOnDestroy(): void { + window.clearInterval(this.refreshIntervalRef); + } - if (existingSwarmInfo.length < 1) { - existingSwarmInfo.push({ ip: window.location.host }); - } - const swarmUpdate = existingSwarmInfo.map(({ ip }) => { - return this.systemService.updateSwarm('http://' + ip, [{ ip: newIp }, ...newSwarmInfo, ...existingSwarmInfo]) - }); + private ipToInt(ip: string): number { + return ip.split('.').reduce((acc, octet) => (acc << 8) + parseInt(octet, 10), 0) >>> 0; + } - const newAxeOs = this.systemService.updateSwarm('http://' + newIp, [{ ip: newIp }, ...existingSwarmInfo]) + private intToIp(int: number): string { + return `${(int >>> 24) & 255}.${(int >>> 16) & 255}.${(int >>> 8) & 255}.${int & 255}`; + } - return forkJoin([newAxeOs, ...swarmUpdate]); + private calculateIpRange(ip: string, netmask: string): { start: number, end: number } { + const ipInt = this.ipToInt(ip); + const netmaskInt = this.ipToInt(netmask); + const network = ipInt & netmaskInt; + const broadcast = network | ~netmaskInt; + return { start: network + 1, end: broadcast - 1 }; + } - }) - ).subscribe({ - next: () => { - this.toastr.success('Success!', 'Saved.'); - window.location.reload(); - }, - error: (err) => { - this.toastr.error('Error.', `Could not save. ${err.message}`); + scanNetwork() { + this.scanning = true; + + const { start, end } = this.calculateIpRange(window.location.hostname, '255.255.255.0'); + const ips = Array.from({ length: end - start + 1 }, (_, i) => this.intToIp(start + i)); + from(ips).pipe( + mergeMap(ipAddr => + this.httpClient.get(`http://${ipAddr}/api/system/info`).pipe( + map(result => { + return { + IP: ipAddr, + ...result + } + }), + timeout(5000), // Set the timeout to 1 second + catchError(error => { + //console.error(`Request to ${ipAddr}/api/system/info failed or timed out`, error); + return []; // Return an empty result or handle as desired + }) + ), + 256 // Limit concurrency to avoid overload + ), + toArray() // Collect all results into a single array + ).pipe(take(1)).subscribe({ + next: (result) => { + this.swarm = result; + this.localStorageService.setObject(SWARM_DATA, this.swarm); }, complete: () => { - this.form.reset(); + this.scanning = false; } }); - } - public refresh() { - this.refresh$.next(null); + public add() { + const newIp = this.form.value.manualAddIp; + + this.systemService.getInfo(`http://${newIp}`).subscribe((res) => { + if (res.ASICModel) { + this.swarm.push({ IP: newIp, ...res }); + this.localStorageService.setObject(SWARM_DATA, this.swarm); + } + }); } public edit(axe: any) { @@ -102,38 +132,46 @@ export class SwarmComponent { } public restart(axe: any) { - this.systemService.restart(`http://${axe.ip}`).subscribe(res => { + this.systemService.restart(`http://${axe.IP}`).subscribe(res => { }); this.toastr.success('Success!', 'Bitaxe restarted'); } public remove(axeOs: any) { - this.systemService.getSwarmInfo().pipe( - switchMap((swarmInfo) => { - - const newSwarm = swarmInfo.filter((s: any) => s.ip != axeOs.ip); - - const swarmUpdate = newSwarm.map(({ ip }) => { - return this.systemService.updateSwarm('http://' + ip, newSwarm) - }); - - const removedAxeOs = this.systemService.updateSwarm('http://' + axeOs.ip, []); + this.swarm = this.swarm.filter(axe => axe.IP != axeOs.IP); + this.localStorageService.setObject(SWARM_DATA, this.swarm); + } - return forkJoin([removedAxeOs, ...swarmUpdate]); - }) - ).subscribe({ - next: () => { - this.toastr.success('Success!', 'Saved.'); - window.location.reload(); - }, - error: (err) => { - this.toastr.error('Error.', `Could not save. ${err.message}`); + public refreshList() { + const ips = this.swarm.map(axeOs => axeOs.IP); + + from(ips).pipe( + mergeMap(ipAddr => + this.httpClient.get(`http://${ipAddr}/api/system/info`).pipe( + map(result => { + return { + IP: ipAddr, + ...result + } + }), + timeout(5000), + catchError(error => { + return of(this.swarm.find(axeOs => axeOs.IP == ipAddr)); + }) + ), + 256 // Limit concurrency to avoid overload + ), + toArray() // Collect all results into a single array + ).pipe(take(1)).subscribe({ + next: (result) => { + this.swarm = result; + this.localStorageService.setObject(SWARM_DATA, this.swarm); }, complete: () => { - this.form.reset(); } }); + } } diff --git a/main/http_server/axe-os/src/app/local-storage.service.spec.ts b/main/http_server/axe-os/src/app/local-storage.service.spec.ts new file mode 100644 index 000000000..ba1dbd436 --- /dev/null +++ b/main/http_server/axe-os/src/app/local-storage.service.spec.ts @@ -0,0 +1,16 @@ +import { TestBed } from '@angular/core/testing'; + +import { LocalStorageService } from './local-storage.service'; + +describe('LocalStorageService', () => { + let service: LocalStorageService; + + beforeEach(() => { + TestBed.configureTestingModule({}); + service = TestBed.inject(LocalStorageService); + }); + + it('should be created', () => { + expect(service).toBeTruthy(); + }); +}); diff --git a/main/http_server/axe-os/src/app/local-storage.service.ts b/main/http_server/axe-os/src/app/local-storage.service.ts new file mode 100644 index 000000000..adeb596db --- /dev/null +++ b/main/http_server/axe-os/src/app/local-storage.service.ts @@ -0,0 +1,37 @@ +import { Injectable } from '@angular/core'; + +@Injectable({ + providedIn: 'root' +}) +export class LocalStorageService { + + constructor() { } + + setItem(key: string, value: any) { + localStorage.setItem(key, value); + } + + getItem(key: string): any { + return localStorage.getItem(key); + } + + setBool(key: string, value: boolean) { + localStorage.setItem(key, String(value)); + } + + getBool(key: string): boolean { + return localStorage.getItem(key) === 'true'; + } + + setObject(key: string, value: object) { + localStorage.setItem(key, JSON.stringify(value)); + } + + getObject(key: string): any | null{ + const item = localStorage.getItem(key); + if(item == null || item.length < 1){ + return null; + } + return JSON.parse(item); + } +} diff --git a/main/http_server/http_server.c b/main/http_server/http_server.c index 2c5afb9ac..04db4aa2b 100644 --- a/main/http_server/http_server.c +++ b/main/http_server/http_server.c @@ -193,38 +193,6 @@ static esp_err_t rest_common_get_handler(httpd_req_t * req) return ESP_OK; } -static esp_err_t PATCH_update_swarm(httpd_req_t * req) -{ - // Set CORS headers - if (set_cors_headers(req) != ESP_OK) { - httpd_resp_send_500(req); - return ESP_FAIL; - } - - int total_len = req->content_len; - int cur_len = 0; - char * buf = ((rest_server_context_t *) (req->user_ctx))->scratch; - int received = 0; - if (total_len >= SCRATCH_BUFSIZE) { - /* Respond with 500 Internal Server Error */ - httpd_resp_send_err(req, HTTPD_500_INTERNAL_SERVER_ERROR, "content too long"); - return ESP_FAIL; - } - while (cur_len < total_len) { - received = httpd_req_recv(req, buf + cur_len, total_len); - if (received <= 0) { - /* Respond with 500 Internal Server Error */ - httpd_resp_send_err(req, HTTPD_500_INTERNAL_SERVER_ERROR, "Failed to post control value"); - return ESP_FAIL; - } - cur_len += received; - } - buf[total_len] = '\0'; - - nvs_config_set_string(NVS_CONFIG_SWARM, buf); - httpd_resp_send_chunk(req, NULL, 0); - return ESP_OK; -} static esp_err_t handle_options_request(httpd_req_t * req) { @@ -351,21 +319,6 @@ static esp_err_t POST_restart(httpd_req_t * req) return ESP_OK; } -static esp_err_t GET_swarm(httpd_req_t * req) -{ - httpd_resp_set_type(req, "application/json"); - - // Set CORS headers - if (set_cors_headers(req) != ESP_OK) { - httpd_resp_send_500(req); - return ESP_FAIL; - } - - char * swarm_config = nvs_config_get_string(NVS_CONFIG_SWARM, "[]"); - httpd_resp_sendstr(req, swarm_config); - free(swarm_config); - return ESP_OK; -} /* Simple handler for getting system handler */ static esp_err_t GET_system_info(httpd_req_t * req) @@ -729,13 +682,6 @@ esp_err_t start_rest_server(void * pvParameters) .uri = "/api/system/info", .method = HTTP_GET, .handler = GET_system_info, .user_ctx = rest_context}; httpd_register_uri_handler(server, &system_info_get_uri); - httpd_uri_t swarm_get_uri = {.uri = "/api/swarm/info", .method = HTTP_GET, .handler = GET_swarm, .user_ctx = rest_context}; - httpd_register_uri_handler(server, &swarm_get_uri); - - httpd_uri_t update_swarm_uri = { - .uri = "/api/swarm", .method = HTTP_PATCH, .handler = PATCH_update_swarm, .user_ctx = rest_context}; - httpd_register_uri_handler(server, &update_swarm_uri); - httpd_uri_t swarm_options_uri = { .uri = "/api/swarm", .method = HTTP_OPTIONS, From 97417e33bf11ada5f68d90a6f454e50c831b9462 Mon Sep 17 00:00:00 2001 From: Benjamin Wilson Date: Fri, 1 Nov 2024 18:10:56 -0400 Subject: [PATCH 18/56] Overhaul Axeos theme (#429) --- .vscode/settings.json | 2 +- main/http_server/axe-os/only-gzip.js | 30 +- .../app/components/home/home.component.html | 261 +- .../src/app/layout/app.footer.component.html | 4 +- .../src/app/layout/app.menu.component.html | 2 +- .../src/app/layout/app.topbar.component.html | 2 +- .../src/app/layout/styles/layout/_topbar.scss | 2 +- .../app/layout/styles/layout/_variables.scss | 2 +- .../styles/theme/theme-base/_colors.scss | 18 + .../styles/theme/theme-base/_common.scss | 75 + .../styles/theme/theme-base/_components.scss | 110 + .../styles/theme/theme-base/_mixins.scss | 339 + .../theme-base/components/button/_button.scss | 625 ++ .../components/button/_speeddial.scss | 96 + .../components/button/_splitbutton.scss | 15 + .../theme-base/components/data/_carousel.scss | 37 + .../components/data/_datatable.scss | 338 + .../theme-base/components/data/_dataview.scss | 46 + .../theme-base/components/data/_filter.scss | 142 + .../components/data/_orderlist.scss | 125 + .../components/data/_organizationchart.scss | 50 + .../components/data/_paginator.scss | 92 + .../theme-base/components/data/_picklist.scss | 125 + .../theme-base/components/data/_timeline.scss | 38 + .../theme-base/components/data/_tree.scss | 172 + .../components/data/_treetable.scss | 278 + .../components/data/_virtualscroller.scss | 28 + .../components/file/_fileupload.scss | 64 + .../components/input/_autocomplete.scss | 146 + .../components/input/_calendar.scss | 267 + .../components/input/_cascadeselect.scss | 152 + .../components/input/_checkbox.scss | 115 + .../theme-base/components/input/_chips.scss | 65 + .../components/input/_colorpicker.scss | 19 + .../components/input/_dropdown.scss | 167 + .../theme-base/components/input/_editor.scss | 122 + .../components/input/_iconfield.scss | 7 + .../components/input/_inputgroup.scss | 74 + .../components/input/_inputicon.scss | 13 + .../components/input/_inputmask.scss | 30 + .../components/input/_inputnumber.scss | 42 + .../components/input/_inputotp.scss | 10 + .../components/input/_inputswitch.scss | 60 + .../components/input/_inputtext.scss | 124 + .../theme-base/components/input/_listbox.scss | 105 + .../components/input/_multiselect.scss | 194 + .../components/input/_password.scss | 52 + .../components/input/_radiobutton.scss | 97 + .../theme-base/components/input/_rating.scss | 66 + .../components/input/_selectbutton.scss | 50 + .../theme-base/components/input/_slider.scss | 74 + .../components/input/_togglebutton.scss | 48 + .../components/input/_treeselect.scss | 151 + .../components/menu/_breadcrumb.scss | 42 + .../components/menu/_contextmenu.scss | 39 + .../theme-base/components/menu/_dock.scss | 95 + .../theme-base/components/menu/_megamenu.scss | 56 + .../theme-base/components/menu/_menu.scss | 37 + .../theme-base/components/menu/_menubar.scss | 142 + .../components/menu/_panelmenu.scss | 153 + .../components/menu/_slidemenu.scss | 59 + .../theme-base/components/menu/_steps.scss | 56 + .../theme-base/components/menu/_tabmenu.scss | 74 + .../components/menu/_tieredmenu.scss | 44 + .../components/messages/_inlinemessage.scss | 69 + .../components/messages/_message.scss | 141 + .../components/messages/_toast.scss | 127 + .../theme-base/components/misc/_avatar.scss | 30 + .../theme-base/components/misc/_badge.scss | 55 + .../theme-base/components/misc/_blockui.scss | 0 .../theme-base/components/misc/_chip.scss | 42 + .../theme-base/components/misc/_inplace.scss | 17 + .../components/misc/_metergroup.scss | 117 + .../components/misc/_progressbar.scss | 17 + .../components/misc/_scrolltop.scss | 25 + .../theme-base/components/misc/_skeleton.scss | 8 + .../theme-base/components/misc/_tag.scss | 52 + .../theme-base/components/misc/_terminal.scss | 12 + .../components/multimedia/_galleria.scss | 155 + .../components/multimedia/_image.scss | 49 + .../components/overlay/_confirmpopup.scss | 72 + .../components/overlay/_dialog.scss | 69 + .../components/overlay/_overlaypanel.scss | 64 + .../components/overlay/_sidebar.scss | 27 + .../components/overlay/_tooltip.scss | 33 + .../components/panel/_accordion.scss | 119 + .../theme-base/components/panel/_card.scss | 30 + .../theme-base/components/panel/_divider.scss | 31 + .../components/panel/_fieldset.scss | 47 + .../theme-base/components/panel/_panel.scss | 63 + .../components/panel/_scrollpanel.scss | 11 + .../components/panel/_splitter.scss | 23 + .../theme-base/components/panel/_stepper.scss | 201 + .../theme-base/components/panel/_tabview.scss | 82 + .../theme-base/components/panel/_toolbar.scss | 11 + .../styles/theme/themes/vela/_extensions.scss | 39 + .../styles/theme/themes/vela/_variables.scss | 955 +++ .../theme/themes/vela/bitaxe/_extensions.scss | 2 + .../theme/themes/vela/bitaxe/_fonts.scss | 1 + .../theme/themes/vela/bitaxe/_variables.scss | 11 + .../theme/themes/vela/bitaxe/theme.scss | 4 + .../layout/styles/theme/vela-blue/theme.css | 6293 ----------------- .../axe-os/src/assets/fonts/AngelWish.ttf | Bin 0 -> 112000 bytes .../axe-os/src/assets/fonts/Nippo-Regular.ttf | Bin 0 -> 46092 bytes .../src/assets/fonts/Nippo-Regular.woff | Bin 0 -> 20164 bytes .../src/assets/fonts/Nippo-Regular.woff2 | Bin 0 -> 15884 bytes main/http_server/axe-os/src/styles.scss | 21 +- main/main.c | 8 +- 108 files changed, 8839 insertions(+), 6459 deletions(-) create mode 100644 main/http_server/axe-os/src/app/layout/styles/theme/theme-base/_colors.scss create mode 100644 main/http_server/axe-os/src/app/layout/styles/theme/theme-base/_common.scss create mode 100644 main/http_server/axe-os/src/app/layout/styles/theme/theme-base/_components.scss create mode 100644 main/http_server/axe-os/src/app/layout/styles/theme/theme-base/_mixins.scss create mode 100644 main/http_server/axe-os/src/app/layout/styles/theme/theme-base/components/button/_button.scss create mode 100644 main/http_server/axe-os/src/app/layout/styles/theme/theme-base/components/button/_speeddial.scss create mode 100644 main/http_server/axe-os/src/app/layout/styles/theme/theme-base/components/button/_splitbutton.scss create mode 100644 main/http_server/axe-os/src/app/layout/styles/theme/theme-base/components/data/_carousel.scss create mode 100644 main/http_server/axe-os/src/app/layout/styles/theme/theme-base/components/data/_datatable.scss create mode 100644 main/http_server/axe-os/src/app/layout/styles/theme/theme-base/components/data/_dataview.scss create mode 100644 main/http_server/axe-os/src/app/layout/styles/theme/theme-base/components/data/_filter.scss create mode 100644 main/http_server/axe-os/src/app/layout/styles/theme/theme-base/components/data/_orderlist.scss create mode 100644 main/http_server/axe-os/src/app/layout/styles/theme/theme-base/components/data/_organizationchart.scss create mode 100644 main/http_server/axe-os/src/app/layout/styles/theme/theme-base/components/data/_paginator.scss create mode 100644 main/http_server/axe-os/src/app/layout/styles/theme/theme-base/components/data/_picklist.scss create mode 100644 main/http_server/axe-os/src/app/layout/styles/theme/theme-base/components/data/_timeline.scss create mode 100644 main/http_server/axe-os/src/app/layout/styles/theme/theme-base/components/data/_tree.scss create mode 100644 main/http_server/axe-os/src/app/layout/styles/theme/theme-base/components/data/_treetable.scss create mode 100644 main/http_server/axe-os/src/app/layout/styles/theme/theme-base/components/data/_virtualscroller.scss create mode 100644 main/http_server/axe-os/src/app/layout/styles/theme/theme-base/components/file/_fileupload.scss create mode 100644 main/http_server/axe-os/src/app/layout/styles/theme/theme-base/components/input/_autocomplete.scss create mode 100644 main/http_server/axe-os/src/app/layout/styles/theme/theme-base/components/input/_calendar.scss create mode 100644 main/http_server/axe-os/src/app/layout/styles/theme/theme-base/components/input/_cascadeselect.scss create mode 100644 main/http_server/axe-os/src/app/layout/styles/theme/theme-base/components/input/_checkbox.scss create mode 100644 main/http_server/axe-os/src/app/layout/styles/theme/theme-base/components/input/_chips.scss create mode 100644 main/http_server/axe-os/src/app/layout/styles/theme/theme-base/components/input/_colorpicker.scss create mode 100644 main/http_server/axe-os/src/app/layout/styles/theme/theme-base/components/input/_dropdown.scss create mode 100644 main/http_server/axe-os/src/app/layout/styles/theme/theme-base/components/input/_editor.scss create mode 100644 main/http_server/axe-os/src/app/layout/styles/theme/theme-base/components/input/_iconfield.scss create mode 100644 main/http_server/axe-os/src/app/layout/styles/theme/theme-base/components/input/_inputgroup.scss create mode 100644 main/http_server/axe-os/src/app/layout/styles/theme/theme-base/components/input/_inputicon.scss create mode 100644 main/http_server/axe-os/src/app/layout/styles/theme/theme-base/components/input/_inputmask.scss create mode 100644 main/http_server/axe-os/src/app/layout/styles/theme/theme-base/components/input/_inputnumber.scss create mode 100644 main/http_server/axe-os/src/app/layout/styles/theme/theme-base/components/input/_inputotp.scss create mode 100644 main/http_server/axe-os/src/app/layout/styles/theme/theme-base/components/input/_inputswitch.scss create mode 100644 main/http_server/axe-os/src/app/layout/styles/theme/theme-base/components/input/_inputtext.scss create mode 100644 main/http_server/axe-os/src/app/layout/styles/theme/theme-base/components/input/_listbox.scss create mode 100644 main/http_server/axe-os/src/app/layout/styles/theme/theme-base/components/input/_multiselect.scss create mode 100644 main/http_server/axe-os/src/app/layout/styles/theme/theme-base/components/input/_password.scss create mode 100644 main/http_server/axe-os/src/app/layout/styles/theme/theme-base/components/input/_radiobutton.scss create mode 100644 main/http_server/axe-os/src/app/layout/styles/theme/theme-base/components/input/_rating.scss create mode 100644 main/http_server/axe-os/src/app/layout/styles/theme/theme-base/components/input/_selectbutton.scss create mode 100644 main/http_server/axe-os/src/app/layout/styles/theme/theme-base/components/input/_slider.scss create mode 100644 main/http_server/axe-os/src/app/layout/styles/theme/theme-base/components/input/_togglebutton.scss create mode 100644 main/http_server/axe-os/src/app/layout/styles/theme/theme-base/components/input/_treeselect.scss create mode 100644 main/http_server/axe-os/src/app/layout/styles/theme/theme-base/components/menu/_breadcrumb.scss create mode 100644 main/http_server/axe-os/src/app/layout/styles/theme/theme-base/components/menu/_contextmenu.scss create mode 100644 main/http_server/axe-os/src/app/layout/styles/theme/theme-base/components/menu/_dock.scss create mode 100644 main/http_server/axe-os/src/app/layout/styles/theme/theme-base/components/menu/_megamenu.scss create mode 100644 main/http_server/axe-os/src/app/layout/styles/theme/theme-base/components/menu/_menu.scss create mode 100644 main/http_server/axe-os/src/app/layout/styles/theme/theme-base/components/menu/_menubar.scss create mode 100644 main/http_server/axe-os/src/app/layout/styles/theme/theme-base/components/menu/_panelmenu.scss create mode 100644 main/http_server/axe-os/src/app/layout/styles/theme/theme-base/components/menu/_slidemenu.scss create mode 100644 main/http_server/axe-os/src/app/layout/styles/theme/theme-base/components/menu/_steps.scss create mode 100644 main/http_server/axe-os/src/app/layout/styles/theme/theme-base/components/menu/_tabmenu.scss create mode 100644 main/http_server/axe-os/src/app/layout/styles/theme/theme-base/components/menu/_tieredmenu.scss create mode 100644 main/http_server/axe-os/src/app/layout/styles/theme/theme-base/components/messages/_inlinemessage.scss create mode 100644 main/http_server/axe-os/src/app/layout/styles/theme/theme-base/components/messages/_message.scss create mode 100644 main/http_server/axe-os/src/app/layout/styles/theme/theme-base/components/messages/_toast.scss create mode 100644 main/http_server/axe-os/src/app/layout/styles/theme/theme-base/components/misc/_avatar.scss create mode 100644 main/http_server/axe-os/src/app/layout/styles/theme/theme-base/components/misc/_badge.scss create mode 100644 main/http_server/axe-os/src/app/layout/styles/theme/theme-base/components/misc/_blockui.scss create mode 100644 main/http_server/axe-os/src/app/layout/styles/theme/theme-base/components/misc/_chip.scss create mode 100644 main/http_server/axe-os/src/app/layout/styles/theme/theme-base/components/misc/_inplace.scss create mode 100644 main/http_server/axe-os/src/app/layout/styles/theme/theme-base/components/misc/_metergroup.scss create mode 100644 main/http_server/axe-os/src/app/layout/styles/theme/theme-base/components/misc/_progressbar.scss create mode 100644 main/http_server/axe-os/src/app/layout/styles/theme/theme-base/components/misc/_scrolltop.scss create mode 100644 main/http_server/axe-os/src/app/layout/styles/theme/theme-base/components/misc/_skeleton.scss create mode 100644 main/http_server/axe-os/src/app/layout/styles/theme/theme-base/components/misc/_tag.scss create mode 100644 main/http_server/axe-os/src/app/layout/styles/theme/theme-base/components/misc/_terminal.scss create mode 100644 main/http_server/axe-os/src/app/layout/styles/theme/theme-base/components/multimedia/_galleria.scss create mode 100644 main/http_server/axe-os/src/app/layout/styles/theme/theme-base/components/multimedia/_image.scss create mode 100644 main/http_server/axe-os/src/app/layout/styles/theme/theme-base/components/overlay/_confirmpopup.scss create mode 100644 main/http_server/axe-os/src/app/layout/styles/theme/theme-base/components/overlay/_dialog.scss create mode 100644 main/http_server/axe-os/src/app/layout/styles/theme/theme-base/components/overlay/_overlaypanel.scss create mode 100644 main/http_server/axe-os/src/app/layout/styles/theme/theme-base/components/overlay/_sidebar.scss create mode 100644 main/http_server/axe-os/src/app/layout/styles/theme/theme-base/components/overlay/_tooltip.scss create mode 100644 main/http_server/axe-os/src/app/layout/styles/theme/theme-base/components/panel/_accordion.scss create mode 100644 main/http_server/axe-os/src/app/layout/styles/theme/theme-base/components/panel/_card.scss create mode 100644 main/http_server/axe-os/src/app/layout/styles/theme/theme-base/components/panel/_divider.scss create mode 100644 main/http_server/axe-os/src/app/layout/styles/theme/theme-base/components/panel/_fieldset.scss create mode 100644 main/http_server/axe-os/src/app/layout/styles/theme/theme-base/components/panel/_panel.scss create mode 100644 main/http_server/axe-os/src/app/layout/styles/theme/theme-base/components/panel/_scrollpanel.scss create mode 100644 main/http_server/axe-os/src/app/layout/styles/theme/theme-base/components/panel/_splitter.scss create mode 100644 main/http_server/axe-os/src/app/layout/styles/theme/theme-base/components/panel/_stepper.scss create mode 100644 main/http_server/axe-os/src/app/layout/styles/theme/theme-base/components/panel/_tabview.scss create mode 100644 main/http_server/axe-os/src/app/layout/styles/theme/theme-base/components/panel/_toolbar.scss create mode 100644 main/http_server/axe-os/src/app/layout/styles/theme/themes/vela/_extensions.scss create mode 100644 main/http_server/axe-os/src/app/layout/styles/theme/themes/vela/_variables.scss create mode 100644 main/http_server/axe-os/src/app/layout/styles/theme/themes/vela/bitaxe/_extensions.scss create mode 100644 main/http_server/axe-os/src/app/layout/styles/theme/themes/vela/bitaxe/_fonts.scss create mode 100644 main/http_server/axe-os/src/app/layout/styles/theme/themes/vela/bitaxe/_variables.scss create mode 100644 main/http_server/axe-os/src/app/layout/styles/theme/themes/vela/bitaxe/theme.scss delete mode 100644 main/http_server/axe-os/src/app/layout/styles/theme/vela-blue/theme.css create mode 100644 main/http_server/axe-os/src/assets/fonts/AngelWish.ttf create mode 100644 main/http_server/axe-os/src/assets/fonts/Nippo-Regular.ttf create mode 100644 main/http_server/axe-os/src/assets/fonts/Nippo-Regular.woff create mode 100644 main/http_server/axe-os/src/assets/fonts/Nippo-Regular.woff2 diff --git a/.vscode/settings.json b/.vscode/settings.json index c856832a9..270eaebd9 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,6 +1,6 @@ { "idf.flashType": "UART", - "idf.portWin": "COM3", + "idf.portWin": "COM72", "idf.adapterTargetName": "esp32s3", "idf.openOcdConfigs": [ "interface/ftdi/esp32_devkitj_v1.cfg", diff --git a/main/http_server/axe-os/only-gzip.js b/main/http_server/axe-os/only-gzip.js index 707e34c0d..bd78cec59 100644 --- a/main/http_server/axe-os/only-gzip.js +++ b/main/http_server/axe-os/only-gzip.js @@ -4,13 +4,27 @@ const path = require('path'); const directory = './dist/axe-os'; fs.readdir(directory, (err, files) => { - if (err) throw err; + if (err) throw err; - for (const file of files) { - if (!file.endsWith('.gz')) { - fs.unlink(path.join(directory, file), err => { - if (err) throw err; - }); + for (const file of files) { + const filePath = path.join(directory, file); + + fs.stat(filePath, (err, stats) => { + if (err) throw err; + + if (stats.isDirectory()) { + // If it's a directory, call rmdir after deleting its contents + fs.rmdir(filePath, { recursive: true }, (err) => { + if (err) throw err; + console.log(`Removed directory: ${filePath}`); + }); + } else if (!file.endsWith('.gz')) { + // If it's a file and doesn't end with .gz, unlink it + fs.unlink(filePath, (err) => { + if (err) throw err; + console.log(`Removed file: ${filePath}`); + }); + } + }); } - } -}); \ No newline at end of file +}); diff --git a/main/http_server/axe-os/src/app/components/home/home.component.html b/main/http_server/axe-os/src/app/components/home/home.component.html index 604700b43..f3c7d7d26 100644 --- a/main/http_server/axe-os/src/app/components/home/home.component.html +++ b/main/http_server/axe-os/src/app/components/home/home.component.html @@ -3,206 +3,172 @@

Loading...

-
-
-
-
-
-
-
- Hash Rate -
{{info.hashRate * 1000000000 | hashSuffix}} -
-
-
- +
+
+
+
+
+ Hash Rate +
{{info.hashRate * 1000000000 | hashSuffix}}
- - {{expectedHashRate * 1000000000 | hashSuffix}} - expected -
+ + {{expectedHashRate * 1000000000 | + hashSuffix}} + expected +
-
-
-
-
- Shares -
{{info.sharesAccepted | number: '1.0-0'}}
-
-
- +
+
+
+
+
+ Efficiency +
+
- {{info.sharesRejected | number: '1.0-0'}} - rejected + + {{info.power / (expectedHashRate/1000) | number: + '1.2-2'}} J/TH + + expected + + -
-
-
-
- Efficiency -
-
- - -
- +
+
+
+
+
+ Shares +
{{info.sharesAccepted | number: '1.0-0'}}
- - {{info.power / (expectedHashRate/1000) | number: '1.2-2'}} J/TH - - expected - -
+ {{info.sharesRejected | number: '1.0-0'}} + rejected
-
-
-
-
- Best Difficulty -
{{info.bestDiff}} - all-time best -
-
-
- +
+ +
+
+
+
+ Best Difficulty +
{{info.bestDiff}} + all-time best
- {{info.bestSessionDiff}} - since system boot -
+ {{info.bestSessionDiff}} + since system boot +
-
- +
+
+
+
-
+
-
Power
-
-
- - Power +

Power

+
+
+
Power {{info.power}} W
+ + +
-
- - Input Voltage +
+ +
Input Voltage {{info.voltage}} V
+ + + +   Danger: Low voltage
-
- + + +
ASIC Frequency {{info.frequency}} Mhz
+ + + +
+
+ +
Measured ASIC Voltage {{info.coreVoltageActual}} V
+ + +
+
-
+
-
Heat
-
-
- - - ASIC Temperature +

Heat

+
+
+ +
ASIC Temperature {{info.temp}}°C
+ + +   Danger: High Temperature
-
- - Voltage Regulator Temperature +
+ +
Voltage Regulator Temperature {{info.vrTemp}}°C
+ + +   Danger: High Temperature
-
- - Fan % -
-
- - Fan RPM -
-
-
-
-
Performance
-
-
- - ASIC Frequency (MHz) -
-
- - ASIC Voltage Measured -
- - -
- -
-
- - -
@@ -212,7 +178,8 @@
Pool Information ({{info.isUsingFallbackStratum ? 'Fallback' : 'Primary' }})
@@ -228,7 +195,9 @@
Pool Information ({{info.isUsingFallbackStratum ? 'Fallback' : 'Primary' }})
@@ -248,4 +217,4 @@
Pool Information ({{info.isUsingFallbackStratum ? 'Fallback' : 'Primary' }}) - + \ No newline at end of file diff --git a/main/http_server/axe-os/src/app/layout/app.footer.component.html b/main/http_server/axe-os/src/app/layout/app.footer.component.html index 331194672..7b86dc397 100644 --- a/main/http_server/axe-os/src/app/layout/app.footer.component.html +++ b/main/http_server/axe-os/src/app/layout/app.footer.component.html @@ -1,3 +1,3 @@ - \ No newline at end of file + From de61532c3471e4a8d7ce19383e4d356cb239a8d4 Mon Sep 17 00:00:00 2001 From: mrv777 Date: Sun, 3 Nov 2024 19:36:20 -0600 Subject: [PATCH 22/56] fix: Temp suffix & 5v marker (#448) --- .../src/app/components/home/home.component.html | 13 +++++++++---- .../src/app/components/home/home.component.ts | 11 ++++++++--- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/main/http_server/axe-os/src/app/components/home/home.component.html b/main/http_server/axe-os/src/app/components/home/home.component.html index f3c7d7d26..30a7d4d1d 100644 --- a/main/http_server/axe-os/src/app/components/home/home.component.html +++ b/main/http_server/axe-os/src/app/components/home/home.component.html @@ -99,10 +99,15 @@
Power {{info.power}} W
Input Voltage {{info.voltage}} V
- - - - +
+ + + + +
+ 5.0 +
+
  Danger: Low voltage
diff --git a/main/http_server/axe-os/src/app/components/home/home.component.ts b/main/http_server/axe-os/src/app/components/home/home.component.ts index 52d4781ca..e37022a86 100644 --- a/main/http_server/axe-os/src/app/components/home/home.component.ts +++ b/main/http_server/axe-os/src/app/components/home/home.component.ts @@ -64,7 +64,7 @@ export class HomeComponent { data: [], fill: false, backgroundColor: primaryColor + '30', - borderColor: primaryColor + '30', + borderColor: primaryColor + '60', tension: 0, pointRadius: 0, borderWidth: 2, @@ -103,7 +103,11 @@ export class HomeComponent { if (label) { label += ': '; } - label += HashSuffixPipe.transform(tooltipItem.raw); + if (tooltipItem.dataset.label === 'ASIC Temp') { + label += tooltipItem.raw + '°C'; + } else { + label += HashSuffixPipe.transform(tooltipItem.raw); + } return label; } } @@ -139,7 +143,8 @@ export class HomeComponent { display: true, position: 'right', ticks: { - color: textColorSecondary + color: textColorSecondary, + callback: (value: number) => value + '°C' }, grid: { drawOnChartArea: false, From 2a0470faf99e2947608974a9ee254f36d34f0bdf Mon Sep 17 00:00:00 2001 From: Skot Date: Sun, 3 Nov 2024 19:49:55 -0600 Subject: [PATCH 23/56] small change to only-gzip.js to remove warning (#449) --- main/http_server/axe-os/only-gzip.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/http_server/axe-os/only-gzip.js b/main/http_server/axe-os/only-gzip.js index bd78cec59..f1c9360f4 100644 --- a/main/http_server/axe-os/only-gzip.js +++ b/main/http_server/axe-os/only-gzip.js @@ -14,7 +14,7 @@ fs.readdir(directory, (err, files) => { if (stats.isDirectory()) { // If it's a directory, call rmdir after deleting its contents - fs.rmdir(filePath, { recursive: true }, (err) => { + fs.rm(filePath, { recursive: true }, (err) => { if (err) throw err; console.log(`Removed directory: ${filePath}`); }); From 2cfabd301f96e3b1bfd9294f233cc2a92a5d2c90 Mon Sep 17 00:00:00 2001 From: mutatrum Date: Mon, 4 Nov 2024 03:13:35 +0100 Subject: [PATCH 24/56] Fix ESP-NOW warning by limiting ap max_connections (#426) --- components/connect/connect.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/connect/connect.c b/components/connect/connect.c index cbc3a1131..c7e691238 100644 --- a/components/connect/connect.c +++ b/components/connect/connect.c @@ -49,7 +49,7 @@ /* FreeRTOS event group to signal when we are connected*/ static EventGroupHandle_t s_wifi_event_group; -static const char * TAG = "wifi station"; +static const char * TAG = "wifi_station"; static int s_retry_num = 0; @@ -102,7 +102,7 @@ esp_netif_t * wifi_init_softap(void) strncpy((char *) wifi_ap_config.ap.ssid, ssid_with_mac, sizeof(wifi_ap_config.ap.ssid)); wifi_ap_config.ap.ssid_len = strlen(ssid_with_mac); wifi_ap_config.ap.channel = 1; - wifi_ap_config.ap.max_connection = 30; + wifi_ap_config.ap.max_connection = 10; wifi_ap_config.ap.authmode = WIFI_AUTH_OPEN; wifi_ap_config.ap.pmf_cfg.required = false; From b10a5ba4031d815a17839d8ab471a68ec0d9bb7b Mon Sep 17 00:00:00 2001 From: Erik Olof Gunnar Andersson Date: Mon, 4 Nov 2024 03:30:45 +0100 Subject: [PATCH 25/56] Move back to solostats (#423) --- .../axe-os/src/app/components/home/home.component.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/http_server/axe-os/src/app/components/home/home.component.ts b/main/http_server/axe-os/src/app/components/home/home.component.ts index e37022a86..9ffb2894d 100644 --- a/main/http_server/axe-os/src/app/components/home/home.component.ts +++ b/main/http_server/axe-os/src/app/components/home/home.component.ts @@ -239,7 +239,7 @@ export class HomeComponent { return `https://solo.d-central.tech/#/app/${address}`; } else if (/solo[46]?.ckpool.org/.test(info.fallbackStratumURL)) { const address = info.fallbackStratumUser.split('.')[0] - return `https://solo.ckpool.org/users/${address}`; + return `https://solostats.ckpool.org/users/${address}`; } else { return undefined; } From 17df89594eb366a47bc8a777968a33076ba6b754 Mon Sep 17 00:00:00 2001 From: mrv777 Date: Tue, 5 Nov 2024 09:16:51 -0600 Subject: [PATCH 26/56] fix: Better mobile styles for swarm --- .../app/components/swarm/swarm.component.html | 19 +++++++++++------- .../app/components/swarm/swarm.component.scss | 20 +++++++++++++++++++ .../app/layout/styles/layout/_content.scss | 4 ++++ .../app/layout/styles/layout/_responsive.scss | 1 - 4 files changed, 36 insertions(+), 8 deletions(-) diff --git a/main/http_server/axe-os/src/app/components/swarm/swarm.component.html b/main/http_server/axe-os/src/app/components/swarm/swarm.component.html index 8340595b0..c2dae380b 100644 --- a/main/http_server/axe-os/src/app/components/swarm/swarm.component.html +++ b/main/http_server/axe-os/src/app/components/swarm/swarm.component.html @@ -14,10 +14,15 @@ - - -
-
IP Hash RateRestart Remove
{{axe.ip}}
{{axe.IP}} {{axe.hashRate * 1000000000 | hashSuffix}} {{axe.uptimeSeconds | dateAgo}} {{axe.sharesAccepted | number: '1.0-0'}}{{axe.temp}}°C {{axe.bestDiff}} {{axe.version}}
{{info.power / (info.hashRate/1000) | number: '1.2-2'}} J/TH + {{info.power / (info.hashRate/1000) | number: '1.2-2'}} J/TH -
URL: - {{info.stratumURL}} + {{info.stratumURL}}
URL: - {{info.fallbackStratumURL}} + {{info.fallbackStratumURL}}
+
+
+ + +
+
+ +
+
@@ -25,7 +30,7 @@ - + @@ -37,8 +42,8 @@ - - + + diff --git a/main/http_server/axe-os/src/app/components/swarm/swarm.component.scss b/main/http_server/axe-os/src/app/components/swarm/swarm.component.scss index 7b1ca6885..92bb2e1a1 100644 --- a/main/http_server/axe-os/src/app/components/swarm/swarm.component.scss +++ b/main/http_server/axe-os/src/app/components/swarm/swarm.component.scss @@ -52,4 +52,24 @@ a { right: 20px; top: 20px; cursor: pointer; +} + +.table-container { + width: 100%; + overflow-x: auto; + margin: 1rem 0; + + table { + min-width: 100%; + white-space: nowrap; + + th, td { + padding: 0.75rem; + text-align: left; + + @media (max-width: 1150px) { + padding: 0.5rem; + } + } + } } \ No newline at end of file diff --git a/main/http_server/axe-os/src/app/layout/styles/layout/_content.scss b/main/http_server/axe-os/src/app/layout/styles/layout/_content.scss index 2c40e1da8..d22350669 100644 --- a/main/http_server/axe-os/src/app/layout/styles/layout/_content.scss +++ b/main/http_server/axe-os/src/app/layout/styles/layout/_content.scss @@ -5,6 +5,10 @@ justify-content: space-between; padding: 7rem 2rem 2rem 4rem; transition: margin-left $transitionDuration; + + @media (max-width: 768px) { + padding: 7rem 1rem 1rem 1rem; + } } .layout-main { diff --git a/main/http_server/axe-os/src/app/layout/styles/layout/_responsive.scss b/main/http_server/axe-os/src/app/layout/styles/layout/_responsive.scss index ab2fda441..bc06c2bac 100644 --- a/main/http_server/axe-os/src/app/layout/styles/layout/_responsive.scss +++ b/main/http_server/axe-os/src/app/layout/styles/layout/_responsive.scss @@ -63,7 +63,6 @@ .layout-wrapper { .layout-main-container { margin-left: 0; - padding-left: 2rem; } .layout-sidebar { From 3d472594255c86a3f82842c35dbcb473ae93dc1c Mon Sep 17 00:00:00 2001 From: mrv777 Date: Mon, 4 Nov 2024 09:00:41 -0600 Subject: [PATCH 27/56] fix: Move back primary to human readable ckpool --- .../axe-os/src/app/components/home/home.component.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/http_server/axe-os/src/app/components/home/home.component.ts b/main/http_server/axe-os/src/app/components/home/home.component.ts index 9ffb2894d..3c3802fe6 100644 --- a/main/http_server/axe-os/src/app/components/home/home.component.ts +++ b/main/http_server/axe-os/src/app/components/home/home.component.ts @@ -219,7 +219,7 @@ export class HomeComponent { return `https://solo.d-central.tech/#/app/${address}`; } else if (/solo[46]?.ckpool.org/.test(info.stratumURL)) { const address = info.stratumUser.split('.')[0] - return `https://solo.ckpool.org/users/${address}`; + return `https://solostats.ckpool.org/users/${address}`; } else { return undefined; } From 1751160b63fe159f59d159d2db8387bb53ceb0bf Mon Sep 17 00:00:00 2001 From: mrv777 Date: Tue, 5 Nov 2024 16:55:44 -0600 Subject: [PATCH 28/56] fix: Refactor to combine dup code, add http if not --- .../app/components/home/home.component.html | 2 +- .../src/app/components/home/home.component.ts | 55 +++++++------------ 2 files changed, 20 insertions(+), 37 deletions(-) diff --git a/main/http_server/axe-os/src/app/components/home/home.component.html b/main/http_server/axe-os/src/app/components/home/home.component.html index 30a7d4d1d..f75e30caa 100644 --- a/main/http_server/axe-os/src/app/components/home/home.component.html +++ b/main/http_server/axe-os/src/app/components/home/home.component.html @@ -183,7 +183,7 @@
Pool Information ({{info.isUsingFallbackStratum ? 'Fallback' : 'Primary' }})
diff --git a/main/http_server/axe-os/src/app/components/home/home.component.ts b/main/http_server/axe-os/src/app/components/home/home.component.ts index 3c3802fe6..b37b51b06 100644 --- a/main/http_server/axe-os/src/app/components/home/home.component.ts +++ b/main/http_server/axe-os/src/app/components/home/home.component.ts @@ -207,44 +207,12 @@ export class HomeComponent { })) this.quickLink$ = this.info$.pipe( - map(info => { - if (info.stratumURL.includes('public-pool.io')) { - const address = info.stratumUser.split('.')[0] - return `https://web.public-pool.io/#/app/${address}`; - } else if (info.stratumURL.includes('ocean.xyz')) { - const address = info.stratumUser.split('.')[0] - return `https://ocean.xyz/stats/${address}`; - } else if (info.stratumURL.includes('solo.d-central.tech')) { - const address = info.stratumUser.split('.')[0] - return `https://solo.d-central.tech/#/app/${address}`; - } else if (/solo[46]?.ckpool.org/.test(info.stratumURL)) { - const address = info.stratumUser.split('.')[0] - return `https://solostats.ckpool.org/users/${address}`; - } else { - return undefined; - } - }) - ) + map(info => this.getQuickLink(info.stratumURL, info.stratumUser)) + ); this.fallbackQuickLink$ = this.info$.pipe( - map(info => { - if (info.fallbackStratumURL.includes('public-pool.io')) { - const address = info.fallbackStratumUser.split('.')[0] - return `https://web.public-pool.io/#/app/${address}`; - } else if (info.fallbackStratumURL.includes('ocean.xyz')) { - const address = info.fallbackStratumUser.split('.')[0] - return `https://ocean.xyz/stats/${address}`; - } else if (info.fallbackStratumURL.includes('solo.d-central.tech')) { - const address = info.fallbackStratumUser.split('.')[0] - return `https://solo.d-central.tech/#/app/${address}`; - } else if (/solo[46]?.ckpool.org/.test(info.fallbackStratumURL)) { - const address = info.fallbackStratumUser.split('.')[0] - return `https://solostats.ckpool.org/users/${address}`; - } else { - return undefined; - } - }) - ) + map(info => this.getQuickLink(info.fallbackStratumURL, info.fallbackStratumUser)) + ); } @@ -253,5 +221,20 @@ export class HomeComponent { const sum = data.reduce((sum, value) => sum + value, 0); return sum / data.length; } + + private getQuickLink(stratumURL: string, stratumUser: string): string | undefined { + const address = stratumUser.split('.')[0]; + + if (stratumURL.includes('public-pool.io')) { + return `https://web.public-pool.io/#/app/${address}`; + } else if (stratumURL.includes('ocean.xyz')) { + return `https://ocean.xyz/stats/${address}`; + } else if (stratumURL.includes('solo.d-central.tech')) { + return `https://solo.d-central.tech/#/app/${address}`; + } else if (/solo[46]?.ckpool.org/.test(stratumURL)) { + return `https://solostats.ckpool.org/users/${address}`; + } + return stratumURL.startsWith('http') ? stratumURL : `http://${stratumURL}`; + } } From 0b68b212737e2123e59a3cd3dea1fe356dd9f436 Mon Sep 17 00:00:00 2001 From: Erik Olof Gunnar Andersson Date: Wed, 23 Oct 2024 00:14:45 +0200 Subject: [PATCH 29/56] Fix api not handling errors properly --- main/http_server/http_server.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/main/http_server/http_server.c b/main/http_server/http_server.c index 04db4aa2b..752670e6c 100644 --- a/main/http_server/http_server.c +++ b/main/http_server/http_server.c @@ -181,7 +181,7 @@ static esp_err_t rest_common_get_handler(httpd_req_t * req) httpd_resp_sendstr_chunk(req, NULL); /* Respond with 500 Internal Server Error */ httpd_resp_send_err(req, HTTPD_500_INTERNAL_SERVER_ERROR, "Failed to send file"); - return ESP_FAIL; + return ESP_OK; } } } while (read_bytes > 0); @@ -193,7 +193,6 @@ static esp_err_t rest_common_get_handler(httpd_req_t * req) return ESP_OK; } - static esp_err_t handle_options_request(httpd_req_t * req) { // Set CORS headers for OPTIONS request @@ -223,14 +222,14 @@ static esp_err_t PATCH_update_settings(httpd_req_t * req) if (total_len >= SCRATCH_BUFSIZE) { /* Respond with 500 Internal Server Error */ httpd_resp_send_err(req, HTTPD_500_INTERNAL_SERVER_ERROR, "content too long"); - return ESP_FAIL; + return ESP_OK; } while (cur_len < total_len) { received = httpd_req_recv(req, buf + cur_len, total_len); if (received <= 0) { /* Respond with 500 Internal Server Error */ httpd_resp_send_err(req, HTTPD_500_INTERNAL_SERVER_ERROR, "Failed to post control value"); - return ESP_FAIL; + return ESP_OK; } cur_len += received; } From 4519eb399ae5d34af3ce94511dc3140fba2263b7 Mon Sep 17 00:00:00 2001 From: Erik Olof Gunnar Andersson Date: Wed, 23 Oct 2024 18:31:49 +0200 Subject: [PATCH 30/56] Additional error handling improvements --- main/http_server/http_server.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/main/http_server/http_server.c b/main/http_server/http_server.c index 752670e6c..ccae503c0 100644 --- a/main/http_server/http_server.c +++ b/main/http_server/http_server.c @@ -198,7 +198,7 @@ static esp_err_t handle_options_request(httpd_req_t * req) // Set CORS headers for OPTIONS request if (set_cors_headers(req) != ESP_OK) { httpd_resp_send_500(req); - return ESP_FAIL; + return ESP_OK; } // Send a blank response for OPTIONS request @@ -212,7 +212,7 @@ static esp_err_t PATCH_update_settings(httpd_req_t * req) // Set CORS headers if (set_cors_headers(req) != ESP_OK) { httpd_resp_send_500(req); - return ESP_FAIL; + return ESP_OK; } int total_len = req->content_len; @@ -318,7 +318,6 @@ static esp_err_t POST_restart(httpd_req_t * req) return ESP_OK; } - /* Simple handler for getting system handler */ static esp_err_t GET_system_info(httpd_req_t * req) { @@ -327,7 +326,7 @@ static esp_err_t GET_system_info(httpd_req_t * req) // Set CORS headers if (set_cors_headers(req) != ESP_OK) { httpd_resp_send_500(req); - return ESP_FAIL; + return ESP_OK; } From 8673aae97c88c5e0659e21cd1c0e4e92f546d62a Mon Sep 17 00:00:00 2001 From: Erik Olof Gunnar Andersson Date: Thu, 24 Oct 2024 17:19:17 +0200 Subject: [PATCH 31/56] Clean up error handling further --- main/http_server/http_server.c | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/main/http_server/http_server.c b/main/http_server/http_server.c index ccae503c0..e19fd1524 100644 --- a/main/http_server/http_server.c +++ b/main/http_server/http_server.c @@ -114,14 +114,27 @@ static esp_err_t set_content_type_from_file(httpd_req_t * req, const char * file } return httpd_resp_set_type(req, type); } + static esp_err_t set_cors_headers(httpd_req_t * req) { + esp_err_t err; + + err = httpd_resp_set_hdr(req, "Access-Control-Allow-Origin", "*"); + if (err != ESP_OK) { + return ESP_FAIL; + } + + err = httpd_resp_set_hdr(req, "Access-Control-Allow-Methods", "GET, POST, PUT, PATCH, DELETE, OPTIONS"); + if (err != ESP_OK) { + return ESP_FAIL; + } - return httpd_resp_set_hdr(req, "Access-Control-Allow-Origin", "*") == ESP_OK && - httpd_resp_set_hdr(req, "Access-Control-Allow-Methods", "GET, POST, PUT, PATCH, DELETE, OPTIONS") == ESP_OK && - httpd_resp_set_hdr(req, "Access-Control-Allow-Headers", "Content-Type") == ESP_OK - ? ESP_OK - : ESP_FAIL; + err = httpd_resp_set_hdr(req, "Access-Control-Allow-Headers", "Content-Type"); + if (err != ESP_OK) { + return ESP_FAIL; + } + + return ESP_OK; } /* Recovery handler */ @@ -237,6 +250,11 @@ static esp_err_t PATCH_update_settings(httpd_req_t * req) cJSON * root = cJSON_Parse(buf); cJSON * item; + if (root == NULL) { + httpd_resp_send_err(req, HTTPD_400_BAD_REQUEST, "Invalid JSON"); + return ESP_OK; + } + if ((item = cJSON_GetObjectItem(root, "stratumURL")) != NULL) { nvs_config_set_string(NVS_CONFIG_STRATUM_URL, item->valuestring); } From 78b5f455c1c020c2b6a886e872fe46f386396250 Mon Sep 17 00:00:00 2001 From: Erik Olof Gunnar Andersson Date: Sat, 9 Nov 2024 20:13:27 +0100 Subject: [PATCH 32/56] Fix CI warnings --- .github/workflows/build.yml | 8 ++++---- .github/workflows/release-beta.yml | 8 ++++---- .github/workflows/release-factory-beta.yml | 2 +- .github/workflows/release-factory.yml | 2 +- .github/workflows/release.yml | 8 ++++---- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d5556360d..87abca7bb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,7 +11,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: '22' + node-version: '22.11.0' - name: Build web dist working-directory: ./main/http_server/axe-os run: | @@ -32,17 +32,17 @@ jobs: - name: "Create factory/merged image" run: "./merge_bin.sh ./esp-miner-merged.bin" - name: upload esp-miner-merged.bin - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: esp-miner-factory.bin path: ./esp-miner-merged.bin - name: upload esp-miner.bin - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: esp-miner-ota.bin path: ./build/esp-miner.bin - name: upload www.bin - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: www.bin path: ./build/www.bin diff --git a/.github/workflows/release-beta.yml b/.github/workflows/release-beta.yml index 7838b32e8..de0d9a407 100644 --- a/.github/workflows/release-beta.yml +++ b/.github/workflows/release-beta.yml @@ -15,7 +15,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: '22' + node-version: '22.11.0' - name: Build web dist working-directory: ./main/http_server/axe-os run: | @@ -36,17 +36,17 @@ jobs: - name: "Create factory/merged image" run: "./merge_bin.sh ./esp-miner-merged.bin" - name: upload esp-miner-merged.bin - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: esp-miner-factory.bin path: ./esp-miner-merged.bin - name: upload esp-miner.bin - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: esp-miner.bin path: ./build/esp-miner.bin - name: upload www.bin - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: www.bin path: ./build/www.bin diff --git a/.github/workflows/release-factory-beta.yml b/.github/workflows/release-factory-beta.yml index fe082e377..44674362c 100644 --- a/.github/workflows/release-factory-beta.yml +++ b/.github/workflows/release-factory-beta.yml @@ -20,7 +20,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: '22' + node-version: '22.11.0' - name: Build web dist working-directory: ./main/http_server/axe-os run: | diff --git a/.github/workflows/release-factory.yml b/.github/workflows/release-factory.yml index 39c283786..459214ccc 100644 --- a/.github/workflows/release-factory.yml +++ b/.github/workflows/release-factory.yml @@ -20,7 +20,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: '22' + node-version: '22.11.0' - name: Build web dist working-directory: ./main/http_server/axe-os run: | diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 54ccff428..e76f5fbd1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -15,7 +15,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: '22' + node-version: '22.11.0' - name: Build web dist working-directory: ./main/http_server/axe-os run: | @@ -36,17 +36,17 @@ jobs: - name: "Create factory/merged image" run: "./merge_bin.sh ./esp-miner-merged.bin" - name: upload esp-miner-merged.bin - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: esp-miner-factory.bin path: ./esp-miner-merged.bin - name: upload esp-miner.bin - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: esp-miner.bin path: ./build/esp-miner.bin - name: upload www.bin - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: www.bin path: ./build/www.bin From 0cfae9821f2d2d803e42e747fa30b740ce3b9a3a Mon Sep 17 00:00:00 2001 From: Erik Olof Gunnar Andersson Date: Sat, 9 Nov 2024 19:37:28 +0100 Subject: [PATCH 33/56] Do nothing when roaming --- components/connect/connect.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/components/connect/connect.c b/components/connect/connect.c index c7e691238..36be658ad 100644 --- a/components/connect/connect.c +++ b/components/connect/connect.c @@ -58,9 +58,13 @@ static void event_handler(void * arg, esp_event_base_t event_base, int32_t event if (event_base == WIFI_EVENT && event_id == WIFI_EVENT_STA_START) { esp_wifi_connect(); } else if (event_base == WIFI_EVENT && event_id == WIFI_EVENT_STA_DISCONNECTED) { - //lookup the exact reason code wifi_event_sta_disconnected_t* event = (wifi_event_sta_disconnected_t*) event_data; + if (event->reason == WIFI_REASON_ROAMING) { + ESP_LOGI(TAG, "We are roaming, nothing to do"); + return; + } + ESP_LOGI(TAG, "Could not connect to '%s' [rssi %d]: reason %d", event->ssid, event->rssi, event->reason); // Wait a little From 2af2553c9a32913e6483f0a87c6b798524dac77c Mon Sep 17 00:00:00 2001 From: mrv777 Date: Mon, 4 Nov 2024 09:34:29 -0600 Subject: [PATCH 34/56] fix: Change log font and add colors --- .../app/components/logs/logs.component.html | 2 +- .../app/components/logs/logs.component.scss | 12 +++++++++-- .../src/app/components/logs/logs.component.ts | 21 +++++++++++++++++-- 3 files changed, 30 insertions(+), 5 deletions(-) diff --git a/main/http_server/axe-os/src/app/components/logs/logs.component.html b/main/http_server/axe-os/src/app/components/logs/logs.component.html index 4f677bfa6..45c09d6ea 100644 --- a/main/http_server/axe-os/src/app/components/logs/logs.component.html +++ b/main/http_server/axe-os/src/app/components/logs/logs.component.html @@ -48,7 +48,7 @@

Realtime Logs

- + From 004813ec4f1c9b79591d2c9608161bb61a97ce3c Mon Sep 17 00:00:00 2001 From: Erik Olof Gunnar Andersson Date: Sat, 9 Nov 2024 23:58:01 +0100 Subject: [PATCH 42/56] Change artifact name for test builds --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 87abca7bb..b46ea8dc4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -39,7 +39,7 @@ jobs: - name: upload esp-miner.bin uses: actions/upload-artifact@v4 with: - name: esp-miner-ota.bin + name: esp-miner.bin path: ./build/esp-miner.bin - name: upload www.bin uses: actions/upload-artifact@v4 From b94349940221eb780b80d7b348d3acae6373e315 Mon Sep 17 00:00:00 2001 From: Erik Olof Gunnar Andersson Date: Sun, 10 Nov 2024 00:16:00 +0100 Subject: [PATCH 43/56] Restart returns text, not json --- main/http_server/axe-os/src/app/services/system.service.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/http_server/axe-os/src/app/services/system.service.ts b/main/http_server/axe-os/src/app/services/system.service.ts index a863f687a..6c2023d72 100644 --- a/main/http_server/axe-os/src/app/services/system.service.ts +++ b/main/http_server/axe-os/src/app/services/system.service.ts @@ -69,7 +69,7 @@ export class SystemService { } public restart(uri: string = '') { - return this.httpClient.post(`${uri}/api/system/restart`, {}); + return this.httpClient.post(`${uri}/api/system/restart`, {}, {responseType: 'text'}); } public updateSystem(uri: string = '', update: any) { From f571c16d60a297c0566f168c3cb2c4c93ead61f1 Mon Sep 17 00:00:00 2001 From: mrv777 Date: Sat, 9 Nov 2024 17:25:45 -0600 Subject: [PATCH 44/56] chore: clean up console log --- .../axe-os/src/app/components/home/home.component.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/main/http_server/axe-os/src/app/components/home/home.component.ts b/main/http_server/axe-os/src/app/components/home/home.component.ts index b37b51b06..1bac7bece 100644 --- a/main/http_server/axe-os/src/app/components/home/home.component.ts +++ b/main/http_server/axe-os/src/app/components/home/home.component.ts @@ -40,8 +40,6 @@ export class HomeComponent { const surfaceBorder = documentStyle.getPropertyValue('--surface-border'); const primaryColor = documentStyle.getPropertyValue('--primary-color'); - console.log(primaryColor) - this.chartData = { labels: [], datasets: [ From 5719a5747be6f56d7e4f02a956a84467fb21ff6b Mon Sep 17 00:00:00 2001 From: mrv777 Date: Sat, 9 Nov 2024 17:41:08 -0600 Subject: [PATCH 45/56] fix: Show total hashrate & color temps when high --- .../src/app/components/swarm/swarm.component.html | 5 ++++- .../src/app/components/swarm/swarm.component.ts | 11 +++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/main/http_server/axe-os/src/app/components/swarm/swarm.component.html b/main/http_server/axe-os/src/app/components/swarm/swarm.component.html index e4440d8e8..0694d89f8 100644 --- a/main/http_server/axe-os/src/app/components/swarm/swarm.component.html +++ b/main/http_server/axe-os/src/app/components/swarm/swarm.component.html @@ -19,6 +19,9 @@ +
+ Total Hash Rate: {{totalHashRate * 1000000000 | hashSuffix}} +
@@ -46,7 +49,7 @@
- + diff --git a/main/http_server/axe-os/src/app/components/swarm/swarm.component.ts b/main/http_server/axe-os/src/app/components/swarm/swarm.component.ts index d49f3cfc1..fac79e2aa 100644 --- a/main/http_server/axe-os/src/app/components/swarm/swarm.component.ts +++ b/main/http_server/axe-os/src/app/components/swarm/swarm.component.ts @@ -26,6 +26,8 @@ export class SwarmComponent implements OnInit, OnDestroy { public refreshIntervalRef!: number; public refreshIntervalTime = REFRESH_TIME_SECONDS; + public totalHashRate: number = 0; + constructor( private fb: FormBuilder, private systemService: SystemService, @@ -48,6 +50,7 @@ export class SwarmComponent implements OnInit, OnDestroy { //this.swarm$ = this.scanNetwork('192.168.1.23', '255.255.255.0').pipe(take(1)); } else { this.swarm = swarmData; + this.calculateTotalHashRate(); } this.refreshIntervalRef = window.setInterval(() => { @@ -111,6 +114,7 @@ export class SwarmComponent implements OnInit, OnDestroy { const newItems = result.filter(item => !existingIps.has(item.IP)); this.swarm = [...this.swarm, ...newItems].sort(this.sortByIp.bind(this)); this.localStorageService.setObject(SWARM_DATA, this.swarm); + this.calculateTotalHashRate(); }, complete: () => { this.scanning = false; @@ -132,6 +136,7 @@ export class SwarmComponent implements OnInit, OnDestroy { this.swarm.push({ IP: newIp, ...res }); this.swarm = this.swarm.sort(this.sortByIp.bind(this)); this.localStorageService.setObject(SWARM_DATA, this.swarm); + this.calculateTotalHashRate(); } }); } @@ -157,6 +162,7 @@ export class SwarmComponent implements OnInit, OnDestroy { public remove(axeOs: any) { this.swarm = this.swarm.filter(axe => axe.IP != axeOs.IP); this.localStorageService.setObject(SWARM_DATA, this.swarm); + this.calculateTotalHashRate(); } public refreshList() { @@ -185,6 +191,7 @@ export class SwarmComponent implements OnInit, OnDestroy { next: (result) => { this.swarm = result.sort(this.sortByIp.bind(this)); this.localStorageService.setObject(SWARM_DATA, this.swarm); + this.calculateTotalHashRate(); }, complete: () => { } @@ -196,4 +203,8 @@ export class SwarmComponent implements OnInit, OnDestroy { return this.ipToInt(a.IP) - this.ipToInt(b.IP); } + private calculateTotalHashRate() { + this.totalHashRate = this.swarm.reduce((sum, axe) => sum + (axe.hashRate || 0), 0); + } + } From e84be4850fa0da9fd2a159742286ea2a66e7f828 Mon Sep 17 00:00:00 2001 From: mrv777 Date: Sat, 9 Nov 2024 22:57:19 -0600 Subject: [PATCH 46/56] fix: Disable btn while refreshing, better error handling --- .../app/components/swarm/swarm.component.html | 4 ++- .../app/components/swarm/swarm.component.ts | 31 +++++++++++++++---- 2 files changed, 28 insertions(+), 7 deletions(-) diff --git a/main/http_server/axe-os/src/app/components/swarm/swarm.component.html b/main/http_server/axe-os/src/app/components/swarm/swarm.component.html index 0694d89f8..58a806a5d 100644 --- a/main/http_server/axe-os/src/app/components/swarm/swarm.component.html +++ b/main/http_server/axe-os/src/app/components/swarm/swarm.component.html @@ -17,7 +17,9 @@
- +
Total Hash Rate: {{totalHashRate * 1000000000 | hashSuffix}} diff --git a/main/http_server/axe-os/src/app/components/swarm/swarm.component.ts b/main/http_server/axe-os/src/app/components/swarm/swarm.component.ts index fac79e2aa..2fdbfa299 100644 --- a/main/http_server/axe-os/src/app/components/swarm/swarm.component.ts +++ b/main/http_server/axe-os/src/app/components/swarm/swarm.component.ts @@ -28,6 +28,8 @@ export class SwarmComponent implements OnInit, OnDestroy { public totalHashRate: number = 0; + public isRefreshing = false; + constructor( private fb: FormBuilder, private systemService: SystemService, @@ -54,9 +56,11 @@ export class SwarmComponent implements OnInit, OnDestroy { } this.refreshIntervalRef = window.setInterval(() => { - this.refreshIntervalTime --; - if(this.refreshIntervalTime <= 0){ - this.refreshList(); + if (!this.isRefreshing) { + this.refreshIntervalTime--; + if (this.refreshIntervalTime <= 0) { + this.refreshList(); + } } }, 1000); } @@ -168,6 +172,7 @@ export class SwarmComponent implements OnInit, OnDestroy { public refreshList() { this.refreshIntervalTime = REFRESH_TIME_SECONDS; const ips = this.swarm.map(axeOs => axeOs.IP); + this.isRefreshing = true; from(ips).pipe( mergeMap(ipAddr => @@ -180,8 +185,21 @@ export class SwarmComponent implements OnInit, OnDestroy { }), timeout(5000), catchError(error => { - this.toastr.error('Error', 'Failed to get info from ' + ipAddr + ' - ' + error); - return of(this.swarm.find(axeOs => axeOs.IP == ipAddr)); + const errorMessage = error?.message || error?.statusText || error?.toString() || 'Unknown error'; + this.toastr.error('Failed to get info from ' + ipAddr, errorMessage); + // Return existing device with zeroed stats instead of the previous state + const existingDevice = this.swarm.find(axeOs => axeOs.IP === ipAddr); + return of({ + ...existingDevice, + hashRate: 0, + sharesAccepted: 0, + power: 0, + voltage: 0, + temp: 0, + bestDiff: 0, + version: 0, + uptimeSeconds: 0, + }); }) ), 128 // Limit concurrency to avoid overload @@ -192,11 +210,12 @@ export class SwarmComponent implements OnInit, OnDestroy { this.swarm = result.sort(this.sortByIp.bind(this)); this.localStorageService.setObject(SWARM_DATA, this.swarm); this.calculateTotalHashRate(); + this.isRefreshing = false; }, complete: () => { + this.isRefreshing = false; } }); - } private sortByIp(a: any, b: any): number { From 9d111f93bbcea641ccff793ae1eb95bc0f1e9bc2 Mon Sep 17 00:00:00 2001 From: Erik Olof Gunnar Andersson Date: Wed, 6 Nov 2024 16:53:45 +0100 Subject: [PATCH 47/56] Minor npm module version bump --- main/http_server/axe-os/package-lock.json | 118 ++++++++++------------ 1 file changed, 56 insertions(+), 62 deletions(-) diff --git a/main/http_server/axe-os/package-lock.json b/main/http_server/axe-os/package-lock.json index 4bd64a1fc..bef7ee0cf 100644 --- a/main/http_server/axe-os/package-lock.json +++ b/main/http_server/axe-os/package-lock.json @@ -73,15 +73,15 @@ } }, "node_modules/@angular-devkit/build-angular": { - "version": "17.3.10", - "resolved": "https://registry.npmjs.org/@angular-devkit/build-angular/-/build-angular-17.3.10.tgz", - "integrity": "sha512-syz7xgzmp8/0tPJWwQIKZt7KNJfp9U7hkqNacXz4XTYz6YM0oyBXlqk2claSxywWBEkc0eJVSMD9e2ArusZBuA==", + "version": "17.3.11", + "resolved": "https://registry.npmjs.org/@angular-devkit/build-angular/-/build-angular-17.3.11.tgz", + "integrity": "sha512-lHX5V2dSts328yvo/9E2u9QMGcvJhbEKKDDp9dBecwvIG9s+4lTOJgi9DPUE7W+AtmPcmbbhwC2JRQ/SLQhAoA==", "dev": true, "dependencies": { "@ampproject/remapping": "2.3.0", - "@angular-devkit/architect": "0.1703.10", - "@angular-devkit/build-webpack": "0.1703.10", - "@angular-devkit/core": "17.3.10", + "@angular-devkit/architect": "0.1703.11", + "@angular-devkit/build-webpack": "0.1703.11", + "@angular-devkit/core": "17.3.11", "@babel/core": "7.24.0", "@babel/generator": "7.23.6", "@babel/helper-annotate-as-pure": "7.22.5", @@ -92,7 +92,7 @@ "@babel/preset-env": "7.24.0", "@babel/runtime": "7.24.0", "@discoveryjs/json-ext": "0.5.7", - "@ngtools/webpack": "17.3.10", + "@ngtools/webpack": "17.3.11", "@vitejs/plugin-basic-ssl": "1.1.0", "ansi-colors": "4.1.3", "autoprefixer": "10.4.18", @@ -104,7 +104,7 @@ "css-loader": "6.10.0", "esbuild-wasm": "0.20.1", "fast-glob": "3.3.2", - "http-proxy-middleware": "2.0.6", + "http-proxy-middleware": "2.0.7", "https-proxy-agent": "7.0.4", "inquirer": "9.2.15", "jsonc-parser": "3.2.1", @@ -202,12 +202,12 @@ } }, "node_modules/@angular-devkit/build-angular/node_modules/@angular-devkit/architect": { - "version": "0.1703.10", - "resolved": "https://registry.npmjs.org/@angular-devkit/architect/-/architect-0.1703.10.tgz", - "integrity": "sha512-wmjx5GspSPprdUGryK5+9vNawbEO7p8h9dxgX3uoeFwPAECcHC+/KK3qPhX2NiGcM6MDsyt25SrbSktJp6PRsA==", + "version": "0.1703.11", + "resolved": "https://registry.npmjs.org/@angular-devkit/architect/-/architect-0.1703.11.tgz", + "integrity": "sha512-YNasVZk4rYdcM6M+KRH8PUBhVyJfqzUYLpO98GgRokW+taIDgifckSlmfDZzQRbw45qiwei1IKCLqcpC8nM5Tw==", "dev": true, "dependencies": { - "@angular-devkit/core": "17.3.10", + "@angular-devkit/core": "17.3.11", "rxjs": "7.8.1" }, "engines": { @@ -217,9 +217,9 @@ } }, "node_modules/@angular-devkit/build-angular/node_modules/@angular-devkit/core": { - "version": "17.3.10", - "resolved": "https://registry.npmjs.org/@angular-devkit/core/-/core-17.3.10.tgz", - "integrity": "sha512-czdl54yxU5DOAGy/uUPNjJruoBDTgwi/V+eOgLNybYhgrc+TsY0f7uJ11yEk/pz5sCov7xIiS7RdRv96waS7vg==", + "version": "17.3.11", + "resolved": "https://registry.npmjs.org/@angular-devkit/core/-/core-17.3.11.tgz", + "integrity": "sha512-vTNDYNsLIWpYk2I969LMQFH29GTsLzxNk/0cLw5q56ARF0v5sIWfHYwGTS88jdDqIpuuettcSczbxeA7EuAmqQ==", "dev": true, "dependencies": { "ajv": "8.12.0", @@ -339,12 +339,12 @@ } }, "node_modules/@angular-devkit/build-webpack": { - "version": "0.1703.10", - "resolved": "https://registry.npmjs.org/@angular-devkit/build-webpack/-/build-webpack-0.1703.10.tgz", - "integrity": "sha512-m6dDgzKLW+c3z9/TUxYmbJEtEhrdYNQ4ogdtAgEYA/FRrKueDU0WztLNr+dVbvwNP99Skovtr8sAQfN6twproQ==", + "version": "0.1703.11", + "resolved": "https://registry.npmjs.org/@angular-devkit/build-webpack/-/build-webpack-0.1703.11.tgz", + "integrity": "sha512-qbCiiHuoVkD7CtLyWoRi/Vzz6nrEztpF5XIyWUcQu67An1VlxbMTE4yoSQiURjCQMnB/JvS1GPVed7wOq3SJ/w==", "dev": true, "dependencies": { - "@angular-devkit/architect": "0.1703.10", + "@angular-devkit/architect": "0.1703.11", "rxjs": "7.8.1" }, "engines": { @@ -358,12 +358,12 @@ } }, "node_modules/@angular-devkit/build-webpack/node_modules/@angular-devkit/architect": { - "version": "0.1703.10", - "resolved": "https://registry.npmjs.org/@angular-devkit/architect/-/architect-0.1703.10.tgz", - "integrity": "sha512-wmjx5GspSPprdUGryK5+9vNawbEO7p8h9dxgX3uoeFwPAECcHC+/KK3qPhX2NiGcM6MDsyt25SrbSktJp6PRsA==", + "version": "0.1703.11", + "resolved": "https://registry.npmjs.org/@angular-devkit/architect/-/architect-0.1703.11.tgz", + "integrity": "sha512-YNasVZk4rYdcM6M+KRH8PUBhVyJfqzUYLpO98GgRokW+taIDgifckSlmfDZzQRbw45qiwei1IKCLqcpC8nM5Tw==", "dev": true, "dependencies": { - "@angular-devkit/core": "17.3.10", + "@angular-devkit/core": "17.3.11", "rxjs": "7.8.1" }, "engines": { @@ -373,9 +373,9 @@ } }, "node_modules/@angular-devkit/build-webpack/node_modules/@angular-devkit/core": { - "version": "17.3.10", - "resolved": "https://registry.npmjs.org/@angular-devkit/core/-/core-17.3.10.tgz", - "integrity": "sha512-czdl54yxU5DOAGy/uUPNjJruoBDTgwi/V+eOgLNybYhgrc+TsY0f7uJ11yEk/pz5sCov7xIiS7RdRv96waS7vg==", + "version": "17.3.11", + "resolved": "https://registry.npmjs.org/@angular-devkit/core/-/core-17.3.11.tgz", + "integrity": "sha512-vTNDYNsLIWpYk2I969LMQFH29GTsLzxNk/0cLw5q56ARF0v5sIWfHYwGTS88jdDqIpuuettcSczbxeA7EuAmqQ==", "dev": true, "dependencies": { "ajv": "8.12.0", @@ -3031,9 +3031,9 @@ } }, "node_modules/@ngtools/webpack": { - "version": "17.3.10", - "resolved": "https://registry.npmjs.org/@ngtools/webpack/-/webpack-17.3.10.tgz", - "integrity": "sha512-yPKmdbTJzxROAl2NS8P8eHB2mU0BqV2I0ZiKmX6oTetY2Ea4i2WzlTK39pPpG7atmdF2NPWYLXdJWAup+JxSyw==", + "version": "17.3.11", + "resolved": "https://registry.npmjs.org/@ngtools/webpack/-/webpack-17.3.11.tgz", + "integrity": "sha512-SfTCbplt4y6ak5cf2IfqdoVOsnoNdh/j6Vu+wb8WWABKwZ5yfr2S/Gk6ithSKcdIZhAF8DNBOoyk1EJuf8Xkfg==", "dev": true, "engines": { "node": "^18.13.0 || >=20.9.0", @@ -3771,9 +3771,9 @@ } }, "node_modules/@types/express-serve-static-core": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-5.0.0.tgz", - "integrity": "sha512-AbXMTZGt40T+KON9/Fdxx0B2WK5hsgxcfXJLr5bFpZ7b4JCex2WyQPTEKdXqfHiY5nKKBScZ7yCoO6Pvgxfvnw==", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-5.0.1.tgz", + "integrity": "sha512-CRICJIl0N5cXDONAdlTv5ShATZ4HEwk6kDDIW2/w9qOWKg+NU/5F8wYRWCrONad0/UKkloNSmmyN/wX4rtpbVA==", "dev": true, "dependencies": { "@types/node": "*", @@ -3846,9 +3846,9 @@ } }, "node_modules/@types/qs": { - "version": "6.9.16", - "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.16.tgz", - "integrity": "sha512-7i+zxXdPD0T4cKDuxCUXJ4wHcsJLwENa6Z3dCu8cfCK743OGy5Nu1RmAGqDPsoTDINVEcdXKRvR/zre+P2Ku1A==", + "version": "6.9.17", + "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.17.tgz", + "integrity": "sha512-rX4/bPcfmvxHDv0XjfJELTTr+iB+tn032nPILqHm5wbthUUUuVtNGGqzhya9XUxjTP8Fpr0qYgSZZKxGY++svQ==", "dev": true }, "node_modules/@types/range-parser": { @@ -3903,9 +3903,9 @@ } }, "node_modules/@types/ws": { - "version": "8.5.12", - "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.12.tgz", - "integrity": "sha512-3tPRkv1EtkDpzlgyKyI8pGsGZAGPEaXeu0DOj5DI25Ja91bdAYddYHbADRYVrZMRbfW+1l5YwXVDKohDJNQxkQ==", + "version": "8.5.13", + "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.13.tgz", + "integrity": "sha512-osM/gWBTPKgHV8XkTunnegTRIsvF6owmf5w+JtAfOw472dptdm0dlGv4xCt6GwQRcC2XVOvvRE/0bAoQcL2QkA==", "dev": true, "dependencies": { "@types/node": "*" @@ -5148,32 +5148,23 @@ } }, "node_modules/compression": { - "version": "1.7.4", - "resolved": "https://registry.npmjs.org/compression/-/compression-1.7.4.tgz", - "integrity": "sha512-jaSIDzP9pZVS4ZfQ+TzvtiWhdpFhE2RDHz8QJkpX9SIpLq88VueF5jJw6t+6CUQcAoA6t+x89MLrWAqpfDE8iQ==", + "version": "1.7.5", + "resolved": "https://registry.npmjs.org/compression/-/compression-1.7.5.tgz", + "integrity": "sha512-bQJ0YRck5ak3LgtnpKkiabX5pNF7tMUh1BSy2ZBOTh0Dim0BUu6aPPwByIns6/A5Prh8PufSPerMDUklpzes2Q==", "dev": true, "dependencies": { - "accepts": "~1.3.5", - "bytes": "3.0.0", - "compressible": "~2.0.16", + "bytes": "3.1.2", + "compressible": "~2.0.18", "debug": "2.6.9", + "negotiator": "~0.6.4", "on-headers": "~1.0.2", - "safe-buffer": "5.1.2", + "safe-buffer": "5.2.1", "vary": "~1.1.2" }, "engines": { "node": ">= 0.8.0" } }, - "node_modules/compression/node_modules/bytes": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz", - "integrity": "sha512-pMhOfFDPiv9t5jjIXkHosWmkSyQbvsgEVNkz0ERHbuLh2T/7j4Mqqpz523Fe8MVY89KC6Sh/QfS2sM+SjgFDcw==", - "dev": true, - "engines": { - "node": ">= 0.8" - } - }, "node_modules/compression/node_modules/debug": { "version": "2.6.9", "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", @@ -5189,11 +5180,14 @@ "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", "dev": true }, - "node_modules/compression/node_modules/safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "dev": true + "node_modules/compression/node_modules/negotiator": { + "version": "0.6.4", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.4.tgz", + "integrity": "sha512-myRT3DiWPHqho5PrJaIRyaMv2kgYf0mUVgBNOYMuCH5Ki1yEiQaf/ZJuQ62nvpc44wL5WDbTX7yGJi1Neevw8w==", + "dev": true, + "engines": { + "node": ">= 0.6" + } }, "node_modules/concat-map": { "version": "0.0.1", @@ -7215,9 +7209,9 @@ } }, "node_modules/http-proxy-middleware": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/http-proxy-middleware/-/http-proxy-middleware-2.0.6.tgz", - "integrity": "sha512-ya/UeJ6HVBYxrgYotAZo1KvPWlgB48kUJLDePFeneHsVujFaW5WNj2NgWCAE//B1Dl02BIfYlpNgBy8Kf8Rjmw==", + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/http-proxy-middleware/-/http-proxy-middleware-2.0.7.tgz", + "integrity": "sha512-fgVY8AV7qU7z/MmXJ/rxwbrtQH4jBQ9m7kp3llF0liB7glmFeVZFBepQb32T3y8n8k2+AEYuMPCpinYW+/CuRA==", "dev": true, "dependencies": { "@types/http-proxy": "^1.17.8", From 3f07e339b08a685222a5361086e93122ceac2e2b Mon Sep 17 00:00:00 2001 From: WantClue Date: Wed, 13 Nov 2024 23:19:58 +0100 Subject: [PATCH 48/56] adjust bm1370 mhz settings to 6.25 multiplier --- .../axe-os/src/app/components/edit/edit.component.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/main/http_server/axe-os/src/app/components/edit/edit.component.ts b/main/http_server/axe-os/src/app/components/edit/edit.component.ts index 0742abd5a..b87de7a97 100644 --- a/main/http_server/axe-os/src/app/components/edit/edit.component.ts +++ b/main/http_server/axe-os/src/app/components/edit/edit.component.ts @@ -74,8 +74,7 @@ export class EditComponent implements OnInit { { name: '490', value: 490 }, { name: '525 (default)', value: 525 }, { name: '575', value: 575 }, - { name: '596', value: 596 }, - { name: '610', value: 610 }, + { name: '600', value: 600 }, { name: '625', value: 625 }, ]; From 3fa8ee5f0890949763f1325fc907ca09e1c2fc8a Mon Sep 17 00:00:00 2001 From: Skot Date: Thu, 14 Nov 2024 18:02:49 -0500 Subject: [PATCH 49/56] added several configs to EMC2101 init --- components/asic/bm1370.c | 5 +++++ main/EMC2101.c | 16 +++++++++++++++- main/EMC2101.h | 5 +++++ main/self_test/self_test.c | 27 +++++++++++++++++++++++++-- 4 files changed, 50 insertions(+), 3 deletions(-) diff --git a/components/asic/bm1370.c b/components/asic/bm1370.c index 7ab12d506..2e61383f8 100644 --- a/components/asic/bm1370.c +++ b/components/asic/bm1370.c @@ -196,6 +196,11 @@ static void do_frequency_ramp_up(float target_frequency) { float current = 56.25; float step = 6.25; + if (target_frequency == 0) { + ESP_LOGI(TAG, "Skipping frequency ramp"); + return; + } + ESP_LOGI(TAG, "Ramping up frequency from %.2f MHz to %.2f MHz with step %.2f MHz", current, target_frequency, step); BM1370_send_hash_frequency(-1, current, 0.001); diff --git a/main/EMC2101.c b/main/EMC2101.c index daf1237ee..992e8c0c6 100644 --- a/main/EMC2101.c +++ b/main/EMC2101.c @@ -29,6 +29,18 @@ esp_err_t EMC2101_init(bool invertPolarity) { ESP_ERROR_CHECK(i2c_bitaxe_register_write_byte(emc2101_dev_handle, EMC2101_FAN_CONFIG, 0b00100011)); } + //set Ideality Factor + ESP_ERROR_CHECK(i2c_bitaxe_register_write_byte(emc2101_dev_handle, EMC2101_IDEALITY_FACTOR, EMC2101_DEFAULT_IDEALITY)); + + //set Beta Compensation + ESP_ERROR_CHECK(i2c_bitaxe_register_write_byte(emc2101_dev_handle, EMC2101_BETA_COMPENSATION, EMC2101_DEFAULT_BETA)); + + //set filtering + ESP_ERROR_CHECK(i2c_bitaxe_register_write_byte(emc2101_dev_handle, EMC2101_TEMP_FILTER, 0x06)); + + //set conversion rate + ESP_ERROR_CHECK(i2c_bitaxe_register_write_byte(emc2101_dev_handle, EMC2101_REG_DATA_RATE, 0x09)); + return ESP_OK; } @@ -86,8 +98,10 @@ float EMC2101_get_external_temp(void) // Greater than 200C is probably an erroneous reading... if (result > 200){ - return EMC2101_get_internal_temp(); + ESP_LOGE(TAG, "EMC2101 Invalid result: %04X", reading); + result = 0; } + return result; } diff --git a/main/EMC2101.h b/main/EMC2101.h index 00c82a471..fbdbcdfba 100644 --- a/main/EMC2101.h +++ b/main/EMC2101.h @@ -3,6 +3,9 @@ #include "i2c_bitaxe.h" +#define EMC2101_DEFAULT_IDEALITY 0x12 ///< Default ideality factor +#define EMC2101_DEFAULT_BETA 0x00 ///< Default beta compensation + #define EMC2101_I2CADDR_DEFAULT 0x4C ///< EMC2101 default i2c address #define EMC2101_CHIP_ID 0x16 ///< EMC2101 default device id from part id #define EMC2101_ALT_CHIP_ID 0x28 ///< EMC2101 alternate device id from part id @@ -18,6 +21,8 @@ #define EMC2101_REG_CONFIG 0x03 ///< configuration register #define EMC2101_REG_DATA_RATE 0x04 ///< Data rate config #define EMC2101_TEMP_FORCE 0x0C ///< Temp force setting for LUT testing +#define EMC2101_IDEALITY_FACTOR 0x17 ///< Beta Compensation Register +#define EMC2101_BETA_COMPENSATION 0x18 ///< Beta Compensation Register #define EMC2101_TACH_LSB 0x46 ///< Tach RPM data low byte #define EMC2101_TACH_MSB 0x47 ///< Tach RPM data high byte #define EMC2101_TACH_LIMIT_LSB 0x48 ///< Tach low-speed setting low byte. INVERSE OF THE SPEED diff --git a/main/self_test/self_test.c b/main/self_test/self_test.c index 89fcc9d5e..59f6659d8 100644 --- a/main/self_test/self_test.c +++ b/main/self_test/self_test.c @@ -18,8 +18,12 @@ #define POWER_CONSUMPTION_TARGET_GAMMA 11 //watts #define POWER_CONSUMPTION_MARGIN 3 //+/- watts +#define TEMP_CAL_LIMIT 1200 + 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); @@ -175,7 +179,7 @@ void self_test(void * pvParameters) } uint8_t result = VCORE_init(GLOBAL_STATE); - VCORE_set_voltage(nvs_config_get_u16(NVS_CONFIG_ASIC_VOLTAGE, CONFIG_ASIC_VOLTAGE) / 1000.0, GLOBAL_STATE); + VCORE_set_voltage(1150 / 1000.0, GLOBAL_STATE); // VCore regulator testing switch (GLOBAL_STATE->device_model) { @@ -222,9 +226,16 @@ void self_test(void * pvParameters) SERIAL_init(); - uint8_t chips_detected = (GLOBAL_STATE->ASIC_functions.init_fn)(GLOBAL_STATE->POWER_MANAGEMENT_MODULE.frequency_value, GLOBAL_STATE->asic_count); + uint8_t chips_detected = (GLOBAL_STATE->ASIC_functions.init_fn)(0, GLOBAL_STATE->asic_count); ESP_LOGI(TAG, "%u chips detected, %u expected", chips_detected, GLOBAL_STATE->asic_count); + //turn off vcore + VCORE_set_voltage(0, GLOBAL_STATE); + //delay 1 second to stabilize + vTaskDelay(1000 / portTICK_PERIOD_MS); + run_temp_cal(); + + int baud = (*GLOBAL_STATE->ASIC_functions.set_max_baud_fn)(); vTaskDelay(10 / portTICK_PERIOD_MS); SERIAL_set_baud(baud); @@ -372,3 +383,15 @@ 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); + } + +} From 71cd360f7b0488bc2071b1cd51cc3fe3cc80c46d Mon Sep 17 00:00:00 2001 From: Skot Date: Thu, 14 Nov 2024 19:55:17 -0500 Subject: [PATCH 50/56] changed back to defaults --- main/EMC2101.c | 4 ++-- main/EMC2101.h | 16 ++++++++++++++-- main/self_test/self_test.c | 17 +++++++++++------ 3 files changed, 27 insertions(+), 10 deletions(-) diff --git a/main/EMC2101.c b/main/EMC2101.c index 992e8c0c6..b941ea814 100644 --- a/main/EMC2101.c +++ b/main/EMC2101.c @@ -36,10 +36,10 @@ esp_err_t EMC2101_init(bool invertPolarity) { ESP_ERROR_CHECK(i2c_bitaxe_register_write_byte(emc2101_dev_handle, EMC2101_BETA_COMPENSATION, EMC2101_DEFAULT_BETA)); //set filtering - ESP_ERROR_CHECK(i2c_bitaxe_register_write_byte(emc2101_dev_handle, EMC2101_TEMP_FILTER, 0x06)); + ESP_ERROR_CHECK(i2c_bitaxe_register_write_byte(emc2101_dev_handle, EMC2101_TEMP_FILTER, EMC2101_DEFAULT_FILTER)); //set conversion rate - ESP_ERROR_CHECK(i2c_bitaxe_register_write_byte(emc2101_dev_handle, EMC2101_REG_DATA_RATE, 0x09)); + ESP_ERROR_CHECK(i2c_bitaxe_register_write_byte(emc2101_dev_handle, EMC2101_REG_DATA_RATE, EMC2101_DEFAULT_DATARATE)); return ESP_OK; diff --git a/main/EMC2101.h b/main/EMC2101.h index fbdbcdfba..fe6a860bc 100644 --- a/main/EMC2101.h +++ b/main/EMC2101.h @@ -3,8 +3,20 @@ #include "i2c_bitaxe.h" -#define EMC2101_DEFAULT_IDEALITY 0x12 ///< Default ideality factor -#define EMC2101_DEFAULT_BETA 0x00 ///< Default beta compensation +#define EMC2101_CPU_BETA_11 0x00 +#define EMC2101_CPU_BETA_18 0x01 +#define EMC2101_CPU_BETA_25 0x02 +#define EMC2101_CPU_BETA_33 0x03 +#define EMC2101_CPU_BETA_43 0x04 +#define EMC2101_CPU_BETA_100 0x05 +#define EMC2101_CPU_BETA_233 0x06 +#define EMC2101_CPU_BETA_DISABLED 0x07 +#define EMC2101_CPU_BETA_AUTO 0x08 + +#define EMC2101_DEFAULT_IDEALITY 0x12 ///< Default ideality factor [1.008 -> 0x12] +#define EMC2101_DEFAULT_BETA EMC2101_CPU_BETA_AUTO ///< Default beta compensation +#define EMC2101_DEFAULT_FILTER 0x06 ///< Default temp filter setting +#define EMC2101_DEFAULT_DATARATE 0x09 ///< Default temp conversion rate #define EMC2101_I2CADDR_DEFAULT 0x4C ///< EMC2101 default i2c address #define EMC2101_CHIP_ID 0x16 ///< EMC2101 default device id from part id diff --git a/main/self_test/self_test.c b/main/self_test/self_test.c index 59f6659d8..30dabe468 100644 --- a/main/self_test/self_test.c +++ b/main/self_test/self_test.c @@ -224,16 +224,21 @@ void self_test(void * pvParameters) default: } + uint8_t chips_detected = 0; + SERIAL_init(); - uint8_t chips_detected = (GLOBAL_STATE->ASIC_functions.init_fn)(0, GLOBAL_STATE->asic_count); + //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); - //turn off vcore - VCORE_set_voltage(0, GLOBAL_STATE); - //delay 1 second to stabilize - vTaskDelay(1000 / portTICK_PERIOD_MS); - run_temp_cal(); + // //turn off vcore + // VCORE_set_voltage(0, GLOBAL_STATE); + // //delay 1 second to stabilize + // vTaskDelay(1000 / portTICK_PERIOD_MS); + + + //run_temp_cal(); int baud = (*GLOBAL_STATE->ASIC_functions.set_max_baud_fn)(); From 26c61f04493ab50936a78cb18fbfe45f76d7b455 Mon Sep 17 00:00:00 2001 From: Skot Date: Fri, 15 Nov 2024 13:30:27 -0500 Subject: [PATCH 51/56] added missing BM1370 init registers --- components/asic/bm1370.c | 48 ++++++++++++++++++++++++-------------- main/EMC2101.h | 39 +++++++++++++++++++++---------- main/self_test/self_test.c | 2 +- 3 files changed, 58 insertions(+), 31 deletions(-) diff --git a/components/asic/bm1370.c b/components/asic/bm1370.c index 2e61383f8..f1c027279 100644 --- a/components/asic/bm1370.c +++ b/components/asic/bm1370.c @@ -111,7 +111,7 @@ static void _send_simple(uint8_t * data, uint8_t total_length) { unsigned char * buf = malloc(total_length); memcpy(buf, data, total_length); - SERIAL_send(buf, total_length, false); + SERIAL_send(buf, total_length, BM1370_SERIALTX_DEBUG); free(buf); } @@ -243,8 +243,8 @@ static uint8_t _send_init(uint64_t frequency, uint16_t asic_count) //Misc Control //**TX: 55 AA 51 09 00 18 F0 00 C1 00 04 //command all chips, write chip address 00, register 18, data F0 00 C1 00 - Misc Control - //unsigned char init6[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x18, 0xF0, 0x00, 0xC1, 0x00, 0x04}; //from S21Pro dump - unsigned char init6[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x18, 0xFF, 0x0F, 0xC1, 0x00, 0x00}; + unsigned char init6[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x18, 0xF0, 0x00, 0xC1, 0x00, 0x04}; //from S21Pro dump + //unsigned char init6[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x18, 0xFF, 0x0F, 0xC1, 0x00, 0x00}; _send_simple(init6, 11); //chain inactive @@ -266,8 +266,8 @@ static uint8_t _send_init(uint64_t frequency, uint16_t asic_count) //Core Register Control //**TX: 55 AA 51 09 00 3C 80 00 80 0C 11 //command all chips, write chip address 00, register 3C, data 80 00 80 0C - Core Register Control - //unsigned char init10[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x3C, 0x80, 0x00, 0x80, 0x0C, 0x11}; //from S21Pro dump - unsigned char init10[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x3C, 0x80, 0x00, 0x80, 0x18, 0x1F}; + unsigned char init10[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x3C, 0x80, 0x00, 0x80, 0x0C, 0x11}; //from S21Pro dump + //unsigned char init10[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x3C, 0x80, 0x00, 0x80, 0x18, 0x1F}; _send_simple(init10, 11); //set ticket mask @@ -275,35 +275,47 @@ static uint8_t _send_init(uint64_t frequency, uint16_t asic_count) // _send_simple(init11, 11); BM1370_set_job_difficulty_mask(BM1370_ASIC_DIFFICULTY); - //Analog Mux Control - unsigned char init12[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x54, 0x00, 0x00, 0x00, 0x03, 0x1D}; - _send_simple(init12, 11); + //Analog Mux Control -- not sent on S21 Pro? + // unsigned char init12[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x54, 0x00, 0x00, 0x00, 0x03, 0x1D}; + // _send_simple(init12, 11); //Set the IO Driver Strength on chip 00 - //**TX: 55 AA 51 09 00 58 00 01 11 11 0D //command all chips, write chip address 00, register 58, data 01 11 11 11 - Set the IO Driver Strength on chip 00 - //unsigned char init13[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x58, 0x00, 0x01, 0x11, 0x11, 0x0D}; //from S21Pro dump - unsigned char init13[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x58, 0x02, 0x11, 0x11, 0x11, 0x06}; + //TX: 55 AA 51 09 00 58 00 01 11 11 0D //command all chips, write chip address 00, register 58, data 01 11 11 11 - Set the IO Driver Strength on chip 00 + unsigned char init13[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x58, 0x00, 0x01, 0x11, 0x11, 0x0D}; //from S21Pro dump + //unsigned char init13[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x58, 0x02, 0x11, 0x11, 0x11, 0x06}; _send_simple(init13, 11); for (uint8_t i = 0; i < chip_counter; i++) { - //Reg_A8 + //TX: 55 AA 41 09 00 [A8 00 07 01 F0] 15 // Reg_A8 unsigned char set_a8_register[6] = {i * address_interval, 0xA8, 0x00, 0x07, 0x01, 0xF0}; _send_BM1370((TYPE_CMD | GROUP_SINGLE | CMD_WRITE), set_a8_register, 6, BM1370_SERIALTX_DEBUG); - //Misc Control + //TX: 55 AA 41 09 00 [18 F0 00 C1 00] 0C // Misc Control unsigned char set_18_register[6] = {i * address_interval, 0x18, 0xF0, 0x00, 0xC1, 0x00}; _send_BM1370((TYPE_CMD | GROUP_SINGLE | CMD_WRITE), set_18_register, 6, BM1370_SERIALTX_DEBUG); - //Core Register Control + //TX: 55 AA 41 09 00 [3C 80 00 8B 00] 1A // Core Register Control unsigned char set_3c_register_first[6] = {i * address_interval, 0x3C, 0x80, 0x00, 0x8B, 0x00}; _send_BM1370((TYPE_CMD | GROUP_SINGLE | CMD_WRITE), set_3c_register_first, 6, BM1370_SERIALTX_DEBUG); - //Core Register Control - //unsigned char set_3c_register_second[6] = {i * address_interval, 0x3C, 0x80, 0x00, 0x80, 0x0C}; //from S21Pro dump - unsigned char set_3c_register_second[6] = {i * address_interval, 0x3C, 0x80, 0x00, 0x80, 0x18}; + //TX: 55 AA 41 09 00 [3C 80 00 80 0C] 19 // Core Register Control + unsigned char set_3c_register_second[6] = {i * address_interval, 0x3C, 0x80, 0x00, 0x80, 0x0C}; _send_BM1370((TYPE_CMD | GROUP_SINGLE | CMD_WRITE), set_3c_register_second, 6, BM1370_SERIALTX_DEBUG); - //Core Register Control + //TX: 55 AA 41 09 00 [3C 80 00 82 AA] 05 // Core Register Control unsigned char set_3c_register_third[6] = {i * address_interval, 0x3C, 0x80, 0x00, 0x82, 0xAA}; _send_BM1370((TYPE_CMD | GROUP_SINGLE | CMD_WRITE), set_3c_register_third, 6, BM1370_SERIALTX_DEBUG); } + //Some misc settings? + // TX: 55 AA 51 09 00 B9 00 00 44 80 0D //command all chips, write chip address 00, register B9, data 00 00 44 80 + unsigned char init14[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0xB9, 0x00, 0x00, 0x44, 0x80, 0x0D}; + _send_simple(init14, 11); + // TX: 55 AA 51 09 00 [54 00 00 00 02] 18 //command all chips, write chip address 00, register 54, data 00 00 00 02 - Analog Mux Control - S21 does this earlier on + _send_BM1370((TYPE_CMD | GROUP_ALL | CMD_WRITE), (uint8_t[]){0x54, 0x00, 0x00, 0x00, 0x02}, 6, BM1370_SERIALTX_DEBUG); + // TX: 55 AA 51 09 00 B9 00 00 44 80 0D //command all chips, write chip address 00, register B9, data 00 00 44 80 -- duplicate of first command in series + unsigned char init16[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0xB9, 0x00, 0x00, 0x44, 0x80, 0x0D}; + _send_simple(init16, 11); + // TX: 55 AA 51 09 00 3C 80 00 8D EE 1B //command all chips, write chip address 00, register 3C, data 80 00 8D EE + unsigned char init17[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x3C, 0x80, 0x00, 0x8D, 0xEE, 0x1B}; + _send_simple(init17, 11); + do_frequency_ramp_up(frequency); //BM1370_send_hash_frequency(frequency); diff --git a/main/EMC2101.h b/main/EMC2101.h index fe6a860bc..8b423cb17 100644 --- a/main/EMC2101.h +++ b/main/EMC2101.h @@ -3,20 +3,35 @@ #include "i2c_bitaxe.h" -#define EMC2101_CPU_BETA_11 0x00 -#define EMC2101_CPU_BETA_18 0x01 -#define EMC2101_CPU_BETA_25 0x02 -#define EMC2101_CPU_BETA_33 0x03 -#define EMC2101_CPU_BETA_43 0x04 -#define EMC2101_CPU_BETA_100 0x05 -#define EMC2101_CPU_BETA_233 0x06 -#define EMC2101_CPU_BETA_DISABLED 0x07 -#define EMC2101_CPU_BETA_AUTO 0x08 +#define EMC2101_BETA_11 0x00 +#define EMC2101_BETA_18 0x01 +#define EMC2101_BETA_25 0x02 +#define EMC2101_BETA_33 0x03 +#define EMC2101_BETA_43 0x04 +#define EMC2101_BETA_100 0x05 +#define EMC2101_BETA_233 0x06 +#define EMC2101_BETA_DISABLED 0x07 +#define EMC2101_BETA_AUTO 0x08 + +#define EMC2101_FILTER_DISABLED 0x00 +#define EMC2101_FILTER_1 0x01 +#define EMC2101_FILTER_2 0x02 + +#define EMC2101_DATARATE_1_16_HZ 0x00 +#define EMC2101_DATARATE_1_8_HZ 0x01 +#define EMC2101_DATARATE_1_4_HZ 0x02 +#define EMC2101_DATARATE_1_2_HZ 0x03 +#define EMC2101_DATARATE_1_HZ 0x04 +#define EMC2101_DATARATE_2_HZ 0x05 +#define EMC2101_DATARATE_4_HZ 0x06 +#define EMC2101_DATARATE_8_HZ 0x07 +#define EMC2101_DATARATE_16_HZ 0x08 //default +#define EMC2101_DATARATE_32_HZ 0x09 #define EMC2101_DEFAULT_IDEALITY 0x12 ///< Default ideality factor [1.008 -> 0x12] -#define EMC2101_DEFAULT_BETA EMC2101_CPU_BETA_AUTO ///< Default beta compensation -#define EMC2101_DEFAULT_FILTER 0x06 ///< Default temp filter setting -#define EMC2101_DEFAULT_DATARATE 0x09 ///< Default temp conversion rate +#define EMC2101_DEFAULT_BETA EMC2101_BETA_AUTO ///< Default beta compensation +#define EMC2101_DEFAULT_FILTER EMC2101_FILTER_DISABLED ///< Default temp filter setting +#define EMC2101_DEFAULT_DATARATE EMC2101_DATARATE_16_HZ ///< Default temp conversion rate #define EMC2101_I2CADDR_DEFAULT 0x4C ///< EMC2101 default i2c address #define EMC2101_CHIP_ID 0x16 ///< EMC2101 default device id from part id diff --git a/main/self_test/self_test.c b/main/self_test/self_test.c index 30dabe468..1dd00e0ac 100644 --- a/main/self_test/self_test.c +++ b/main/self_test/self_test.c @@ -238,7 +238,7 @@ void self_test(void * pvParameters) // vTaskDelay(1000 / portTICK_PERIOD_MS); - //run_temp_cal(); + run_temp_cal(); int baud = (*GLOBAL_STATE->ASIC_functions.set_max_baud_fn)(); From 680297177a83e256ee5a6969dbfcdcf92c0c5f89 Mon Sep 17 00:00:00 2001 From: Skot Date: Fri, 15 Nov 2024 14:23:58 -0500 Subject: [PATCH 52/56] typo in BM1370 init misc bytes --- components/asic/bm1370.c | 23 ++++++++++------------- main/EMC2101.h | 2 +- main/self_test/self_test.c | 2 +- 3 files changed, 12 insertions(+), 15 deletions(-) diff --git a/components/asic/bm1370.c b/components/asic/bm1370.c index f1c027279..8831cd797 100644 --- a/components/asic/bm1370.c +++ b/components/asic/bm1370.c @@ -242,7 +242,7 @@ static uint8_t _send_init(uint64_t frequency, uint16_t asic_count) _send_simple(init5, 11); //Misc Control - //**TX: 55 AA 51 09 00 18 F0 00 C1 00 04 //command all chips, write chip address 00, register 18, data F0 00 C1 00 - Misc Control + //TX: 55 AA 51 09 00 18 F0 00 C1 00 04 //command all chips, write chip address 00, register 18, data F0 00 C1 00 - Misc Control unsigned char init6[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x18, 0xF0, 0x00, 0xC1, 0x00, 0x04}; //from S21Pro dump //unsigned char init6[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x18, 0xFF, 0x0F, 0xC1, 0x00, 0x00}; _send_simple(init6, 11); @@ -265,7 +265,7 @@ static uint8_t _send_init(uint64_t frequency, uint16_t asic_count) _send_simple(init9, 11); //Core Register Control - //**TX: 55 AA 51 09 00 3C 80 00 80 0C 11 //command all chips, write chip address 00, register 3C, data 80 00 80 0C - Core Register Control + //TX: 55 AA 51 09 00 3C 80 00 80 0C 11 //command all chips, write chip address 00, register 3C, data 80 00 80 0C - Core Register Control unsigned char init10[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x3C, 0x80, 0x00, 0x80, 0x0C, 0x11}; //from S21Pro dump //unsigned char init10[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x3C, 0x80, 0x00, 0x80, 0x18, 0x1F}; _send_simple(init10, 11); @@ -304,17 +304,14 @@ static uint8_t _send_init(uint64_t frequency, uint16_t asic_count) } //Some misc settings? - // TX: 55 AA 51 09 00 B9 00 00 44 80 0D //command all chips, write chip address 00, register B9, data 00 00 44 80 - unsigned char init14[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0xB9, 0x00, 0x00, 0x44, 0x80, 0x0D}; - _send_simple(init14, 11); - // TX: 55 AA 51 09 00 [54 00 00 00 02] 18 //command all chips, write chip address 00, register 54, data 00 00 00 02 - Analog Mux Control - S21 does this earlier on - _send_BM1370((TYPE_CMD | GROUP_ALL | CMD_WRITE), (uint8_t[]){0x54, 0x00, 0x00, 0x00, 0x02}, 6, BM1370_SERIALTX_DEBUG); - // TX: 55 AA 51 09 00 B9 00 00 44 80 0D //command all chips, write chip address 00, register B9, data 00 00 44 80 -- duplicate of first command in series - unsigned char init16[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0xB9, 0x00, 0x00, 0x44, 0x80, 0x0D}; - _send_simple(init16, 11); - // TX: 55 AA 51 09 00 3C 80 00 8D EE 1B //command all chips, write chip address 00, register 3C, data 80 00 8D EE - unsigned char init17[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x3C, 0x80, 0x00, 0x8D, 0xEE, 0x1B}; - _send_simple(init17, 11); + // TX: 55 AA 51 09 [00 B9 00 00 44 80] 0D //command all chips, write chip address 00, register B9, data 00 00 44 80 + _send_BM1370((TYPE_CMD | GROUP_ALL | CMD_WRITE), (uint8_t[]){0x00, 0xB9, 0x00, 0x00, 0x44, 0x80}, 6, BM1370_SERIALTX_DEBUG); + // TX: 55 AA 51 09 [00 54 00 00 00 02] 18 //command all chips, write chip address 00, register 54, data 00 00 00 02 - Analog Mux Control - S21 does this earlier on + _send_BM1370((TYPE_CMD | GROUP_ALL | CMD_WRITE), (uint8_t[]){0x00, 0x54, 0x00, 0x00, 0x00, 0x02}, 6, BM1370_SERIALTX_DEBUG); + // TX: 55 AA 51 09 [00 B9 00 00 44 80] 0D //command all chips, write chip address 00, register B9, data 00 00 44 80 -- duplicate of first command in series + _send_BM1370((TYPE_CMD | GROUP_ALL | CMD_WRITE), (uint8_t[]){0x00, 0xB9, 0x00, 0x00, 0x44, 0x80}, 6, BM1370_SERIALTX_DEBUG); + // TX: 55 AA 51 09 [00 3C 80 00 8D EE] 1B //command all chips, write chip address 00, register 3C, data 80 00 8D EE + _send_BM1370((TYPE_CMD | GROUP_ALL | CMD_WRITE), (uint8_t[]){0x00, 0x3C, 0x80, 0x00, 0x8D, 0xEE}, 6, BM1370_SERIALTX_DEBUG); do_frequency_ramp_up(frequency); diff --git a/main/EMC2101.h b/main/EMC2101.h index 8b423cb17..7931a1e22 100644 --- a/main/EMC2101.h +++ b/main/EMC2101.h @@ -30,7 +30,7 @@ #define EMC2101_DEFAULT_IDEALITY 0x12 ///< Default ideality factor [1.008 -> 0x12] #define EMC2101_DEFAULT_BETA EMC2101_BETA_AUTO ///< Default beta compensation -#define EMC2101_DEFAULT_FILTER EMC2101_FILTER_DISABLED ///< Default temp filter setting +#define EMC2101_DEFAULT_FILTER EMC2101_FILTER_DISABLED ///< Default temp filter setting #define EMC2101_DEFAULT_DATARATE EMC2101_DATARATE_16_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 1dd00e0ac..e575cc40e 100644 --- a/main/self_test/self_test.c +++ b/main/self_test/self_test.c @@ -238,7 +238,7 @@ void self_test(void * pvParameters) // vTaskDelay(1000 / portTICK_PERIOD_MS); - run_temp_cal(); + // run_temp_cal(); int baud = (*GLOBAL_STATE->ASIC_functions.set_max_baud_fn)(); From 83c118f2dcee8c7702f528b0cf77f53f6a57e309 Mon Sep 17 00:00:00 2001 From: Skot Date: Fri, 15 Nov 2024 16:44:13 -0500 Subject: [PATCH 53/56] added emc2101 ideality defines --- components/asic/bm1368.c | 2 +- components/asic/bm1370.c | 5 ++-- main/EMC2101.h | 57 +++++++++++++++++++++++++++++++++++--- main/self_test/self_test.c | 2 +- 4 files changed, 57 insertions(+), 9 deletions(-) diff --git a/components/asic/bm1368.c b/components/asic/bm1368.c index 12ec8c4a5..802a70dfb 100644 --- a/components/asic/bm1368.c +++ b/components/asic/bm1368.c @@ -265,7 +265,7 @@ uint8_t BM1368_init(uint64_t frequency, uint16_t asic_count) {0x00, 0x3C, 0x80, 0x00, 0x8b, 0x00}, {0x00, 0x3C, 0x80, 0x00, 0x80, 0x18}, {0x00, 0x14, 0x00, 0x00, 0x00, 0xFF}, - {0x00, 0x54, 0x00, 0x00, 0x00, 0x03}, + {0x00, 0x54, 0x00, 0x00, 0x00, 0x03}, //Analog Mux {0x00, 0x58, 0x02, 0x11, 0x11, 0x11} }; diff --git a/components/asic/bm1370.c b/components/asic/bm1370.c index 8831cd797..d94563137 100644 --- a/components/asic/bm1370.c +++ b/components/asic/bm1370.c @@ -306,17 +306,16 @@ static uint8_t _send_init(uint64_t frequency, uint16_t asic_count) //Some misc settings? // TX: 55 AA 51 09 [00 B9 00 00 44 80] 0D //command all chips, write chip address 00, register B9, data 00 00 44 80 _send_BM1370((TYPE_CMD | GROUP_ALL | CMD_WRITE), (uint8_t[]){0x00, 0xB9, 0x00, 0x00, 0x44, 0x80}, 6, BM1370_SERIALTX_DEBUG); - // TX: 55 AA 51 09 [00 54 00 00 00 02] 18 //command all chips, write chip address 00, register 54, data 00 00 00 02 - Analog Mux Control - S21 does this earlier on + // TX: 55 AA 51 09 [00 54 00 00 00 02] 18 //command all chips, write chip address 00, register 54, data 00 00 00 02 - Analog Mux Control - rumored to control the temp diode _send_BM1370((TYPE_CMD | GROUP_ALL | CMD_WRITE), (uint8_t[]){0x00, 0x54, 0x00, 0x00, 0x00, 0x02}, 6, BM1370_SERIALTX_DEBUG); // TX: 55 AA 51 09 [00 B9 00 00 44 80] 0D //command all chips, write chip address 00, register B9, data 00 00 44 80 -- duplicate of first command in series _send_BM1370((TYPE_CMD | GROUP_ALL | CMD_WRITE), (uint8_t[]){0x00, 0xB9, 0x00, 0x00, 0x44, 0x80}, 6, BM1370_SERIALTX_DEBUG); // TX: 55 AA 51 09 [00 3C 80 00 8D EE] 1B //command all chips, write chip address 00, register 3C, data 80 00 8D EE _send_BM1370((TYPE_CMD | GROUP_ALL | CMD_WRITE), (uint8_t[]){0x00, 0x3C, 0x80, 0x00, 0x8D, 0xEE}, 6, BM1370_SERIALTX_DEBUG); + //ramp up the hash frequency do_frequency_ramp_up(frequency); - //BM1370_send_hash_frequency(frequency); - //register 10 is still a bit of a mystery. discussion: https://github.com/skot/ESP-Miner/pull/167 // unsigned char set_10_hash_counting[6] = {0x00, 0x10, 0x00, 0x00, 0x11, 0x5A}; //S19k Pro Default diff --git a/main/EMC2101.h b/main/EMC2101.h index 7931a1e22..2b470e702 100644 --- a/main/EMC2101.h +++ b/main/EMC2101.h @@ -28,10 +28,59 @@ #define EMC2101_DATARATE_16_HZ 0x08 //default #define EMC2101_DATARATE_32_HZ 0x09 -#define EMC2101_DEFAULT_IDEALITY 0x12 ///< Default ideality factor [1.008 -> 0x12] -#define EMC2101_DEFAULT_BETA EMC2101_BETA_AUTO ///< Default beta compensation -#define EMC2101_DEFAULT_FILTER EMC2101_FILTER_DISABLED ///< Default temp filter setting -#define EMC2101_DEFAULT_DATARATE EMC2101_DATARATE_16_HZ ///< Default temp conversion rate +#define EMC2101_IDEALITY_0_9949 0x08 +#define EMC2101_IDEALITY_0_9962 0x09 +#define EMC2101_IDEALITY_0_9975 0x0A +#define EMC2101_IDEALITY_0_9988 0x0B +#define EMC2101_IDEALITY_1_0001 0x0C +#define EMC2101_IDEALITY_1_0014 0x0D +#define EMC2101_IDEALITY_1_0027 0x0E +#define EMC2101_IDEALITY_1_0040 0x0F +#define EMC2101_IDEALITY_1_0053 0x10 +#define EMC2101_IDEALITY_1_0066 0x11 +#define EMC2101_IDEALITY_1_0080 0x12 //default +#define EMC2101_IDEALITY_1_0093 0x13 +#define EMC2101_IDEALITY_1_0106 0x14 +#define EMC2101_IDEALITY_1_0119 0x15 +#define EMC2101_IDEALITY_1_0133 0x16 +#define EMC2101_IDEALITY_1_0146 0x17 +#define EMC2101_IDEALITY_1_0159 0x18 +#define EMC2101_IDEALITY_1_0172 0x19 +#define EMC2101_IDEALITY_1_0185 0x1A +#define EMC2101_IDEALITY_1_0200 0x1B +#define EMC2101_IDEALITY_1_0212 0x1C +#define EMC2101_IDEALITY_1_0226 0x1D +#define EMC2101_IDEALITY_1_0239 0x1E +#define EMC2101_IDEALITY_1_0253 0x1F +#define EMC2101_IDEALITY_1_0267 0x20 +#define EMC2101_IDEALITY_1_0280 0x21 +#define EMC2101_IDEALITY_1_0293 0x22 +#define EMC2101_IDEALITY_1_0306 0x23 +#define EMC2101_IDEALITY_1_0319 0x24 +#define EMC2101_IDEALITY_1_0332 0x25 +#define EMC2101_IDEALITY_1_0345 0x26 +#define EMC2101_IDEALITY_1_0358 0x27 +#define EMC2101_IDEALITY_1_0371 0x28 +#define EMC2101_IDEALITY_1_0384 0x29 +#define EMC2101_IDEALITY_1_0397 0x2A +#define EMC2101_IDEALITY_1_0410 0x2B +#define EMC2101_IDEALITY_1_0423 0x2C +#define EMC2101_IDEALITY_1_0436 0x2D +#define EMC2101_IDEALITY_1_0449 0x2E +#define EMC2101_IDEALITY_1_0462 0x2F +#define EMC2101_IDEALITY_1_0475 0x30 +#define EMC2101_IDEALITY_1_0488 0x31 +#define EMC2101_IDEALITY_1_0501 0x32 +#define EMC2101_IDEALITY_1_0514 0x33 +#define EMC2101_IDEALITY_1_0527 0x34 +#define EMC2101_IDEALITY_1_0540 0x35 +#define EMC2101_IDEALITY_1_0553 0x36 +#define EMC2101_IDEALITY_1_0566 0x37 + +#define EMC2101_DEFAULT_IDEALITY EMC2101_IDEALITY_1_0306 ///< Default ideality factor +#define EMC2101_DEFAULT_BETA EMC2101_BETA_AUTO ///< 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 #define EMC2101_CHIP_ID 0x16 ///< EMC2101 default device id from part id diff --git a/main/self_test/self_test.c b/main/self_test/self_test.c index e575cc40e..1dd00e0ac 100644 --- a/main/self_test/self_test.c +++ b/main/self_test/self_test.c @@ -238,7 +238,7 @@ void self_test(void * pvParameters) // vTaskDelay(1000 / portTICK_PERIOD_MS); - // run_temp_cal(); + run_temp_cal(); int baud = (*GLOBAL_STATE->ASIC_functions.set_max_baud_fn)(); From 7ace35a4e9148f162d9e71a8d92fbc10e895c484 Mon Sep 17 00:00:00 2001 From: Skot Date: Fri, 15 Nov 2024 17:18:28 -0500 Subject: [PATCH 54/56] set EMC2101 filter1, sample 32, max ideality. cleaned up serial packets in BM1370.c --- components/asic/bm1370.c | 31 ++++++++++++++----------------- main/EMC2101.h | 2 +- main/self_test/self_test.c | 23 +++++++++++------------ 3 files changed, 26 insertions(+), 30 deletions(-) diff --git a/components/asic/bm1370.c b/components/asic/bm1370.c index d94563137..05bc06788 100644 --- a/components/asic/bm1370.c +++ b/components/asic/bm1370.c @@ -238,14 +238,13 @@ static uint8_t _send_init(uint64_t frequency, uint16_t asic_count) BM1370_set_version_mask(STRATUM_DEFAULT_VERSION_MASK); //Reg_A8 - unsigned char init5[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0xA8, 0x00, 0x07, 0x00, 0x00, 0x03}; - _send_simple(init5, 11); + //unsigned char init5[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0xA8, 0x00, 0x07, 0x00, 0x00, 0x03}; + _send_BM1370((TYPE_CMD | GROUP_ALL | CMD_WRITE), (uint8_t[]){0x00, 0xA8, 0x00, 0x07, 0x00, 0x00}, 6, BM1370_SERIALTX_DEBUG); //Misc Control - //TX: 55 AA 51 09 00 18 F0 00 C1 00 04 //command all chips, write chip address 00, register 18, data F0 00 C1 00 - Misc Control - unsigned char init6[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x18, 0xF0, 0x00, 0xC1, 0x00, 0x04}; //from S21Pro dump - //unsigned char init6[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x18, 0xFF, 0x0F, 0xC1, 0x00, 0x00}; - _send_simple(init6, 11); + //TX: 55 AA 51 09 [00 18 F0 00 C1 00] 04 //command all chips, write chip address 00, register 18, data F0 00 C1 00 - Misc Control + _send_BM1370((TYPE_CMD | GROUP_ALL | CMD_WRITE), (uint8_t[]){0x00, 0x18, 0xF0, 0x00, 0xC1, 0x00}, 6, BM1370_SERIALTX_DEBUG); //from S21Pro dump + //_send_BM1370((TYPE_CMD | GROUP_ALL | CMD_WRITE), (uint8_t[]){0x00, 0x18, 0xFF, 0x0F, 0xC1, 0x00}, 6, BM1370_SERIALTX_DEBUG); //from S21 dump //chain inactive _send_chain_inactive(); @@ -261,18 +260,16 @@ static uint8_t _send_init(uint64_t frequency, uint16_t asic_count) } //Core Register Control - unsigned char init9[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x3C, 0x80, 0x00, 0x8B, 0x00, 0x12}; - _send_simple(init9, 11); + //unsigned char init9[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x3C, 0x80, 0x00, 0x8B, 0x00, 0x12}; + _send_BM1370((TYPE_CMD | GROUP_ALL | CMD_WRITE), (uint8_t[]){0x00, 0x3C, 0x80, 0x00, 0x8B, 0x00}, 6, BM1370_SERIALTX_DEBUG); //Core Register Control - //TX: 55 AA 51 09 00 3C 80 00 80 0C 11 //command all chips, write chip address 00, register 3C, data 80 00 80 0C - Core Register Control - unsigned char init10[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x3C, 0x80, 0x00, 0x80, 0x0C, 0x11}; //from S21Pro dump - //unsigned char init10[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x3C, 0x80, 0x00, 0x80, 0x18, 0x1F}; - _send_simple(init10, 11); + //TX: 55 AA 51 09 [00 3C 80 00 80 0C] 11 //command all chips, write chip address 00, register 3C, data 80 00 80 0C - Core Register Control + _send_BM1370((TYPE_CMD | GROUP_ALL | CMD_WRITE), (uint8_t[]){0x00, 0x3C, 0x80, 0x00, 0x80, 0x0C}, 6, BM1370_SERIALTX_DEBUG); //from S21Pro dump + //_send_BM1370((TYPE_CMD | GROUP_ALL | CMD_WRITE), (uint8_t[]){0x00, 0x3C, 0x80, 0x00, 0x80, 0x18}, 6, BM1370_SERIALTX_DEBUG); //from S21 dump //set ticket mask // unsigned char init11[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x14, 0x00, 0x00, 0x00, 0xFF, 0x08}; - // _send_simple(init11, 11); BM1370_set_job_difficulty_mask(BM1370_ASIC_DIFFICULTY); //Analog Mux Control -- not sent on S21 Pro? @@ -280,10 +277,10 @@ static uint8_t _send_init(uint64_t frequency, uint16_t asic_count) // _send_simple(init12, 11); //Set the IO Driver Strength on chip 00 - //TX: 55 AA 51 09 00 58 00 01 11 11 0D //command all chips, write chip address 00, register 58, data 01 11 11 11 - Set the IO Driver Strength on chip 00 - unsigned char init13[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x58, 0x00, 0x01, 0x11, 0x11, 0x0D}; //from S21Pro dump - //unsigned char init13[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0x58, 0x02, 0x11, 0x11, 0x11, 0x06}; - _send_simple(init13, 11); + //TX: 55 AA 51 09 [00 58 00 01 11 11] 0D //command all chips, write chip address 00, register 58, data 01 11 11 11 - Set the IO Driver Strength on chip 00 + _send_BM1370((TYPE_CMD | GROUP_ALL | CMD_WRITE), (uint8_t[]){0x00, 0x58, 0x00, 0x01, 0x11, 0x11}, 6, BM1370_SERIALTX_DEBUG); //from S21Pro dump + //_send_BM1370((TYPE_CMD | GROUP_ALL | CMD_WRITE), (uint8_t[]){0x00, 0x58, 0x02, 0x11, 0x11, 0x11}, 6, BM1370_SERIALTX_DEBUG); //from S21Pro dump + for (uint8_t i = 0; i < chip_counter; i++) { //TX: 55 AA 41 09 00 [A8 00 07 01 F0] 15 // Reg_A8 diff --git a/main/EMC2101.h b/main/EMC2101.h index 2b470e702..cef6718ff 100644 --- a/main/EMC2101.h +++ b/main/EMC2101.h @@ -77,7 +77,7 @@ #define EMC2101_IDEALITY_1_0553 0x36 #define EMC2101_IDEALITY_1_0566 0x37 -#define EMC2101_DEFAULT_IDEALITY EMC2101_IDEALITY_1_0306 ///< Default ideality factor +#define EMC2101_DEFAULT_IDEALITY EMC2101_IDEALITY_1_0566 ///< Default ideality factor #define EMC2101_DEFAULT_BETA EMC2101_BETA_AUTO ///< 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 diff --git a/main/self_test/self_test.c b/main/self_test/self_test.c index 1dd00e0ac..68bf2facf 100644 --- a/main/self_test/self_test.c +++ b/main/self_test/self_test.c @@ -232,13 +232,12 @@ void self_test(void * pvParameters) 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(); + // run_temp_cal(); int baud = (*GLOBAL_STATE->ASIC_functions.set_max_baud_fn)(); @@ -389,14 +388,14 @@ void self_test(void * pvParameters) } } -static void run_temp_cal(void) { - float external = 0, internal = 0; +// 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); - } +// 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); +// } -} +// } From 121d3a620bda684cb9b7cafeea6a1b4b2e24cfbc Mon Sep 17 00:00:00 2001 From: Skot Date: Fri, 15 Nov 2024 17:30:04 -0500 Subject: [PATCH 55/56] changed to Ben's Beta and Ideality values --- main/EMC2101.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main/EMC2101.h b/main/EMC2101.h index cef6718ff..f5dc94741 100644 --- a/main/EMC2101.h +++ b/main/EMC2101.h @@ -77,8 +77,8 @@ #define EMC2101_IDEALITY_1_0553 0x36 #define EMC2101_IDEALITY_1_0566 0x37 -#define EMC2101_DEFAULT_IDEALITY EMC2101_IDEALITY_1_0566 ///< Default ideality factor -#define EMC2101_DEFAULT_BETA EMC2101_BETA_AUTO ///< Default beta compensation +#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_DATARATE EMC2101_DATARATE_32_HZ ///< Default temp conversion rate From 9b0cfac938d5ccfc69664977c8255a3e9fd9db45 Mon Sep 17 00:00:00 2001 From: Skot Date: Fri, 15 Nov 2024 21:06:34 -0500 Subject: [PATCH 56/56] cleanup self_test.c --- main/EMC2101.h | 4 ++-- main/self_test/self_test.c | 43 ++++++++++++++++++-------------------- 2 files changed, 22 insertions(+), 25 deletions(-) diff --git a/main/EMC2101.h b/main/EMC2101.h index f5dc94741..305255561 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 68bf2facf..e2ac62c6b 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); -// } - -// }
IP Hash RateAccepted Power TempBest DifficultyBest Diff Version Edit Restart{{axe.hashRate * 1000000000 | hashSuffix}} {{axe.uptimeSeconds | dateAgo}} {{axe.sharesAccepted | number: '1.0-0'}}{{axe.power | number: '1.2-2'}} W {{axe.temp}}°C{{axe.power | number: '1.1-1'}} W {{axe.temp | number: '1.0-1'}}°C {{axe.bestDiff}} {{axe.version}}
URL: - {{info.stratumURL}}
{{axe.IP}} + {{axe.IP}} +
{{axe.hostname}}
+
{{axe.hashRate * 1000000000 | hashSuffix}} {{axe.uptimeSeconds | dateAgo}} {{axe.sharesAccepted | number: '1.0-0'}}{{axe.uptimeSeconds | dateAgo}} {{axe.sharesAccepted | number: '1.0-0'}} {{axe.power | number: '1.1-1'}} W {{axe.temp | number: '1.0-1'}}°C{{axe.temp | number: '1.0-1'}}°C {{axe.bestDiff}} {{axe.version}}