mirror of
https://github.com/skot/ESP-Miner.git
synced 2025-04-10 12:59:25 +02:00
reduce ASIC serial RX buf to 16 bytes (from 1024). make sure to free() after every nvs_config_get_string()
This commit is contained in:
parent
99e4f12da3
commit
349b5cbd35
@ -57,7 +57,7 @@ typedef struct __attribute__((__packed__))
|
||||
|
||||
static const char * TAG = "bm1366Module";
|
||||
|
||||
static uint8_t asic_response_buffer[CHUNK_SIZE];
|
||||
static uint8_t asic_response_buffer[SERIAL_BUF_SIZE];
|
||||
static task_result result;
|
||||
|
||||
/// @brief
|
||||
@ -523,7 +523,7 @@ uint8_t BM1366_init(uint64_t frequency, uint16_t asic_count)
|
||||
{
|
||||
ESP_LOGI(TAG, "Initializing BM1366");
|
||||
|
||||
memset(asic_response_buffer, 0, 1024);
|
||||
memset(asic_response_buffer, 0, SERIAL_BUF_SIZE);
|
||||
|
||||
esp_rom_gpio_pad_select_gpio(BM1366_RST_PIN);
|
||||
gpio_set_direction(BM1366_RST_PIN, GPIO_MODE_OUTPUT);
|
||||
|
@ -57,7 +57,7 @@ typedef struct __attribute__((__packed__))
|
||||
|
||||
static const char * TAG = "bm1368Module";
|
||||
|
||||
static uint8_t asic_response_buffer[CHUNK_SIZE];
|
||||
static uint8_t asic_response_buffer[SERIAL_BUF_SIZE];
|
||||
static task_result result;
|
||||
|
||||
/// @brief
|
||||
@ -402,7 +402,7 @@ uint8_t BM1368_init(uint64_t frequency, uint16_t asic_count)
|
||||
{
|
||||
ESP_LOGI(TAG, "Initializing BM1368");
|
||||
|
||||
memset(asic_response_buffer, 0, 1024);
|
||||
memset(asic_response_buffer, 0, SERIAL_BUF_SIZE);
|
||||
|
||||
esp_rom_gpio_pad_select_gpio(BM1368_RST_PIN);
|
||||
gpio_set_direction(BM1368_RST_PIN, GPIO_MODE_OUTPUT);
|
||||
|
@ -56,7 +56,7 @@ typedef struct __attribute__((__packed__))
|
||||
|
||||
static const char *TAG = "bm1397Module";
|
||||
|
||||
static uint8_t asic_response_buffer[CHUNK_SIZE];
|
||||
static uint8_t asic_response_buffer[SERIAL_BUF_SIZE];
|
||||
static uint32_t prev_nonce = 0;
|
||||
static task_result result;
|
||||
|
||||
@ -287,7 +287,7 @@ uint8_t BM1397_init(uint64_t frequency, uint16_t asic_count)
|
||||
{
|
||||
ESP_LOGI(TAG, "Initializing BM1397");
|
||||
|
||||
memset(asic_response_buffer, 0, sizeof(asic_response_buffer));
|
||||
memset(asic_response_buffer, 0, SERIAL_BUF_SIZE);
|
||||
|
||||
esp_rom_gpio_pad_select_gpio(BM1397_RST_PIN);
|
||||
gpio_set_direction(BM1397_RST_PIN, GPIO_MODE_OUTPUT);
|
||||
|
@ -1,7 +1,7 @@
|
||||
#ifndef SERIAL_H_
|
||||
#define SERIAL_H_
|
||||
|
||||
#define CHUNK_SIZE 1024
|
||||
#define SERIAL_BUF_SIZE 16
|
||||
|
||||
int SERIAL_send(uint8_t *, int, bool);
|
||||
void SERIAL_init(void);
|
||||
|
@ -85,7 +85,7 @@ int16_t SERIAL_rx(uint8_t *buf, uint16_t size, uint16_t timeout_ms)
|
||||
void SERIAL_debug_rx(void)
|
||||
{
|
||||
int ret;
|
||||
uint8_t buf[CHUNK_SIZE];
|
||||
uint8_t buf[100];
|
||||
|
||||
ret = SERIAL_rx(buf, 100, 20);
|
||||
if (ret < 0)
|
||||
|
@ -347,6 +347,7 @@ static esp_err_t GET_swarm(httpd_req_t * req)
|
||||
|
||||
char * swarm_config = nvs_config_get_string(NVS_CONFIG_SWARM, "[]");
|
||||
httpd_resp_sendstr(req, swarm_config);
|
||||
free(swarm_config);
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user