diff --git a/main/http_server/http_server.c b/main/http_server/http_server.c index c6c1c42..444d926 100644 --- a/main/http_server/http_server.c +++ b/main/http_server/http_server.c @@ -38,7 +38,6 @@ static const char * TAG = "http_server"; static GlobalState * GLOBAL_STATE; static httpd_handle_t server = NULL; QueueHandle_t log_queue = NULL; -StaticQueue_t log_queue_static; static int fd = -1; @@ -383,11 +382,6 @@ static esp_err_t GET_system_info(httpd_req_t * req) cJSON_AddNumberToObject(root, "isUsingFallbackStratum", GLOBAL_STATE->SYSTEM_MODULE.is_using_fallback); cJSON_AddNumberToObject(root, "freeHeap", esp_get_free_heap_size()); - cJSON_AddNumberToObject(root, "freeInternalHeap", esp_get_free_internal_heap_size()); - cJSON_AddNumberToObject(root, "minimumFreeHeap", esp_get_minimum_free_heap_size()); - - cJSON_AddStringToObject(root, "idfVersion", esp_get_idf_version()); - cJSON_AddNumberToObject(root, "coreVoltage", nvs_config_get_u16(NVS_CONFIG_ASIC_VOLTAGE, CONFIG_ASIC_VOLTAGE)); cJSON_AddNumberToObject(root, "coreVoltageActual", VCORE_get_voltage_mv(GLOBAL_STATE)); cJSON_AddNumberToObject(root, "frequency", nvs_config_get_u16(NVS_CONFIG_ASIC_FREQ, CONFIG_ASIC_FREQUENCY)); @@ -574,7 +568,7 @@ int log_to_queue(const char * format, va_list args) va_end(args_copy); // Allocate the buffer dynamically - char *log_buffer = (char *) heap_caps_calloc(needed_size + 2, sizeof(char), MALLOC_CAP_SPIRAM); + char * log_buffer = (char *) calloc(needed_size + 2, sizeof(char)); // +2 for potential \n and \0 if (log_buffer == NULL) { return 0; } @@ -690,17 +684,11 @@ esp_err_t start_rest_server(void * pvParameters) } REST_CHECK(base_path, "wrong base path", err); - - rest_server_context_t *rest_context = (rest_server_context_t*) heap_caps_calloc(1, sizeof(rest_server_context_t), MALLOC_CAP_SPIRAM); - + rest_server_context_t * rest_context = calloc(1, sizeof(rest_server_context_t)); REST_CHECK(rest_context, "No memory for rest context", err); strlcpy(rest_context->base_path, base_path, sizeof(rest_context->base_path)); - size_t queue_memory_size = MESSAGE_QUEUE_SIZE * sizeof(char*); - void *queue_memory = heap_caps_malloc(queue_memory_size, MALLOC_CAP_SPIRAM); - REST_CHECK(queue_memory, "No memory for queue memory", err); - log_queue = xQueueCreateStatic(MESSAGE_QUEUE_SIZE, sizeof(char*), queue_memory, &log_queue_static); - REST_CHECK(log_queue, "No memory for log queue", err); + log_queue = xQueueCreate(MESSAGE_QUEUE_SIZE, sizeof(char*)); httpd_config_t config = HTTPD_DEFAULT_CONFIG(); config.uri_match_fn = httpd_uri_match_wildcard; diff --git a/main/self_test/self_test.c b/main/self_test/self_test.c index f2724db..2ffe300 100644 --- a/main/self_test/self_test.c +++ b/main/self_test/self_test.c @@ -360,8 +360,8 @@ void self_test(void * pvParameters) tests_done(GLOBAL_STATE, TESTS_FAILED); } - GLOBAL_STATE->ASIC_TASK_MODULE.active_jobs = heap_caps_malloc(sizeof(bm_job *) * 128, MALLOC_CAP_SPIRAM); - GLOBAL_STATE->valid_jobs = heap_caps_malloc(sizeof(uint8_t) * 128, MALLOC_CAP_SPIRAM); + GLOBAL_STATE->ASIC_TASK_MODULE.active_jobs = malloc(sizeof(bm_job *) * 128); + GLOBAL_STATE->valid_jobs = malloc(sizeof(uint8_t) * 128); for (int i = 0; i < 128; i++) { GLOBAL_STATE->ASIC_TASK_MODULE.active_jobs[i] = NULL; diff --git a/main/tasks/asic_task.c b/main/tasks/asic_task.c index b8a597d..8314b11 100644 --- a/main/tasks/asic_task.c +++ b/main/tasks/asic_task.c @@ -19,8 +19,8 @@ void ASIC_task(void *pvParameters) //initialize the semaphore GLOBAL_STATE->ASIC_TASK_MODULE.semaphore = xSemaphoreCreateBinary(); - GLOBAL_STATE->ASIC_TASK_MODULE.active_jobs = heap_caps_malloc(sizeof(bm_job *) * 128, MALLOC_CAP_SPIRAM); - GLOBAL_STATE->valid_jobs = heap_caps_malloc(sizeof(uint8_t) * 128, MALLOC_CAP_SPIRAM); + GLOBAL_STATE->ASIC_TASK_MODULE.active_jobs = malloc(sizeof(bm_job *) * 128); + GLOBAL_STATE->valid_jobs = malloc(sizeof(uint8_t) * 128); for (int i = 0; i < 128; i++) { GLOBAL_STATE->ASIC_TASK_MODULE.active_jobs[i] = NULL; diff --git a/main/tasks/create_jobs_task.c b/main/tasks/create_jobs_task.c index d37afe1..bddb5c3 100644 --- a/main/tasks/create_jobs_task.c +++ b/main/tasks/create_jobs_task.c @@ -94,7 +94,7 @@ static void generate_work(GlobalState *GLOBAL_STATE, mining_notify *notification bm_job next_job = construct_bm_job(notification, merkle_root, GLOBAL_STATE->version_mask); - bm_job *queued_next_job = heap_caps_malloc(sizeof(bm_job), MALLOC_CAP_SPIRAM); + bm_job *queued_next_job = malloc(sizeof(bm_job)); if (queued_next_job == NULL) { ESP_LOGE(TAG, "Failed to allocate memory for queued_next_job"); free(extranonce_2_str); diff --git a/sdkconfig.defaults b/sdkconfig.defaults index 92838fc..5a9107c 100644 --- a/sdkconfig.defaults +++ b/sdkconfig.defaults @@ -13,7 +13,3 @@ CONFIG_ESP_WIFI_11KV_SUPPORT=y CONFIG_LV_CONF_SKIP=n CONFIG_BT_ENABLED=n CONFIG_LWIP_MAX_SOCKETS=16 -CONFIG_SPIRAM=y -CONFIG_SPIRAM_MODE_OCT=y -CONFIG_SPIRAM_USE_CAPS_ALLOC=y -CONFIG_SPIRAM_SPEED_80M=y