Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is SPIRAM Available? #626

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions main/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ PRIV_REQUIRES
"esp_event"
"esp_http_server"
"esp_netif"
"esp_psram"
"esp_timer"
"esp_wifi"
"json"
Expand Down
1 change: 1 addition & 0 deletions main/global_state.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ typedef struct

int sock;
bool ASIC_initalized;
bool psram_is_available;
} GlobalState;

#endif /* GLOBAL_STATE_H_ */
2 changes: 2 additions & 0 deletions main/http_server/http_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,8 @@ 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, "isPSRAMAvailable", GLOBAL_STATE->psram_is_available);

cJSON_AddNumberToObject(root, "freeHeap", esp_get_free_heap_size());
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));
Expand Down
8 changes: 8 additions & 0 deletions main/main.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@

#include "esp_event.h"
#include "esp_log.h"
#include "esp_psram.h"
#include "nvs_flash.h"

// #include "protocol_examples_common.h"
Expand Down Expand Up @@ -34,6 +35,13 @@ void app_main(void)
{
ESP_LOGI(TAG, "Welcome to the bitaxe - hack the planet!");

if (!esp_psram_is_initialized()) {
ESP_LOGE(TAG, "No PSRAM available on ESP32 device!");
GLOBAL_STATE.psram_is_available = false;
} else {
GLOBAL_STATE.psram_is_available = true;
}

// Init I2C
ESP_ERROR_CHECK(i2c_bitaxe_init());
ESP_LOGI(TAG, "I2C initialized successfully");
Expand Down
Loading