Update ESP-IDF to v5.5-beta1 and add minimal ESP8266 support (#1707)

* update esp-idf

* esp8266

* fix

* pwm, uart and wifi fix

* fix ota

* fix 1m and ps

* update workflow
This commit is contained in:
NonPIayerCharacter
2025-07-06 08:54:23 +03:00
committed by GitHub
parent 55ce270fef
commit a261a71ab1
48 changed files with 2512 additions and 342 deletions

View File

@ -53,7 +53,7 @@
extern hal_reset_reason_t reset_reason;
#endif
SemaphoreHandle_t scan_hdl;
#elif defined(PLATFORM_ESPIDF)
#elif defined(PLATFORM_ESPIDF) || PLATFORM_ESP8266
#include "esp_wifi.h"
#include "esp_system.h"
#elif defined(PLATFORM_BK7231T)
@ -1398,7 +1398,7 @@ int http_fn_cfg_wifi(http_request_t* request) {
hprintf255(request, "[%i/%i] SSID: %s, Channel: %i, Signal %i<br>", i + 1, (int)num, ar[i].ssid, ar[i].channel, ar[i].rssi);
}
tuya_os_adapt_wifi_release_ap(ar);
#elif PLATFORM_ESPIDF
#elif PLATFORM_ESPIDF || PLATFORM_ESP8266
// doesn't work in ap mode, only sta/apsta
uint16_t ap_count = 0, number = 30;
wifi_ap_record_t ap_info[number];
@ -3178,7 +3178,7 @@ void OTA_RequestDownloadFromHTTP(const char* s) {
#elif PLATFORM_LN882H
#elif PLATFORM_ESPIDF
#elif PLATFORM_ESPIDF || PLATFORM_ESP8266
#elif PLATFORM_TR6260
#elif PLATFORM_REALTEK
#elif PLATFORM_ECR6600

View File

@ -8,7 +8,12 @@
#include "lwip/inet.h"
#include "../logging/logging.h"
#include "new_http.h"
#if PLATFORM_ESP8266
#define MAX_SOCKETS_TCP 2
#define REPLY_BUFFER_SIZE 1024
#define INCOMING_BUFFER_SIZE 1024
#define HTTP_CLIENT_STACK_SIZE 4096
#endif
#ifndef MAX_SOCKETS_TCP
#define MAX_SOCKETS_TCP MEMP_NUM_TCP_PCB
#endif
@ -16,11 +21,17 @@
void HTTPServer_Start();
#define HTTP_SERVER_PORT 80
#define REPLY_BUFFER_SIZE 2048
#define INCOMING_BUFFER_SIZE 2048
#define INVALID_SOCK -1
#define HTTP_CLIENT_STACK_SIZE 8192
#ifndef REPLY_BUFFER_SIZE
#define REPLY_BUFFER_SIZE 2048
#endif
#ifndef INCOMING_BUFFER_SIZE
#define INCOMING_BUFFER_SIZE 2048
#endif
#ifndef HTTP_CLIENT_STACK_SIZE
#define HTTP_CLIENT_STACK_SIZE 8192
#endif
typedef struct
{
int fd;

View File

@ -38,7 +38,7 @@ uint32_t flash_read(uint32_t flash, uint32_t addr, void* buf, uint32_t size);
#include "hal/hal_flash.h"
#include "flash_partition_table.h"
#elif PLATFORM_ESPIDF
#elif PLATFORM_ESPIDF || PLATFORM_ESP8266
#include "esp_system.h"
#include "esp_ota_ops.h"
@ -48,8 +48,16 @@ uint32_t flash_read(uint32_t flash, uint32_t addr, void* buf, uint32_t size);
#include "nvs.h"
#include "nvs_flash.h"
#include "esp_wifi.h"
#if PLATFORM_ESPIDF
#include "esp_flash.h"
#include "esp_pm.h"
#include "esp_flash_spi_init.h"
#else
#include "esp_image_format.h"
#include "spi_flash.h"
#define esp_flash_read(a,b,c,d) spi_flash_read(c,b,d)
#define OTA_WITH_SEQUENTIAL_WRITES OTA_SIZE_UNKNOWN
#define esp_ota_abort esp_ota_end
#endif
#elif PLATFORM_REALTEK
@ -309,7 +317,7 @@ static int http_rest_post(http_request_t* request) {
return http_rest_post_flash(request, -1, -1);
#elif PLATFORM_LN882H
return http_rest_post_flash(request, -1, -1);
#elif PLATFORM_ESPIDF
#elif PLATFORM_ESPIDF || PLATFORM_ESP8266
return http_rest_post_flash(request, -1, -1);
#elif PLATFORM_REALTEK
return http_rest_post_flash(request, 0, -1);
@ -1603,7 +1611,6 @@ static int http_rest_post_flash(http_request_t* request, int startaddr, int maxa
int towrite = request->bodylen;
char* writebuf = request->bodystart;
int writelen = request->bodylen;
int fsize = 0;
ADDLOG_DEBUG(LOG_FEATURE_OTA, "OTA post len %d", request->contentLength);
@ -2141,7 +2148,7 @@ static int http_rest_post_flash(http_request_t* request, int startaddr, int maxa
}
#elif PLATFORM_ESPIDF
#elif PLATFORM_ESPIDF || PLATFORM_ESP8266
ADDLOG_DEBUG(LOG_FEATURE_OTA, "Ota start!\r\n");
esp_err_t err;
@ -2151,7 +2158,7 @@ static int http_rest_post_flash(http_request_t* request, int startaddr, int maxa
update_partition = esp_ota_get_next_update_partition(NULL);
if(request->contentLength >= 0)
{
fsize = towrite = request->contentLength;
towrite = request->contentLength;
}
esp_wifi_set_ps(WIFI_PS_NONE);
@ -2197,7 +2204,7 @@ static int http_rest_post_flash(http_request_t* request, int startaddr, int maxa
return -1;
}
ADDLOG_DEBUG(LOG_FEATURE_OTA, "OTA in progress: %.1f%%", (100 - ((float)towrite / fsize) * 100));
ADDLOG_DEBUG(LOG_FEATURE_OTA, "Writelen %i at %i", writelen, total);
total += writelen;
startaddr += writelen;
towrite -= writelen;
@ -3289,7 +3296,7 @@ static int http_rest_get_flash(http_request_t* request, int startaddr, int len)
res = tls_fls_read(startaddr, (uint8_t*)buffer, readlen);
#elif PLATFORM_LN882H
res = hal_flash_read(startaddr, readlen, (uint8_t *)buffer);
#elif PLATFORM_ESPIDF
#elif PLATFORM_ESPIDF || PLATFORM_ESP8266
res = esp_flash_read(NULL, (void*)buffer, startaddr, readlen);
#elif PLATFORM_TR6260
res = hal_spiflash_read(startaddr, (uint8_t*)buffer, readlen);