removed wifi
This commit is contained in:
parent
2e39c666da
commit
a40c5c366c
@ -8,13 +8,8 @@
|
||||
#include "lwip/err.h"
|
||||
#include "lwip/sys.h"
|
||||
|
||||
#include "esp_wifi.h"
|
||||
#include "esp_log.h"
|
||||
#include "esp_vfs_fat.h"
|
||||
#include "mdns.h"
|
||||
|
||||
#include "APlib.h"
|
||||
#include "HTTPServe.h"
|
||||
#include "ledController.h"
|
||||
#include "scd4x_i2c.h"
|
||||
#include "sensirion_i2c_hal.h"
|
||||
@ -39,28 +34,8 @@ void app_main(void){
|
||||
// init LEDs driver
|
||||
init_led_driver(conf->leds, LED_NUMBER);
|
||||
|
||||
// init server stuff if wifi enabled
|
||||
if(conf->wireless & C_WL_NEED_HTTP){
|
||||
ESP_LOGI("main", "%i", conf->wireless);
|
||||
// init tcpip
|
||||
ESP_ERROR_CHECK(esp_netif_init());
|
||||
ESP_ERROR_CHECK(esp_event_loop_create_default());
|
||||
|
||||
// start avahi
|
||||
init_avahi(conf->hostname);
|
||||
|
||||
// start httpd server
|
||||
init_http_server(conf);
|
||||
}
|
||||
// start wifi
|
||||
switch(conf->wireless){
|
||||
case C_WL_MODE_AP:
|
||||
wifi_init_softap(conf->wifi_config);
|
||||
break;
|
||||
case C_WL_MODE_BLE:
|
||||
initBle(conf);
|
||||
break;
|
||||
}
|
||||
// init BLE
|
||||
initBle(conf);
|
||||
|
||||
// start sensor
|
||||
init_scd4x();
|
||||
@ -112,32 +87,6 @@ void init_nvs(void){
|
||||
ESP_ERROR_CHECK(ret);
|
||||
}
|
||||
|
||||
void init_avahi(char* hostname){
|
||||
ESP_LOGI("avahi", "hostname : %s", hostname);
|
||||
ESP_ERROR_CHECK(mdns_init());
|
||||
ESP_ERROR_CHECK(mdns_hostname_set(hostname));
|
||||
ESP_ERROR_CHECK(mdns_instance_name_set(hostname));
|
||||
}
|
||||
|
||||
void init_http_server(configuration_data_t* main_conf){
|
||||
// mount http server fat partition
|
||||
const esp_vfs_fat_mount_config_t mount_config = {
|
||||
.max_files = 10,
|
||||
.format_if_mount_failed = false,
|
||||
.allocation_unit_size = CONFIG_WL_SECTOR_SIZE
|
||||
};
|
||||
ESP_ERROR_CHECK(esp_vfs_fat_rawflash_mount("/http", "http", &mount_config));
|
||||
|
||||
// start http server
|
||||
HTTP_serve_config_t serv_config = {
|
||||
.mountpoint = "/http",
|
||||
.getUri = "/*",
|
||||
.postUri = "/*",
|
||||
.apiUri = "/api",
|
||||
};
|
||||
|
||||
ESP_ERROR_CHECK(start_server(serv_config, main_conf));
|
||||
}
|
||||
|
||||
void init_scd4x(){
|
||||
sensirion_i2c_hal_init(10,9);
|
||||
|
@ -3,4 +3,3 @@
|
||||
nvs, data, nvs, 0x9000, 0x6000,
|
||||
phy_init, data, phy, 0xf000, 0x1000,
|
||||
factory, app, factory, 0x10000, 2M,
|
||||
http, data, fat, , 512k,
|
||||
|
|
Loading…
x
Reference in New Issue
Block a user