mirror of
https://github.com/skot/ESP-Miner.git
synced 2025-06-01 09:59:15 +02:00
Remove wifi max retry, remove max fan speed on reboot
This commit is contained in:
parent
36cbaea96b
commit
b53b641c68
2
.vscode/settings.json
vendored
2
.vscode/settings.json
vendored
@ -1,6 +1,6 @@
|
||||
{
|
||||
"idf.flashType": "UART",
|
||||
"idf.portWin": "COM30",
|
||||
"idf.portWin": "COM3",
|
||||
"idf.adapterTargetName": "esp32s3",
|
||||
"idf.openOcdConfigs": [
|
||||
"interface/ftdi/esp32_devkitj_v1.cfg",
|
||||
|
@ -60,18 +60,12 @@ static void event_handler(void * arg, esp_event_base_t event_base, int32_t event
|
||||
} else if (event_base == WIFI_EVENT && event_id == WIFI_EVENT_STA_DISCONNECTED) {
|
||||
|
||||
// Wait a little
|
||||
vTaskDelay(1000 / portTICK_PERIOD_MS);
|
||||
vTaskDelay(2500 / portTICK_PERIOD_MS);
|
||||
esp_wifi_connect();
|
||||
s_retry_num++;
|
||||
ESP_LOGI(TAG, "Retrying WiFi connection...");
|
||||
MINER_set_wifi_status(WIFI_RETRYING, s_retry_num);
|
||||
|
||||
if (s_retry_num < WIFI_MAXIMUM_RETRY) {
|
||||
esp_wifi_connect();
|
||||
s_retry_num++;
|
||||
ESP_LOGI(TAG, "Retrying WiFi connection...");
|
||||
MINER_set_wifi_status(WIFI_RETRYING, s_retry_num);
|
||||
} else {
|
||||
xEventGroupSetBits(s_wifi_event_group, WIFI_FAIL_BIT);
|
||||
ESP_LOGI(TAG, "Could not connect to WiFi.");
|
||||
MINER_set_wifi_status(WIFI_CONNECT_FAILED, 0);
|
||||
}
|
||||
} else if (event_base == IP_EVENT && event_id == IP_EVENT_STA_GOT_IP) {
|
||||
ip_event_got_ip_t * event = (ip_event_got_ip_t *) event_data;
|
||||
ESP_LOGI(TAG, "Bitaxe ip:" IPSTR, IP2STR(&event->ip_info.ip));
|
||||
@ -133,6 +127,12 @@ void wifi_softap_off(void)
|
||||
ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_STA));
|
||||
}
|
||||
|
||||
void wifi_softap_on(void)
|
||||
{
|
||||
ESP_LOGI(TAG, "ESP_WIFI Access Point On");
|
||||
ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_APSTA));
|
||||
}
|
||||
|
||||
/* Initialize wifi station */
|
||||
esp_netif_t * wifi_init_sta(const char * wifi_ssid, const char * wifi_pass)
|
||||
{
|
||||
|
@ -9,7 +9,7 @@
|
||||
#define WIFI_SSID CONFIG_ESP_WIFI_SSID
|
||||
#define WIFI_PASS CONFIG_ESP_WIFI_PASSWORD
|
||||
|
||||
#define WIFI_MAXIMUM_RETRY CONFIG_ESP_MAXIMUM_RETRY
|
||||
|
||||
|
||||
/* The event group allows multiple bits for each event, but we only care about two events:
|
||||
* - we are connected to the AP with an IP
|
||||
@ -29,6 +29,7 @@ typedef enum
|
||||
} wifi_status_t;
|
||||
|
||||
void toggle_wifi_softap(void);
|
||||
void wifi_softap_on(void);
|
||||
void wifi_softap_off(void);
|
||||
void wifi_init(const char * wifi_ssid, const char * wifi_pass);
|
||||
EventBits_t wifi_connect(void);
|
||||
|
@ -147,7 +147,7 @@ void app_main(void)
|
||||
void MINER_set_wifi_status(wifi_status_t status, uint16_t retry_count)
|
||||
{
|
||||
if (status == WIFI_RETRYING) {
|
||||
snprintf(GLOBAL_STATE.SYSTEM_MODULE.wifi_status, 20, "Retrying: %d/%d", retry_count, WIFI_MAXIMUM_RETRY);
|
||||
snprintf(GLOBAL_STATE.SYSTEM_MODULE.wifi_status, 20, "Retrying: %d", retry_count);
|
||||
return;
|
||||
} else if (status == WIFI_CONNECT_FAILED) {
|
||||
snprintf(GLOBAL_STATE.SYSTEM_MODULE.wifi_status, 20, "Connect Failed!");
|
||||
|
@ -79,7 +79,7 @@ static void _init_system(GlobalState * global_state, SystemModule * module)
|
||||
DS4432U_set_vcore(nvs_config_get_u16(NVS_CONFIG_ASIC_VOLTAGE, CONFIG_ASIC_VOLTAGE) / 1000.0);
|
||||
|
||||
EMC2101_init(nvs_config_get_u16(NVS_CONFIG_INVERT_FAN_POLARITY, 1));
|
||||
EMC2101_set_fan_speed(1);
|
||||
|
||||
|
||||
vTaskDelay(500 / portTICK_PERIOD_MS);
|
||||
|
||||
|
@ -148,7 +148,7 @@ void POWER_MANAGEMENT_task(void * pvParameters)
|
||||
(power_management->frequency_value > 50 || power_management->voltage > 1000)) {
|
||||
ESP_LOGE(TAG, "OVERHEAT");
|
||||
|
||||
|
||||
EMC2101_set_fan_speed(1);
|
||||
if (power_management->HAS_POWER_EN) {
|
||||
gpio_set_level(GPIO_NUM_10, 1);
|
||||
} else {
|
||||
|
@ -5,7 +5,6 @@ CONFIG_PARTITION_TABLE_OFFSET=0x8000
|
||||
CONFIG_PARTITION_TABLE_MD5=y
|
||||
CONFIG_ESPTOOLPY_FLASHSIZE_16MB=y
|
||||
CONFIG_ESPTOOLPY_FLASHSIZE="16MB"
|
||||
CONFIG_ESP_MAXIMUM_RETRY=5
|
||||
CONFIG_HTTPD_WS_SUPPORT=y
|
||||
CONFIG_SPIFFS_OBJ_NAME_LEN=64
|
||||
CONFIG_HTTPD_MAX_URI_LEN=2048
|
||||
|
Loading…
x
Reference in New Issue
Block a user