This commit is contained in:
Mithras 2020-03-30 13:21:12 +02:00
parent 641d9523d1
commit b1798f21fa
31 changed files with 24982 additions and 24899 deletions

View File

@ -14,6 +14,11 @@
"terminal.h": "c",
"lvgl.h": "c",
"lvgl_driver.h": "c",
"lv_ex_conf.h": "c"
"lv_ex_conf.h": "c",
"sysmon.h": "c",
"lv_conf_template.h": "c",
"lv_conf.h": "c",
"esp_netif.h": "c",
"wifi.h": "c"
}
}

View File

@ -1 +1 @@
9c71743eb83e0496e3c4a6acb7795111 /home/mithras/esp/bakalarka/build/bakalarka.bin
6322a866903aca85ea9f87cfacb9e546 /home/mithras/esp/bakalarka/build/bakalarka.bin

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -589,6 +589,13 @@
/home/mithras/esp/bakalarka/build/esp-idf/main/CMakeFiles/install/local.dir
/home/mithras/esp/bakalarka/build/esp-idf/main/CMakeFiles/rebuild_cache.dir
/home/mithras/esp/bakalarka/build/esp-idf/main/CMakeFiles/install.dir
/home/mithras/esp/bakalarka/build/esp-idf/wifi/CMakeFiles/install/strip.dir
/home/mithras/esp/bakalarka/build/esp-idf/wifi/CMakeFiles/edit_cache.dir
/home/mithras/esp/bakalarka/build/esp-idf/wifi/CMakeFiles/__idf_wifi.dir
/home/mithras/esp/bakalarka/build/esp-idf/wifi/CMakeFiles/rebuild_cache.dir
/home/mithras/esp/bakalarka/build/esp-idf/wifi/CMakeFiles/list_install_components.dir
/home/mithras/esp/bakalarka/build/esp-idf/wifi/CMakeFiles/install/local.dir
/home/mithras/esp/bakalarka/build/esp-idf/wifi/CMakeFiles/install.dir
/home/mithras/esp/bakalarka/build/esp-idf/files/CMakeFiles/install/strip.dir
/home/mithras/esp/bakalarka/build/esp-idf/files/CMakeFiles/edit_cache.dir
/home/mithras/esp/bakalarka/build/esp-idf/files/CMakeFiles/__idf_files.dir
@ -659,13 +666,6 @@
/home/mithras/esp/bakalarka/build/esp-idf/display/CMakeFiles/install/local.dir
/home/mithras/esp/bakalarka/build/esp-idf/display/CMakeFiles/rebuild_cache.dir
/home/mithras/esp/bakalarka/build/esp-idf/display/CMakeFiles/install.dir
/home/mithras/esp/bakalarka/build/esp-idf/wifi/CMakeFiles/install/strip.dir
/home/mithras/esp/bakalarka/build/esp-idf/wifi/CMakeFiles/edit_cache.dir
/home/mithras/esp/bakalarka/build/esp-idf/wifi/CMakeFiles/__idf_wifi.dir
/home/mithras/esp/bakalarka/build/esp-idf/wifi/CMakeFiles/rebuild_cache.dir
/home/mithras/esp/bakalarka/build/esp-idf/wifi/CMakeFiles/list_install_components.dir
/home/mithras/esp/bakalarka/build/esp-idf/wifi/CMakeFiles/install/local.dir
/home/mithras/esp/bakalarka/build/esp-idf/wifi/CMakeFiles/install.dir
/home/mithras/esp/bakalarka/build/esp-idf/https_server/CMakeFiles/install/strip.dir
/home/mithras/esp/bakalarka/build/esp-idf/https_server/CMakeFiles/edit_cache.dir
/home/mithras/esp/bakalarka/build/esp-idf/https_server/CMakeFiles/list_install_components.dir

Binary file not shown.

Binary file not shown.

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@ -106,6 +106,7 @@ if(NOT CMAKE_INSTALL_LOCAL_ONLY)
include("/home/mithras/esp/bakalarka/build/esp-idf/unity/cmake_install.cmake")
include("/home/mithras/esp/bakalarka/build/esp-idf/wifi_provisioning/cmake_install.cmake")
include("/home/mithras/esp/bakalarka/build/esp-idf/main/cmake_install.cmake")
include("/home/mithras/esp/bakalarka/build/esp-idf/wifi/cmake_install.cmake")
include("/home/mithras/esp/bakalarka/build/esp-idf/files/cmake_install.cmake")
include("/home/mithras/esp/bakalarka/build/esp-idf/ca/cmake_install.cmake")
include("/home/mithras/esp/bakalarka/build/esp-idf/cmd_nvs/cmake_install.cmake")
@ -116,7 +117,6 @@ if(NOT CMAKE_INSTALL_LOCAL_ONLY)
include("/home/mithras/esp/bakalarka/build/esp-idf/lvgl_tft/cmake_install.cmake")
include("/home/mithras/esp/bakalarka/build/esp-idf/lvgl_touch/cmake_install.cmake")
include("/home/mithras/esp/bakalarka/build/esp-idf/display/cmake_install.cmake")
include("/home/mithras/esp/bakalarka/build/esp-idf/wifi/cmake_install.cmake")
include("/home/mithras/esp/bakalarka/build/esp-idf/https_server/cmake_install.cmake")
endif()

Binary file not shown.

File diff suppressed because one or more lines are too long

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -63,6 +63,7 @@
/home/mithras/esp/bakalarka/build/esp-idf/unity/libunity.a
/home/mithras/esp/bakalarka/build/esp-idf/wifi_provisioning/libwifi_provisioning.a
/home/mithras/esp/bakalarka/build/esp-idf/main/libmain.a
/home/mithras/esp/bakalarka/build/esp-idf/wifi/libwifi.a
/home/mithras/esp/bakalarka/build/esp-idf/files/libfiles.a
/home/mithras/esp/bakalarka/build/esp-idf/ca/libca.a
/home/mithras/esp/bakalarka/build/esp-idf/cmd_nvs/libcmd_nvs.a
@ -73,5 +74,4 @@
/home/mithras/esp/bakalarka/build/esp-idf/lvgl_tft/liblvgl_tft.a
/home/mithras/esp/bakalarka/build/esp-idf/lvgl_touch/liblvgl_touch.a
/home/mithras/esp/bakalarka/build/esp-idf/display/libdisplay.a
/home/mithras/esp/bakalarka/build/esp-idf/wifi/libwifi.a
/home/mithras/esp/bakalarka/build/esp-idf/https_server/libhttps_server.a

View File

@ -63,6 +63,7 @@ $<TARGET_FILE:__idf_ulp>
$<TARGET_FILE:__idf_unity>
$<TARGET_FILE:__idf_wifi_provisioning>
$<TARGET_FILE:__idf_main>
$<TARGET_FILE:__idf_wifi>
$<TARGET_FILE:__idf_files>
$<TARGET_FILE:__idf_ca>
$<TARGET_FILE:__idf_cmd_nvs>
@ -73,5 +74,4 @@ $<TARGET_FILE:__idf_lv_examples>
$<TARGET_FILE:__idf_lvgl_tft>
$<TARGET_FILE:__idf_lvgl_touch>
$<TARGET_FILE:__idf_display>
$<TARGET_FILE:__idf_wifi>
$<TARGET_FILE:__idf_https_server>

View File

@ -1399,6 +1399,25 @@ rule CXX_STATIC_LIBRARY_LINKER____idf_main
restat = $RESTAT
#############################################
# Rule for compiling C files.
rule C_COMPILER____idf_wifi
depfile = $DEP_FILE
deps = gcc
command = /home/mithras/.espressif/tools/xtensa-esp32-elf/esp-2019r2-8.2.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc $DEFINES $INCLUDES $FLAGS -MD -MT $out -MF $DEP_FILE -o $out -c $in
description = Building C object $out
#############################################
# Rule for linking CXX static library.
rule CXX_STATIC_LIBRARY_LINKER____idf_wifi
command = $PRE_LINK && /usr/bin/cmake -E remove $TARGET_FILE && /home/mithras/.espressif/tools/xtensa-esp32-elf/esp-2019r2-8.2.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-ar qc $TARGET_FILE $LINK_FLAGS $in && /home/mithras/.espressif/tools/xtensa-esp32-elf/esp-2019r2-8.2.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-ranlib $TARGET_FILE && $POST_BUILD
description = Linking CXX static library $TARGET_FILE
restat = $RESTAT
#############################################
# Rule for compiling C files.
@ -1589,25 +1608,6 @@ rule CXX_STATIC_LIBRARY_LINKER____idf_display
restat = $RESTAT
#############################################
# Rule for compiling C files.
rule C_COMPILER____idf_wifi
depfile = $DEP_FILE
deps = gcc
command = /home/mithras/.espressif/tools/xtensa-esp32-elf/esp-2019r2-8.2.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc $DEFINES $INCLUDES $FLAGS -MD -MT $out -MF $DEP_FILE -o $out -c $in
description = Building C object $out
#############################################
# Rule for linking CXX static library.
rule CXX_STATIC_LIBRARY_LINKER____idf_wifi
command = $PRE_LINK && /usr/bin/cmake -E remove $TARGET_FILE && /home/mithras/.espressif/tools/xtensa-esp32-elf/esp-2019r2-8.2.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-ar qc $TARGET_FILE $LINK_FLAGS $in && /home/mithras/.espressif/tools/xtensa-esp32-elf/esp-2019r2-8.2.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-ranlib $TARGET_FILE && $POST_BUILD
description = Linking CXX static library $TARGET_FILE
restat = $RESTAT
#############################################
# Rule for compiling ASM files.

View File

@ -1,4 +1,4 @@
idf_component_register(SRCS "display.c"
INCLUDE_DIRS .
REQUIRES lvgl_esp32_drivers lvgl lv_examples lvgl_tft lvgl_touch )
REQUIRES lvgl_esp32_drivers lvgl lv_examples lvgl_tft lvgl_touch mbedtls wifi)
target_compile_definitions(${COMPONENT_LIB} PRIVATE LV_CONF_INCLUDE_SIMPLE=1)

View File

@ -26,18 +26,40 @@
#include "lvgl/lvgl.h"
#include "lvgl_driver.h"
//#include "lv_examples/lv_apps/demo/demo.h"
#include "lv_examples/lv_apps/sysmon/sysmon.h"
//#include "lv_examples/lv_apps/sysmon/sysmon.h"
//#include "../lvgl/lvgl.h"
#include "lv_conf.h"
#include "lvgl.h"
#include "display.h"
#include <stdio.h>
#include <string.h>
#include "esp_log.h"
#include "esp_console.h"
#include "argtable3/argtable3.h"
#include "freertos/FreeRTOS.h"
#include "freertos/event_groups.h"
#include "esp_wifi.h"
#include "esp_netif.h"
#include "esp_event.h"
#include "wifi.h"
/*********************
* DEFINES
*********************/
static lv_obj_t* win;
static lv_obj_t* table;
extern esp_netif_t *sta_netif;
static lv_obj_t* label_bottom;
/**********************
* STATIC PROTOTYPES
**********************/
static void IRAM_ATTR lv_tick_task(void *arg);
static lv_obj_t * status_create(void);
static void fill_the_table();
/**********************
* APPLICATION MAIN
**********************
@ -48,6 +70,7 @@ void app_main() {
xTaskCreatePinnedToCore(guiTask, "gui", 4096*2, NULL, 0, NULL, 1);
}
**/
static void IRAM_ATTR lv_tick_task(void *arg) {
(void) arg;
@ -59,7 +82,9 @@ static void IRAM_ATTR lv_tick_task(void *arg) {
//you should lock on the very same semaphore!
SemaphoreHandle_t xGuiSemaphore;
void guiTask() {
void guiTask(void* parameter) {
struct ca_status buff = *(struct ca_status*)parameter;
xGuiSemaphore = xSemaphoreCreateMutex();
lv_init();
@ -96,17 +121,122 @@ void guiTask() {
ESP_ERROR_CHECK(esp_timer_start_periodic(periodic_timer, 10*1000)); //10ms (expressed as microseconds)
//demo_create();
sysmon_create();
//sysmon_create();
status_create();
while (1) {
vTaskDelay(1);
vTaskDelay(10);
//Try to lock the semaphore, if success, call lvgl stuff
if (xSemaphoreTake(xGuiSemaphore, (TickType_t)10) == pdTRUE) {
lv_task_handler();
xSemaphoreGive(xGuiSemaphore);
fill_the_table(buff);
}
}
//A task should NEVER return
vTaskDelete(NULL);
}
lv_obj_t * status_create(void){
static lv_style_t style_bg;
lv_style_copy(&style_bg,&lv_style_plain);
style_bg.body.main_color = lv_color_make(211,211,211);
win = lv_obj_create(lv_scr_act(),NULL);
lv_obj_set_size(win,LV_HOR_RES,LV_VER_RES);
lv_obj_set_style(win,&style_bg);
static lv_style_t title;
lv_style_copy(&title,&lv_style_transp);
title.text.color = LV_COLOR_BLACK;
lv_obj_t* label = lv_label_create(win,NULL);
lv_obj_set_style(label,&title);
lv_label_set_align(label,LV_LABEL_ALIGN_CENTER);
lv_label_set_text(label,"Certificate Authority on ESP32");
label_bottom = lv_label_create(win,NULL);
lv_obj_set_style(label_bottom,&title);
lv_label_set_align(label_bottom,LV_LABEL_ALIGN_CENTER);
lv_label_set_text(label_bottom,"Certificate Authority on ESP22222");
lv_obj_align(label_bottom, NULL, LV_ALIGN_IN_BOTTOM_LEFT, 0, 0);
static lv_style_t style_cell1;
lv_style_copy(&style_cell1, &lv_style_plain);
style_cell1.body.border.width = 1;
style_cell1.body.border.color = LV_COLOR_BLACK;
style_cell1.body.main_color = LV_COLOR_SILVER;
style_cell1.body.grad_color = LV_COLOR_SILVER;
table = lv_table_create(win,NULL);
lv_table_set_style(table,LV_TABLE_STYLE_CELL1,&style_cell1);
lv_table_set_row_cnt(table,4);
lv_table_set_col_cnt(table,2);
lv_obj_align(table, NULL, LV_ALIGN_IN_LEFT_MID, 0, 0);
lv_table_set_col_width(table,0,(LV_HOR_RES-5)/2);
lv_table_set_col_width(table,1,(LV_HOR_RES-15)/2);
lv_table_set_cell_value(table,0,0,"WIFI");
lv_table_set_cell_value(table,1,0,"Webserver");
lv_table_set_cell_value(table,2,0,"Certificates");
lv_table_set_cell_value(table,3,0,"Initialized");
return win;
}
void fill_the_table(struct ca_status buff){
// struct ca_status buff = *(struct ca_status*)parameter;
esp_netif_ip_info_t ip_info;
esp_netif_get_ip_info(sta_netif,&ip_info);
char buffer[17];
esp_ip4addr_ntoa(&ip_info.ip,buffer,17);
lv_label_set_text(label_bottom,buffer);
//ESP_LOGI("IP ADRESA","%s",buffer);
if (buff.wifi == true)
{
lv_table_set_cell_value(table,0,1,"YES");
}else
{
lv_table_set_cell_value(table,0,1,"OFF");
}
if (buff.webserver == true)
{
lv_table_set_cell_value(table,1,1,"YES");
}else
{
lv_table_set_cell_value(table,1,1,"OFF");
}
if (buff.init == true)
{
lv_table_set_cell_value(table,3,1,"YES");
}else
{
lv_table_set_cell_value(table,3,1,"NO");
lv_table_set_cell_value(table,2,1,"0");
}
//printf("My IP: %s \n", buffer);
//printf("My GW: " IPSTR "\n", IP2STR(&ip_info.gw));
//printf("My NETMASK: " IPSTR "\n", IP2STR(&ip_info.netmask));
//lv_table_set_cell_value(table,0,1,"OFF");
//lv_table_set_cell_value(table,1,1,"OFF");
//lv_table_set_cell_value(table,3,1,"NO");
}

View File

@ -1 +1,7 @@
void guiTask();
void guiTask(void* parameter);
struct ca_status{
bool wifi;
bool webserver;
unsigned int serial;
bool init;
};

View File

@ -1,3 +1,3 @@
idf_component_register(SRCS "file.c"
INCLUDE_DIRS .
REQUIRES spiffs spi_flash)
REQUIRES spiffs spi_flash mbedtls wifi)

View File

@ -61,6 +61,7 @@ void create_file(char adresa[],char comment[]){
fprintf(f, comment);
fclose(f);
ESP_LOGI(TAG, "File written");
}
void read_file(char adresa[]){

View File

@ -9,12 +9,11 @@
#include "esp_netif.h"
#include "esp_event.h"
#include "wifi.h"
#define JOIN_TIMEOUT_MS (10000)
static EventGroupHandle_t wifi_event_group;
const int CONNECTED_BIT = BIT0;
extern esp_netif_t *sta_netif = NULL;
static void event_handler(void* arg, esp_event_base_t event_base,
int32_t event_id, void* event_data)
@ -38,7 +37,7 @@ static void initialise_wifi(void)
//ESP_ERROR_CHECK(esp_event_loop_create_default());
esp_netif_t *ap_netif = esp_netif_create_default_wifi_ap();
assert(ap_netif);
esp_netif_t *sta_netif = esp_netif_create_default_wifi_sta();
sta_netif = esp_netif_create_default_wifi_sta();
assert(sta_netif);
wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
ESP_ERROR_CHECK( esp_wifi_init(&cfg) );
@ -48,6 +47,7 @@ static void initialise_wifi(void)
ESP_ERROR_CHECK( esp_wifi_set_mode(WIFI_MODE_NULL) );
ESP_ERROR_CHECK( esp_wifi_start() );
initialized = true;
}
@ -100,6 +100,10 @@ static int connect(int argc, char **argv)
return 1;
}
ESP_LOGI(__func__, "Connected");
// extern esp_netif_t *sta_netif;
return 0;
}

View File

@ -43,6 +43,15 @@
#include "lv_examples/lv_apps/demo/demo.h"
#include "display.h"
#include "esp_netif.h"
struct ca_status display = {
.wifi = false,
.webserver = false,
.serial = 0,
.init = false
};
static const char* TAG = "konzola";
@ -143,7 +152,8 @@ static void initialize_console(void)
void app_main(void)
{
xTaskCreatePinnedToCore(guiTask, "gui", 4096*2, NULL, 0, NULL, 1);
xTaskCreatePinnedToCore(guiTask, "gui", 4096*2, &display, 0, NULL, 1);
initialize_nvs();
init_memory();