Merge branch 'main-idf5' into 'main'
Main idf5 See merge request userbogd/webguiapp!3
This commit is contained in:
commit
c81e02262b
|
|
@ -40,7 +40,7 @@ idf_component_register(
|
||||||
"src/MQTT.c"
|
"src/MQTT.c"
|
||||||
"src/MQTTSysHandler.c"
|
"src/MQTTSysHandler.c"
|
||||||
"src/OTA.c"
|
"src/OTA.c"
|
||||||
"src/mDNS.c"
|
# "src/mDNS.c"
|
||||||
|
|
||||||
INCLUDE_DIRS "."
|
INCLUDE_DIRS "."
|
||||||
"include"
|
"include"
|
||||||
|
|
@ -55,7 +55,10 @@ idf_component_register(
|
||||||
mqtt
|
mqtt
|
||||||
esp_https_ota
|
esp_https_ota
|
||||||
app_update
|
app_update
|
||||||
mdns
|
# mdns
|
||||||
|
esp_wifi
|
||||||
|
esp_http_server
|
||||||
|
esp_eth
|
||||||
|
|
||||||
EMBED_FILES "upload_script.html"
|
EMBED_FILES "upload_script.html"
|
||||||
EMBED_TXTFILES ca_cert.pem
|
EMBED_TXTFILES ca_cert.pem
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
Subproject commit a646e3ee0594ec2301e9b3fe6373ea274eb39e39
|
Subproject commit 03ff681a61cb03a43c6f008601a6e6090e9df2bd
|
||||||
|
|
@ -30,6 +30,7 @@
|
||||||
#include "mqtt_client.h"
|
#include "mqtt_client.h"
|
||||||
#include "esp_netif.h"
|
#include "esp_netif.h"
|
||||||
#include "esp_log.h"
|
#include "esp_log.h"
|
||||||
|
#include "esp_wifi_types.h"
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
|
|
@ -46,9 +47,9 @@ typedef struct
|
||||||
|
|
||||||
//#define DEFAULT_FALLBACK_DNS "8.8.8.8"
|
//#define DEFAULT_FALLBACK_DNS "8.8.8.8"
|
||||||
|
|
||||||
QueueHandle_t MQTT1MessagesQueueHandle;
|
//QueueHandle_t MQTT1MessagesQueueHandle;
|
||||||
QueueHandle_t MQTT2MessagesQueueHandle;
|
//QueueHandle_t MQTT2MessagesQueueHandle;
|
||||||
EventGroupHandle_t transport_event_group;
|
//EventGroupHandle_t transport_event_group;
|
||||||
|
|
||||||
wifi_ap_record_t* GetWiFiAPRecord(uint8_t n);
|
wifi_ap_record_t* GetWiFiAPRecord(uint8_t n);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@
|
||||||
#include "libespfs/espfs_format.h"
|
#include "libespfs/espfs_format.h"
|
||||||
#include "libespfs/vfs.h"
|
#include "libespfs/vfs.h"
|
||||||
|
|
||||||
espfs_fs_t *fs;
|
|
||||||
void init_rom_fs(const char *root);
|
void init_rom_fs(const char *root);
|
||||||
|
|
||||||
#endif /* COMPONENTS_WEB_GUI_APPLICATION_INCLUDE_ROMFS_H_ */
|
#endif /* COMPONENTS_WEB_GUI_APPLICATION_INCLUDE_ROMFS_H_ */
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,8 @@
|
||||||
|
|
||||||
static const char *TAG = "HTTPServerPrint";
|
static const char *TAG = "HTTPServerPrint";
|
||||||
|
|
||||||
|
extern espfs_fs_t *fs;
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
IP,
|
IP,
|
||||||
|
|
@ -122,11 +124,11 @@ static void HTTPPrint_time(char *VarData, void *arg)
|
||||||
{
|
{
|
||||||
time_t now;
|
time_t now;
|
||||||
time(&now);
|
time(&now);
|
||||||
snprintf(VarData, MAX_DYNVAR_LENGTH, "%d", (uint32_t) now);
|
snprintf(VarData, MAX_DYNVAR_LENGTH, "%d", (int) now);
|
||||||
}
|
}
|
||||||
static void HTTPPrint_uptime(char *VarData, void *arg)
|
static void HTTPPrint_uptime(char *VarData, void *arg)
|
||||||
{
|
{
|
||||||
snprintf(VarData, MAX_DYNVAR_LENGTH, "%d", GetUpTime());
|
snprintf(VarData, MAX_DYNVAR_LENGTH, "%d", (int)GetUpTime());
|
||||||
}
|
}
|
||||||
|
|
||||||
static void HTTPPrint_status_fail(char *VarData, void *arg)
|
static void HTTPPrint_status_fail(char *VarData, void *arg)
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,8 @@
|
||||||
#include "HTTPServer.h"
|
#include "HTTPServer.h"
|
||||||
#include "sdkconfig.h"
|
#include "sdkconfig.h"
|
||||||
|
|
||||||
|
extern espfs_fs_t *fs;
|
||||||
|
|
||||||
const char GZIP_SIGN[] = { 0x1f, 0x8b, 0x08 };
|
const char GZIP_SIGN[] = { 0x1f, 0x8b, 0x08 };
|
||||||
|
|
||||||
static esp_err_t GETHandler(httpd_req_t *req);
|
static esp_err_t GETHandler(httpd_req_t *req);
|
||||||
|
|
|
||||||
20
src/MQTT.c
20
src/MQTT.c
|
|
@ -24,6 +24,7 @@
|
||||||
#include "NetTransport.h"
|
#include "NetTransport.h"
|
||||||
#include "MQTT.h"
|
#include "MQTT.h"
|
||||||
|
|
||||||
|
|
||||||
#define MQTT_DEBUG_MODE 1
|
#define MQTT_DEBUG_MODE 1
|
||||||
|
|
||||||
#define MQTT_MESSAGE_BUFER_LENTH 5 //size of mqtt queue
|
#define MQTT_MESSAGE_BUFER_LENTH 5 //size of mqtt queue
|
||||||
|
|
@ -33,6 +34,9 @@
|
||||||
|
|
||||||
#if CONFIG_WEBGUIAPP_MQTT_ENABLE
|
#if CONFIG_WEBGUIAPP_MQTT_ENABLE
|
||||||
|
|
||||||
|
QueueHandle_t MQTT1MessagesQueueHandle;
|
||||||
|
QueueHandle_t MQTT2MessagesQueueHandle;
|
||||||
|
|
||||||
static SemaphoreHandle_t xSemaphoreMQTTHandle = NULL;
|
static SemaphoreHandle_t xSemaphoreMQTTHandle = NULL;
|
||||||
static StaticSemaphore_t xSemaphoreMQTTBuf;
|
static StaticSemaphore_t xSemaphoreMQTTBuf;
|
||||||
static StaticQueue_t xStaticMQTT1MessagesQueue;
|
static StaticQueue_t xStaticMQTT1MessagesQueue;
|
||||||
|
|
@ -107,7 +111,7 @@ static void mqtt_system_event_handler(int idx, void *handler_args, esp_event_bas
|
||||||
{
|
{
|
||||||
xSemaphoreTake(xSemaphoreMQTTHandle, pdMS_TO_TICKS(1000));
|
xSemaphoreTake(xSemaphoreMQTTHandle, pdMS_TO_TICKS(1000));
|
||||||
#if MQTT_DEBUG_MODE > 0
|
#if MQTT_DEBUG_MODE > 0
|
||||||
ESP_LOGI(TAG, "Event dispatched from event loop base=%s, event_id=%d", base, event_id);
|
ESP_LOGI(TAG, "Event dispatched from event loop base=%s, event_id=%d", base, (int)event_id);
|
||||||
#endif
|
#endif
|
||||||
esp_mqtt_event_handle_t event = event_data;
|
esp_mqtt_event_handle_t event = event_data;
|
||||||
esp_mqtt_client_handle_t client = event->client;
|
esp_mqtt_client_handle_t client = event->client;
|
||||||
|
|
@ -286,14 +290,22 @@ static void start_mqtt()
|
||||||
itoa(GetSysConf()->mqttStation[i].ServerPort, tmp, 10);
|
itoa(GetSysConf()->mqttStation[i].ServerPort, tmp, 10);
|
||||||
strcat(url, ":");
|
strcat(url, ":");
|
||||||
strcat(url, tmp);
|
strcat(url, tmp);
|
||||||
mqtt_cfg.uri = url;
|
//mqtt_cfg.uri = url;
|
||||||
mqtt_cfg.username = GetSysConf()->mqttStation[i].UserName;
|
mqtt_cfg.broker.address.uri = url;
|
||||||
mqtt_cfg.password = GetSysConf()->mqttStation[i].UserPass;
|
//mqtt_cfg.username = GetSysConf()->mqttStation[i].UserName;
|
||||||
|
mqtt_cfg.credentials.username = GetSysConf()->mqttStation[i].UserName;
|
||||||
|
//mqtt_cfg.password = GetSysConf()->mqttStation[i].UserPass;
|
||||||
|
mqtt_cfg.credentials.authentication.password = GetSysConf()->mqttStation[i].UserPass;
|
||||||
strcpy(tmp, GetSysConf()->mqttStation[i].ClientID);
|
strcpy(tmp, GetSysConf()->mqttStation[i].ClientID);
|
||||||
strcat(tmp, "-");
|
strcat(tmp, "-");
|
||||||
strcat(tmp, GetSysConf()->ID);
|
strcat(tmp, GetSysConf()->ID);
|
||||||
|
<<<<<<< src/MQTT.c
|
||||||
|
//mqtt_cfg.client_id = tmp;
|
||||||
|
mqtt_cfg.credentials.client_id = tmp;
|
||||||
|
=======
|
||||||
mqtt_cfg.client_id = tmp;
|
mqtt_cfg.client_id = tmp;
|
||||||
mqtt_cfg.reconnect_timeout_ms = MQTT_RECONNECT_TIMEOUT * 1000;
|
mqtt_cfg.reconnect_timeout_ms = MQTT_RECONNECT_TIMEOUT * 1000;
|
||||||
|
>>>>>>> src/MQTT.c
|
||||||
mqtt[i].is_connected = false;
|
mqtt[i].is_connected = false;
|
||||||
mqtt[i].mqtt_index = i;
|
mqtt[i].mqtt_index = i;
|
||||||
//mqtt_cfg.user_context = (void*) &mqtt[i];
|
//mqtt_cfg.user_context = (void*) &mqtt[i];
|
||||||
|
|
|
||||||
|
|
@ -51,6 +51,7 @@
|
||||||
#include "romfs.h"
|
#include "romfs.h"
|
||||||
#include "HTTPServer.h"
|
#include "HTTPServer.h"
|
||||||
|
|
||||||
|
extern espfs_fs_t *fs;
|
||||||
|
|
||||||
#define PANEL_MESSAGE_LENGTH 32 //base message length, mainly depended by radio requirements
|
#define PANEL_MESSAGE_LENGTH 32 //base message length, mainly depended by radio requirements
|
||||||
#define MAX_JSON_MESSAGE 256 //max size of mqtt message to publish
|
#define MAX_JSON_MESSAGE 256 //max size of mqtt message to publish
|
||||||
|
|
|
||||||
|
|
@ -73,6 +73,9 @@ esp_err_t _http_event_handler(esp_http_client_event_t *evt)
|
||||||
case HTTP_EVENT_DISCONNECTED:
|
case HTTP_EVENT_DISCONNECTED:
|
||||||
ESP_LOGD(TAG, "HTTP_EVENT_DISCONNECTED");
|
ESP_LOGD(TAG, "HTTP_EVENT_DISCONNECTED");
|
||||||
break;
|
break;
|
||||||
|
case HTTP_EVENT_REDIRECT:
|
||||||
|
ESP_LOGD(TAG, "HTTP_EVENT_REDIRECT");
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -173,7 +173,7 @@ esp_err_t WebGuiAppInit(void)
|
||||||
static void InitSysIO(void)
|
static void InitSysIO(void)
|
||||||
{
|
{
|
||||||
#if (MAIN_FUNCTIONAL_BUTTON_GPIO >= 0)
|
#if (MAIN_FUNCTIONAL_BUTTON_GPIO >= 0)
|
||||||
gpio_pad_select_gpio(MAIN_FUNCTIONAL_BUTTON_GPIO);
|
esp_rom_gpio_pad_select_gpio(MAIN_FUNCTIONAL_BUTTON_GPIO);
|
||||||
gpio_set_direction(MAIN_FUNCTIONAL_BUTTON_GPIO, GPIO_MODE_INPUT);
|
gpio_set_direction(MAIN_FUNCTIONAL_BUTTON_GPIO, GPIO_MODE_INPUT);
|
||||||
gpio_set_pull_mode(MAIN_FUNCTIONAL_BUTTON_GPIO, GPIO_PULLUP_ONLY);
|
gpio_set_pull_mode(MAIN_FUNCTIONAL_BUTTON_GPIO, GPIO_PULLUP_ONLY);
|
||||||
gpio_pullup_en(MAIN_FUNCTIONAL_BUTTON_GPIO);
|
gpio_pullup_en(MAIN_FUNCTIONAL_BUTTON_GPIO);
|
||||||
|
|
@ -241,7 +241,7 @@ static void ResetSysConfig(SYS_CONFIG *Conf)
|
||||||
|
|
||||||
UINT32_VAL d;
|
UINT32_VAL d;
|
||||||
GetChipId((uint8_t*) d.v);
|
GetChipId((uint8_t*) d.v);
|
||||||
snprintf(Conf->SN, 11, "%010u", swap(d.Val));
|
snprintf(Conf->SN, 11, "%010u", (unsigned int)swap(d.Val));
|
||||||
|
|
||||||
memcpy(Conf->NetBIOSName, CONFIG_WEBGUIAPP_HOSTNAME,
|
memcpy(Conf->NetBIOSName, CONFIG_WEBGUIAPP_HOSTNAME,
|
||||||
sizeof(CONFIG_WEBGUIAPP_HOSTNAME));
|
sizeof(CONFIG_WEBGUIAPP_HOSTNAME));
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,7 @@
|
||||||
#include "NetTransport.h"
|
#include "NetTransport.h"
|
||||||
#include "freertos/FreeRTOS.h"
|
#include "freertos/FreeRTOS.h"
|
||||||
#include "freertos/task.h"
|
#include "freertos/task.h"
|
||||||
|
#include "esp_mac.h"
|
||||||
|
|
||||||
esp_netif_t *sta_netif;
|
esp_netif_t *sta_netif;
|
||||||
esp_netif_t *ap_netif;
|
esp_netif_t *ap_netif;
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,8 @@
|
||||||
|
|
||||||
#include "romfs.h"
|
#include "romfs.h"
|
||||||
|
|
||||||
|
espfs_fs_t *fs;
|
||||||
|
|
||||||
extern const uint8_t espfs_bin[];
|
extern const uint8_t espfs_bin[];
|
||||||
espfs_fs_t *fs;
|
espfs_fs_t *fs;
|
||||||
espfs_config_t espfs_config = {
|
espfs_config_t espfs_config = {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user