refactored and updated build system;

prepared for wifi scan functionality;
This commit is contained in:
Bogdan Pilyugin 2023-01-08 12:40:39 +02:00
parent 717560a8d8
commit fef822aea7
12 changed files with 34 additions and 29 deletions

View File

@ -2,10 +2,12 @@ include(${CMAKE_CURRENT_LIST_DIR}/extlibs/jReadWrite/include.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/extlibs/libespfs/cmake/include.cmake) include(${CMAKE_CURRENT_LIST_DIR}/extlibs/libespfs/cmake/include.cmake)
if(CONFIG_WEBGUIAPP_LORAWAN_ENABLE) if(CONFIG_WEBGUIAPP_LORAWAN_ENABLE)
include(${CMAKE_CURRENT_LIST_DIR}/extlibs/ttn-esp32/include.cmake) set(lora_SRCS "src/LoRaWAN.c")
set(lora_SRCS "lorawan/LoRaWAN.c")
endif() endif()
if(CONFIG_WEBGUIAPP_GPRS_ENABLE)
set(gprs_SRCS "src/GSMTransport.c")
endif()
idf_component_register( idf_component_register(
@ -13,16 +15,17 @@ idf_component_register(
INCLUDE_DIRS ${jreadwrite_INCLUDE_DIRS} INCLUDE_DIRS ${jreadwrite_INCLUDE_DIRS}
SRCS ${lora_SRCS} SRCS ${lora_SRCS}
SRC_DIRS ${lora_SRC_DIRS} REQUIRES ttn-esp32
PRIV_REQUIRES ${lora_PRIV_REQUIRES}
INCLUDE_DIRS ${lora_INCLUDE_DIRS} SRCS ${gprs_SRCS}
REQUIRES esp_modem
SRCS ${libespfs_SRCS} SRCS ${libespfs_SRCS}
INCLUDE_DIRS ${libespfs_INCLUDE_DIRS} INCLUDE_DIRS ${libespfs_INCLUDE_DIRS}
PRIV_INCLUDE_DIRS ${libespfs_PRIV_INCLUDE_DIRS} PRIV_INCLUDE_DIRS ${libespfs_PRIV_INCLUDE_DIRS}
PRIV_REQUIRES ${libespfs_PRIV_REQUIRES} PRIV_REQUIRES ${libespfs_PRIV_REQUIRES}
SRCS "src/SystemConfiguration.c" SRCS "src/WebGUIAppMain.c"
"src/romfs.c" "src/romfs.c"
"src/spifs.c" "src/spifs.c"
"src/HTTPServer.c" "src/HTTPServer.c"
@ -32,7 +35,6 @@ idf_component_register(
"src/Helpers.c" "src/Helpers.c"
"src/NetTransport.c" "src/NetTransport.c"
"src/WiFiTransport.c" "src/WiFiTransport.c"
"src/GSMTransport.c"
"src/ETHTransport.c" "src/ETHTransport.c"
"src/SNTP.c" "src/SNTP.c"
"src/MQTT.c" "src/MQTT.c"
@ -45,19 +47,15 @@ idf_component_register(
"src" "src"
"extlibs/jReadWrite" "extlibs/jReadWrite"
EMBED_FILES "upload_script.html"
REQUIRES nvs_flash REQUIRES nvs_flash
spiffs spiffs
esp_http_server esp_http_server
mbedtls mbedtls
lwip lwip
mqtt mqtt
esp_modem
esp_https_ota esp_https_ota
app_update app_update
EMBED_FILES "upload_script.html"
) )

View File

@ -34,7 +34,6 @@
#include <sys/stat.h> #include <sys/stat.h>
#include "Helpers.h" #include "Helpers.h"
#include "SystemConfiguration.h"
#include "romfs.h" #include "romfs.h"
#include "NetTransport.h" #include "NetTransport.h"
@ -42,6 +41,7 @@
#include "esp_netif.h" #include "esp_netif.h"
#include "esp_eth.h" #include "esp_eth.h"
#include "mbedtls/base64.h" #include "mbedtls/base64.h"
#include "WebGUIAppMain.h"
#define MAX_DYNVAR_NAME_LENGTH 32 #define MAX_DYNVAR_NAME_LENGTH 32
#define MAX_DYNVAR_LENGTH 256 #define MAX_DYNVAR_LENGTH 256

View File

@ -19,9 +19,9 @@
* Description: * Description:
*/ */
#include "SystemConfiguration.h"
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <WebGUIAppMain.h>
#include "freertos/FreeRTOS.h" #include "freertos/FreeRTOS.h"
#include "freertos/task.h" #include "freertos/task.h"
#include "esp_netif.h" #include "esp_netif.h"

View File

@ -20,6 +20,8 @@
*/ */
#include <string.h> #include <string.h>
#include "../include/WebGUIAppMain.h"
#include "freertos/FreeRTOS.h" #include "freertos/FreeRTOS.h"
#include "freertos/event_groups.h" #include "freertos/event_groups.h"
#include "freertos/task.h" #include "freertos/task.h"
@ -29,7 +31,6 @@
#include "esp_modem_api.h" #include "esp_modem_api.h"
#include "esp_log.h" #include "esp_log.h"
#include "driver/gpio.h" #include "driver/gpio.h"
#include "SystemConfiguration.h"
#include "NetTransport.h" #include "NetTransport.h"
#if CONFIG_WEBGUIAPP_GPRS_ENABLE #if CONFIG_WEBGUIAPP_GPRS_ENABLE

View File

@ -397,13 +397,12 @@ static void HTTPPrint_emacadr(char *VarData, void *arg)
#endif #endif
#if CONFIG_WEBGUIAPP_GPRS_ENABLE
/*GSM MODEM*/
void HTTPPrint_gsmstat(char *VarData, void *arg) void HTTPPrint_gsmstat(char *VarData, void *arg)
{ {
PrintInterfaceState(VarData, arg, GetPPPNetifAdapter()); PrintInterfaceState(VarData, arg, GetPPPNetifAdapter());
} }
#if CONFIG_WEBGUIAPP_GPRS_ENABLE
/*GSM MODEM*/
void HTTPPrint_gsmen(char *VarData, void *arg) void HTTPPrint_gsmen(char *VarData, void *arg)
{ {
PrintCheckbox(VarData, arg, GetSysConf()->gsmSettings.Flags1.bIsGSMEnabled); PrintCheckbox(VarData, arg, GetSysConf()->gsmSettings.Flags1.bIsGSMEnabled);
@ -720,12 +719,12 @@ dyn_var_handler_t HANDLERS_ARRAY[] = {
{ "emacadr", sizeof("emacadr") - 1, &HTTPPrint_emacadr }, { "emacadr", sizeof("emacadr") - 1, &HTTPPrint_emacadr },
#endif #endif
{ "gsmstat", sizeof("gsmstat") - 1, &HTTPPrint_gsmstat },
#if CONFIG_WEBGUIAPP_GPRS_ENABLE #if CONFIG_WEBGUIAPP_GPRS_ENABLE
/*GSM modem*/ /*GSM modem*/
{ "gsmen", sizeof("gsmen") - 1, &HTTPPrint_gsmen }, { "gsmen", sizeof("gsmen") - 1, &HTTPPrint_gsmen },
{ "gsmstat", sizeof("gsmstat") - 1, &HTTPPrint_gsmstat },
{ "gsmmod", sizeof("gsmmod") - 1, &HTTPPrint_gsmmod }, { "gsmmod", sizeof("gsmmod") - 1, &HTTPPrint_gsmmod },
{ "gsmopr", sizeof("gsmopr") - 1, &HTTPPrint_gsmopr }, { "gsmopr", sizeof("gsmopr") - 1, &HTTPPrint_gsmopr },
{ "gimei", sizeof("gimei") - 1, &HTTPPrint_gimei }, { "gimei", sizeof("gimei") - 1, &HTTPPrint_gimei },

View File

@ -25,10 +25,10 @@
#include "freertos/task.h" #include "freertos/task.h"
#include "driver/gpio.h" #include "driver/gpio.h"
#include "Helpers.h" #include "Helpers.h"
#include "SystemConfiguration.h"
#include "NetTransport.h" #include "NetTransport.h"
#include "webguiapp.h" #include "webguiapp.h"
#include "LoRaWAN.h" #include "LoRaWAN.h"
#include "../include/WebGUIAppMain.h"
// Pins and other resources // Pins and other resources
/*Defined in global configuration*/ /*Defined in global configuration*/

View File

@ -18,10 +18,9 @@
* Author: Bogdan Pilyugin * Author: Bogdan Pilyugin
* Description: * Description:
*/ */
#include <WebGUIAppMain.h>
#include "esp_log.h" #include "esp_log.h"
#include "Helpers.h" #include "Helpers.h"
#include "SystemConfiguration.h"
#include "NetTransport.h" #include "NetTransport.h"
#include "MQTT.h" #include "MQTT.h"

View File

@ -19,8 +19,8 @@
* Description: * Description:
*/ */
#include <WebGUIAppMain.h>
#include "NetTransport.h" #include "NetTransport.h"
#include "SystemConfiguration.h"
#include "sdkconfig.h" #include "sdkconfig.h"
#include "lwip/netif.h" #include "lwip/netif.h"

View File

@ -29,10 +29,10 @@
#include "esp_https_ota.h" #include "esp_https_ota.h"
#include <string.h> #include <string.h>
#include "sdkconfig.h" #include "sdkconfig.h"
#include "SystemConfiguration.h"
#include "romfs.h" #include "romfs.h"
#include <sys/socket.h> #include <sys/socket.h>
#include <WebGUIAppMain.h>
#include "NetTransport.h" #include "NetTransport.h"
TaskHandle_t ota_task_handle; TaskHandle_t ota_task_handle;

View File

@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
* *
* \file SystemConfiguration.c * \file WebGUIAppMain.c
* \version 1.0 * \version 1.0
* \date 2022-08-13 * \date 2022-08-13
* \author Bogdan Pilyugin * \author Bogdan Pilyugin
@ -21,6 +21,8 @@
* \copyright Apache License, Version 2.0 * \copyright Apache License, Version 2.0
*/ */
#include "WebGUIAppMain.h"
#include <webguiapp.h> #include <webguiapp.h>
#include "stdlib.h" #include "stdlib.h"
#include "string.h" #include "string.h"
@ -31,7 +33,6 @@
#include "driver/adc.h" #include "driver/adc.h"
#include "driver/i2c.h" #include "driver/i2c.h"
#include "SystemConfiguration.h"
#include "romfs.h" #include "romfs.h"
#include "spifs.h" #include "spifs.h"
#include "NetTransport.h" #include "NetTransport.h"
@ -167,9 +168,16 @@ esp_err_t WebGuiAppInit(void)
{ {
//start all services //start all services
/*Wait for interfaces connected*/ /*Wait for interfaces connected*/
while (!(isPPPConnected() || while (!(
#ifdef CONFIG_WEBGUIAPP_GPRS_ENABLE
isPPPConnected() ||
#endif
#ifdef CONFIG_WEBGUIAPP_WIFI_ENABLE
isWIFIConnected() || isWIFIConnected() ||
#endif
#ifdef CONFIG_WEBGUIAPP_ETHERNET_ENABLE
isETHConnected() || isETHConnected() ||
#endif
++NetworkStartTimeout >= NETWORK_START_TIMEOUT)) ++NetworkStartTimeout >= NETWORK_START_TIMEOUT))
vTaskDelay(pdMS_TO_TICKS(1000)); vTaskDelay(pdMS_TO_TICKS(1000));

View File

@ -19,7 +19,7 @@
* Description: * Description:
*/ */
#include "SystemConfiguration.h" #include <WebGUIAppMain.h>
#include "esp_log.h" #include "esp_log.h"
#include "Helpers.h" #include "Helpers.h"
#include "esp_system.h" #include "esp_system.h"