Skip to content

Commit

Permalink
No need to wait for everything
Browse files Browse the repository at this point in the history
  • Loading branch information
eandersson committed Nov 9, 2024
1 parent 8f31d4c commit dc4afcd
Show file tree
Hide file tree
Showing 6 changed files with 70 additions and 68 deletions.
32 changes: 16 additions & 16 deletions components/asic/bm1366.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ static task_result result;
/// @param header
/// @param data
/// @param len
static void _send_BM1366(uint8_t header, uint8_t * data, uint8_t data_len, bool debug)
static void _send_BM1366(uint8_t header, uint8_t * data, uint8_t data_len, bool debug, bool wait)
{
packet_type_t packet_type = (header & TYPE_JOB) ? JOB_PACKET : CMD_PACKET;
uint8_t total_length = (packet_type == JOB_PACKET) ? (data_len + 6) : (data_len + 5);
Expand Down Expand Up @@ -98,7 +98,7 @@ static void _send_BM1366(uint8_t header, uint8_t * data, uint8_t data_len, bool
}

// send serial data
SERIAL_send(buf, total_length, debug);
SERIAL_send(buf, total_length, debug, wait);

free(buf);
}
Expand All @@ -107,7 +107,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, BM1366_SERIALTX_DEBUG);
SERIAL_send(buf, total_length, BM1366_SERIALTX_DEBUG, true);

free(buf);
}
Expand All @@ -117,15 +117,15 @@ static void _send_chain_inactive(void)

unsigned char read_address[2] = {0x00, 0x00};
// send serial data
_send_BM1366((TYPE_CMD | GROUP_ALL | CMD_INACTIVE), read_address, 2, BM1366_SERIALTX_DEBUG);
_send_BM1366((TYPE_CMD | GROUP_ALL | CMD_INACTIVE), read_address, 2, BM1366_SERIALTX_DEBUG, true);
}

static void _set_chip_address(uint8_t chipAddr)
{

unsigned char read_address[2] = {chipAddr, 0x00};
// send serial data
_send_BM1366((TYPE_CMD | GROUP_SINGLE | CMD_SETADDRESS), read_address, 2, BM1366_SERIALTX_DEBUG);
_send_BM1366((TYPE_CMD | GROUP_SINGLE | CMD_SETADDRESS), read_address, 2, BM1366_SERIALTX_DEBUG, true);
}

void BM1366_set_version_mask(uint32_t version_mask)
Expand All @@ -134,7 +134,7 @@ void BM1366_set_version_mask(uint32_t version_mask)
uint8_t version_byte0 = (versions_to_roll >> 8);
uint8_t version_byte1 = (versions_to_roll & 0xFF);
uint8_t version_cmd[] = {0x00, 0xA4, 0x90, 0x00, version_byte0, version_byte1};
_send_BM1366(TYPE_CMD | GROUP_ALL | CMD_WRITE, version_cmd, 6, BM1366_SERIALTX_DEBUG);
_send_BM1366(TYPE_CMD | GROUP_ALL | CMD_WRITE, version_cmd, 6, BM1366_SERIALTX_DEBUG, true);
}

void BM1366_send_hash_frequency(float target_freq)
Expand Down Expand Up @@ -190,7 +190,7 @@ void BM1366_send_hash_frequency(float target_freq)
}
}

_send_BM1366((TYPE_CMD | GROUP_ALL | CMD_WRITE), freqbuf, 6, BM1366_SERIALTX_DEBUG);
_send_BM1366((TYPE_CMD | GROUP_ALL | CMD_WRITE), freqbuf, 6, BM1366_SERIALTX_DEBUG, true);

ESP_LOGI(TAG, "Setting Frequency to %.2fMHz (%.2f)", target_freq, newf);
}
Expand Down Expand Up @@ -474,15 +474,15 @@ static uint8_t _send_init(uint64_t frequency, uint16_t asic_count)

for (uint8_t i = 0; i < chip_counter; i++) {
unsigned char set_a8_register[6] = {i * address_interval, 0xA8, 0x00, 0x07, 0x01, 0xF0};
_send_BM1366((TYPE_CMD | GROUP_SINGLE | CMD_WRITE), set_a8_register, 6, BM1366_SERIALTX_DEBUG);
_send_BM1366((TYPE_CMD | GROUP_SINGLE | CMD_WRITE), set_a8_register, 6, BM1366_SERIALTX_DEBUG, true);
unsigned char set_18_register[6] = {i * address_interval, 0x18, 0xF0, 0x00, 0xC1, 0x00};
_send_BM1366((TYPE_CMD | GROUP_SINGLE | CMD_WRITE), set_18_register, 6, BM1366_SERIALTX_DEBUG);
_send_BM1366((TYPE_CMD | GROUP_SINGLE | CMD_WRITE), set_18_register, 6, BM1366_SERIALTX_DEBUG, true);
unsigned char set_3c_register_first[6] = {i * address_interval, 0x3C, 0x80, 0x00, 0x85, 0x40};
_send_BM1366((TYPE_CMD | GROUP_SINGLE | CMD_WRITE), set_3c_register_first, 6, BM1366_SERIALTX_DEBUG);
_send_BM1366((TYPE_CMD | GROUP_SINGLE | CMD_WRITE), set_3c_register_first, 6, BM1366_SERIALTX_DEBUG, true);
unsigned char set_3c_register_second[6] = {i * address_interval, 0x3C, 0x80, 0x00, 0x80, 0x20};
_send_BM1366((TYPE_CMD | GROUP_SINGLE | CMD_WRITE), set_3c_register_second, 6, BM1366_SERIALTX_DEBUG);
_send_BM1366((TYPE_CMD | GROUP_SINGLE | CMD_WRITE), set_3c_register_second, 6, BM1366_SERIALTX_DEBUG, true);
unsigned char set_3c_register_third[6] = {i * address_interval, 0x3C, 0x80, 0x00, 0x82, 0xAA};
_send_BM1366((TYPE_CMD | GROUP_SINGLE | CMD_WRITE), set_3c_register_third, 6, BM1366_SERIALTX_DEBUG);
_send_BM1366((TYPE_CMD | GROUP_SINGLE | CMD_WRITE), set_3c_register_third, 6, BM1366_SERIALTX_DEBUG, true);
}

do_frequency_ramp_up();
Expand All @@ -495,7 +495,7 @@ static uint8_t _send_init(uint64_t frequency, uint16_t asic_count)
// unsigned char set_10_hash_counting[6] = {0x00, 0x10, 0x00, 0x00, 0x14, 0x46}; //S19XP-Luxos Default
unsigned char set_10_hash_counting[6] = {0x00, 0x10, 0x00, 0x00, 0x15, 0x1C}; //S19XP-Stock Default
// unsigned char set_10_hash_counting[6] = {0x00, 0x10, 0x00, 0x0F, 0x00, 0x00}; //supposedly the "full" 32bit nonce range
_send_BM1366((TYPE_CMD | GROUP_ALL | CMD_WRITE), set_10_hash_counting, 6, BM1366_SERIALTX_DEBUG);
_send_BM1366((TYPE_CMD | GROUP_ALL | CMD_WRITE), set_10_hash_counting, 6, BM1366_SERIALTX_DEBUG, true);

unsigned char init795[11] = {0x55, 0xAA, 0x51, 0x09, 0x00, 0xA4, 0x90, 0x00, 0xFF, 0xFF, 0x1C};
_send_simple(init795, 11);
Expand Down Expand Up @@ -547,7 +547,7 @@ int BM1366_set_default_baud(void)
{
// default divider of 26 (11010) for 115,749
unsigned char baudrate[9] = {0x00, MISC_CONTROL, 0x00, 0x00, 0b01111010, 0b00110001}; // baudrate - misc_control
_send_BM1366((TYPE_CMD | GROUP_ALL | CMD_WRITE), baudrate, 6, BM1366_SERIALTX_DEBUG);
_send_BM1366((TYPE_CMD | GROUP_ALL | CMD_WRITE), baudrate, 6, BM1366_SERIALTX_DEBUG, true);
return 115749;
}

Expand Down Expand Up @@ -591,7 +591,7 @@ void BM1366_set_job_difficulty_mask(int difficulty)

ESP_LOGI(TAG, "Setting job ASIC mask to %d", difficulty);

_send_BM1366((TYPE_CMD | GROUP_ALL | CMD_WRITE), job_difficulty_mask, 6, BM1366_SERIALTX_DEBUG);
_send_BM1366((TYPE_CMD | GROUP_ALL | CMD_WRITE), job_difficulty_mask, 6, BM1366_SERIALTX_DEBUG, true);
}

static uint8_t id = 0;
Expand Down Expand Up @@ -627,7 +627,7 @@ void BM1366_send_work(void * pvParameters, bm_job * next_bm_job)
ESP_LOGI(TAG, "Send Job: %02X", job.job_id);
#endif

_send_BM1366((TYPE_JOB | GROUP_SINGLE | CMD_WRITE), (uint8_t *)&job, sizeof(BM1366_job), BM1366_DEBUG_WORK);
_send_BM1366((TYPE_JOB | GROUP_SINGLE | CMD_WRITE), (uint8_t *)&job, sizeof(BM1366_job), BM1366_DEBUG_WORK, false);
}

asic_result * BM1366_receive_work(void)
Expand Down
28 changes: 14 additions & 14 deletions components/asic/bm1368.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ static task_result result;

static float current_frequency = 56.25;

static void _send_BM1368(uint8_t header, uint8_t * data, uint8_t data_len, bool debug)
static void _send_BM1368(uint8_t header, uint8_t * data, uint8_t data_len, bool debug, bool wait)
{
packet_type_t packet_type = (header & TYPE_JOB) ? JOB_PACKET : CMD_PACKET;
uint8_t total_length = (packet_type == JOB_PACKET) ? (data_len + 6) : (data_len + 5);
Expand All @@ -84,7 +84,7 @@ static void _send_BM1368(uint8_t header, uint8_t * data, uint8_t data_len, bool
buf[4 + data_len] = crc5(buf + 2, data_len + 2);
}

SERIAL_send(buf, total_length, debug);
SERIAL_send(buf, total_length, debug, wait);

free(buf);
}
Expand All @@ -93,21 +93,21 @@ 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, BM1368_SERIALTX_DEBUG);
SERIAL_send(buf, total_length, BM1368_SERIALTX_DEBUG, true);

free(buf);
}

static void _send_chain_inactive(void)
{
unsigned char read_address[2] = {0x00, 0x00};
_send_BM1368((TYPE_CMD | GROUP_ALL | CMD_INACTIVE), read_address, 2, BM1368_SERIALTX_DEBUG);
_send_BM1368((TYPE_CMD | GROUP_ALL | CMD_INACTIVE), read_address, 2, BM1368_SERIALTX_DEBUG, true);
}

static void _set_chip_address(uint8_t chipAddr)
{
unsigned char read_address[2] = {chipAddr, 0x00};
_send_BM1368((TYPE_CMD | GROUP_SINGLE | CMD_SETADDRESS), read_address, 2, BM1368_SERIALTX_DEBUG);
_send_BM1368((TYPE_CMD | GROUP_SINGLE | CMD_SETADDRESS), read_address, 2, BM1368_SERIALTX_DEBUG, true);
}

void BM1368_set_version_mask(uint32_t version_mask)
Expand All @@ -116,7 +116,7 @@ void BM1368_set_version_mask(uint32_t version_mask)
uint8_t version_byte0 = (versions_to_roll >> 8);
uint8_t version_byte1 = (versions_to_roll & 0xFF);
uint8_t version_cmd[] = {0x00, 0xA4, 0x90, 0x00, version_byte0, version_byte1};
_send_BM1368(TYPE_CMD | GROUP_ALL | CMD_WRITE, version_cmd, 6, BM1368_SERIALTX_DEBUG);
_send_BM1368(TYPE_CMD | GROUP_ALL | CMD_WRITE, version_cmd, 6, BM1368_SERIALTX_DEBUG, true);
}

static void _reset(void)
Expand Down Expand Up @@ -171,7 +171,7 @@ bool BM1368_send_hash_frequency(float target_freq) {
freqbuf[4] = best_refdiv;
freqbuf[5] = (((best_postdiv1 - 1) & 0xf) << 4) | ((best_postdiv2 - 1) & 0xf);

_send_BM1368(TYPE_CMD | GROUP_ALL | CMD_WRITE, freqbuf, sizeof(freqbuf), BM1368_SERIALTX_DEBUG);
_send_BM1368(TYPE_CMD | GROUP_ALL | CMD_WRITE, freqbuf, sizeof(freqbuf), BM1368_SERIALTX_DEBUG, true);

ESP_LOGI(TAG, "Setting Frequency to %.2fMHz (%.2f)", target_freq, best_freq);
current_frequency = target_freq;
Expand Down Expand Up @@ -212,7 +212,7 @@ bool BM1368_set_frequency(float target_freq) {
}

static int count_asic_chips(void) {
_send_BM1368(TYPE_CMD | GROUP_ALL | CMD_READ, (uint8_t[]){0x00, 0x00}, 2, false);
_send_BM1368(TYPE_CMD | GROUP_ALL | CMD_READ, (uint8_t[]){0x00, 0x00}, 2, false, true);

int chip_counter = 0;
while (true) {
Expand Down Expand Up @@ -270,7 +270,7 @@ uint8_t BM1368_init(uint64_t frequency, uint16_t asic_count)
};

for (int i = 0; i < sizeof(init_cmds) / sizeof(init_cmds[0]); i++) {
_send_BM1368(TYPE_CMD | GROUP_ALL | CMD_WRITE, init_cmds[i], 6, false);
_send_BM1368(TYPE_CMD | GROUP_ALL | CMD_WRITE, init_cmds[i], 6, false, true);
}

uint8_t address_interval = (uint8_t) (256 / chip_counter);
Expand All @@ -288,7 +288,7 @@ uint8_t BM1368_init(uint64_t frequency, uint16_t asic_count)
};

for (int j = 0; j < sizeof(chip_init_cmds) / sizeof(chip_init_cmds[0]); j++) {
_send_BM1368(TYPE_CMD | GROUP_SINGLE | CMD_WRITE, chip_init_cmds[j], 6, false);
_send_BM1368(TYPE_CMD | GROUP_SINGLE | CMD_WRITE, chip_init_cmds[j], 6, false, true);
}
vTaskDelay(pdMS_TO_TICKS(500));
}
Expand All @@ -297,7 +297,7 @@ uint8_t BM1368_init(uint64_t frequency, uint16_t asic_count)

do_frequency_ramp_up((float)frequency);

_send_BM1368(TYPE_CMD | GROUP_ALL | CMD_WRITE, (uint8_t[]){0x00, 0x10, 0x00, 0x00, 0x15, 0xa4}, 6, false);
_send_BM1368(TYPE_CMD | GROUP_ALL | CMD_WRITE, (uint8_t[]){0x00, 0x10, 0x00, 0x00, 0x15, 0xa4}, 6, false, true);
BM1368_set_version_mask(STRATUM_DEFAULT_VERSION_MASK);

ESP_LOGI(TAG, "%i chip(s) detected on the chain, expected %i", chip_counter, asic_count);
Expand All @@ -307,7 +307,7 @@ uint8_t BM1368_init(uint64_t frequency, uint16_t asic_count)
int BM1368_set_default_baud(void)
{
unsigned char baudrate[9] = {0x00, MISC_CONTROL, 0x00, 0x00, 0b01111010, 0b00110001};
_send_BM1368((TYPE_CMD | GROUP_ALL | CMD_WRITE), baudrate, 6, BM1368_SERIALTX_DEBUG);
_send_BM1368((TYPE_CMD | GROUP_ALL | CMD_WRITE), baudrate, 6, BM1368_SERIALTX_DEBUG, true);
return 115749;
}

Expand All @@ -333,7 +333,7 @@ void BM1368_set_job_difficulty_mask(int difficulty)

ESP_LOGI(TAG, "Setting job ASIC mask to %d", difficulty);

_send_BM1368((TYPE_CMD | GROUP_ALL | CMD_WRITE), job_difficulty_mask, 6, BM1368_SERIALTX_DEBUG);
_send_BM1368((TYPE_CMD | GROUP_ALL | CMD_WRITE), job_difficulty_mask, 6, BM1368_SERIALTX_DEBUG, true);
}

static uint8_t id = 0;
Expand Down Expand Up @@ -367,7 +367,7 @@ void BM1368_send_work(void * pvParameters, bm_job * next_bm_job)
ESP_LOGI(TAG, "Send Job: %02X", job.job_id);
#endif

_send_BM1368((TYPE_JOB | GROUP_SINGLE | CMD_WRITE), (uint8_t *)&job, sizeof(BM1368_job), BM1368_DEBUG_WORK);
_send_BM1368((TYPE_JOB | GROUP_SINGLE | CMD_WRITE), (uint8_t *)&job, sizeof(BM1368_job), BM1368_DEBUG_WORK, false);
}

asic_result * BM1368_receive_work(void)
Expand Down
34 changes: 17 additions & 17 deletions components/asic/bm1370.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ static task_result result;
/// @param header
/// @param data
/// @param len
static void _send_BM1370(uint8_t header, uint8_t * data, uint8_t data_len, bool debug)
static void _send_BM1370(uint8_t header, uint8_t * data, uint8_t data_len, bool debug, bool wait)
{
packet_type_t packet_type = (header & TYPE_JOB) ? JOB_PACKET : CMD_PACKET;
uint8_t total_length = (packet_type == JOB_PACKET) ? (data_len + 6) : (data_len + 5);
Expand Down Expand Up @@ -100,7 +100,7 @@ static void _send_BM1370(uint8_t header, uint8_t * data, uint8_t data_len, bool
}

// send serial data
if (SERIAL_send(buf, total_length, debug) != ESP_OK) {
if (SERIAL_send(buf, total_length, debug, wait) != ESP_OK) {
ESP_LOGE(TAG, "Failed to send data to BM1370");
}

Expand All @@ -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, false, true);

free(buf);
}
Expand All @@ -121,15 +121,15 @@ static void _send_chain_inactive(void)

unsigned char read_address[2] = {0x00, 0x00};
// send serial data
_send_BM1370((TYPE_CMD | GROUP_ALL | CMD_INACTIVE), read_address, 2, BM1370_SERIALTX_DEBUG);
_send_BM1370((TYPE_CMD | GROUP_ALL | CMD_INACTIVE), read_address, 2, BM1370_SERIALTX_DEBUG, true);
}

static void _set_chip_address(uint8_t chipAddr)
{

unsigned char read_address[2] = {chipAddr, 0x00};
// send serial data
_send_BM1370((TYPE_CMD | GROUP_SINGLE | CMD_SETADDRESS), read_address, 2, BM1370_SERIALTX_DEBUG);
_send_BM1370((TYPE_CMD | GROUP_SINGLE | CMD_SETADDRESS), read_address, 2, BM1370_SERIALTX_DEBUG, true);
}

void BM1370_set_version_mask(uint32_t version_mask)
Expand All @@ -138,7 +138,7 @@ void BM1370_set_version_mask(uint32_t version_mask)
uint8_t version_byte0 = (versions_to_roll >> 8);
uint8_t version_byte1 = (versions_to_roll & 0xFF);
uint8_t version_cmd[] = {0x00, 0xA4, 0x90, 0x00, version_byte0, version_byte1};
_send_BM1370(TYPE_CMD | GROUP_ALL | CMD_WRITE, version_cmd, 6, BM1370_SERIALTX_DEBUG);
_send_BM1370(TYPE_CMD | GROUP_ALL | CMD_WRITE, version_cmd, 6, BM1370_SERIALTX_DEBUG, true);
}

void BM1370_send_hash_frequency(int id, float target_freq, float max_diff) {
Expand Down Expand Up @@ -184,9 +184,9 @@ void BM1370_send_hash_frequency(int id, float target_freq, float max_diff) {

if (id != -1) {
freqbuf[0] = id * 2;
_send_BM1370(TYPE_CMD | GROUP_SINGLE | CMD_WRITE, freqbuf, 6, BM1370_SERIALTX_DEBUG);
_send_BM1370(TYPE_CMD | GROUP_SINGLE | CMD_WRITE, freqbuf, 6, BM1370_SERIALTX_DEBUG, true);
} else {
_send_BM1370(TYPE_CMD | GROUP_ALL | CMD_WRITE, freqbuf, 6, BM1370_SERIALTX_DEBUG);
_send_BM1370(TYPE_CMD | GROUP_ALL | CMD_WRITE, freqbuf, 6, BM1370_SERIALTX_DEBUG, true);
}

ESP_LOGI(TAG, "Setting Frequency to %.2fMHz (%.2f)", target_freq, best_freq);
Expand Down Expand Up @@ -283,20 +283,20 @@ static uint8_t _send_init(uint64_t frequency, uint16_t asic_count)
for (uint8_t i = 0; i < chip_counter; i++) {
//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);
_send_BM1370((TYPE_CMD | GROUP_SINGLE | CMD_WRITE), set_a8_register, 6, BM1370_SERIALTX_DEBUG, true);
//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);
_send_BM1370((TYPE_CMD | GROUP_SINGLE | CMD_WRITE), set_18_register, 6, BM1370_SERIALTX_DEBUG, true);
//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);
_send_BM1370((TYPE_CMD | GROUP_SINGLE | CMD_WRITE), set_3c_register_first, 6, BM1370_SERIALTX_DEBUG, true);
//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};
_send_BM1370((TYPE_CMD | GROUP_SINGLE | CMD_WRITE), set_3c_register_second, 6, BM1370_SERIALTX_DEBUG);
_send_BM1370((TYPE_CMD | GROUP_SINGLE | CMD_WRITE), set_3c_register_second, 6, BM1370_SERIALTX_DEBUG, true);
//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);
_send_BM1370((TYPE_CMD | GROUP_SINGLE | CMD_WRITE), set_3c_register_third, 6, BM1370_SERIALTX_DEBUG, true);
}

do_frequency_ramp_up(frequency);
Expand All @@ -311,7 +311,7 @@ static uint8_t _send_init(uint64_t frequency, uint16_t asic_count)
//unsigned char set_10_hash_counting[6] = {0x00, 0x10, 0x00, 0x00, 0x15, 0xA4}; //S21-Stock Default
unsigned char set_10_hash_counting[6] = {0x00, 0x10, 0x00, 0x00, 0x1E, 0xB5}; //S21 Pro-Stock Default
// unsigned char set_10_hash_counting[6] = {0x00, 0x10, 0x00, 0x0F, 0x00, 0x00}; //supposedly the "full" 32bit nonce range
_send_BM1370((TYPE_CMD | GROUP_ALL | CMD_WRITE), set_10_hash_counting, 6, BM1370_SERIALTX_DEBUG);
_send_BM1370((TYPE_CMD | GROUP_ALL | CMD_WRITE), set_10_hash_counting, 6, BM1370_SERIALTX_DEBUG, true);

return chip_counter;
}
Expand Down Expand Up @@ -360,7 +360,7 @@ int BM1370_set_default_baud(void)
{
// default divider of 26 (11010) for 115,749
unsigned char baudrate[9] = {0x00, MISC_CONTROL, 0x00, 0x00, 0b01111010, 0b00110001}; // baudrate - misc_control
_send_BM1370((TYPE_CMD | GROUP_ALL | CMD_WRITE), baudrate, 6, BM1370_SERIALTX_DEBUG);
_send_BM1370((TYPE_CMD | GROUP_ALL | CMD_WRITE), baudrate, 6, BM1370_SERIALTX_DEBUG, true);
return 115749;
}

Expand Down Expand Up @@ -400,7 +400,7 @@ void BM1370_set_job_difficulty_mask(int difficulty)

ESP_LOGI(TAG, "Setting ASIC difficulty mask to %d", difficulty);

_send_BM1370((TYPE_CMD | GROUP_ALL | CMD_WRITE), job_difficulty_mask, 6, BM1370_SERIALTX_DEBUG);
_send_BM1370((TYPE_CMD | GROUP_ALL | CMD_WRITE), job_difficulty_mask, 6, BM1370_SERIALTX_DEBUG, true);
}

static uint8_t id = 0;
Expand Down Expand Up @@ -436,7 +436,7 @@ void BM1370_send_work(void * pvParameters, bm_job * next_bm_job)
ESP_LOGI(TAG, "Send Job: %02X", job.job_id);
#endif

_send_BM1370((TYPE_JOB | GROUP_SINGLE | CMD_WRITE), (uint8_t *)&job, sizeof(BM1370_job), BM1370_DEBUG_WORK);
_send_BM1370((TYPE_JOB | GROUP_SINGLE | CMD_WRITE), (uint8_t *)&job, sizeof(BM1370_job), BM1370_DEBUG_WORK, false);
}

asic_result * BM1370_receive_work(void)
Expand Down
Loading

0 comments on commit dc4afcd

Please sign in to comment.