From 7ffc947f1aab5f4fc7cb2d19ed29f96dd9b3be1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Hru=C5=A1ka?= Date: Sun, 1 Oct 2017 12:54:52 +0200 Subject: [PATCH] added client + testing command ESC#7 --- CMakeLists.txt | 42 ++++++++++++++++++++++---- Makefile | 6 +++- esphttpdconfig.mk | 62 --------------------------------------- esphttpdconfig.mk.example | 1 + front-end | 2 +- libesphttpd | 2 +- user/apars_short.c | 6 ++++ 7 files changed, 50 insertions(+), 71 deletions(-) delete mode 100644 esphttpdconfig.mk diff --git a/CMakeLists.txt b/CMakeLists.txt index 12dea35..9214dff 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -56,6 +56,8 @@ set(SOURCE_FILES libesphttpd/util/cgiwebsocket.c libesphttpd/util/cgiflash.c libesphttpd/util/captdns.c + libesphttpd/esphttpclient/httpclient.c + libesphttpd/include/httpclient.h esp_iot_sdk_v1.5.2/include/user_interface.h esp_iot_sdk_v1.5.2/include/upgrade.h @@ -85,9 +87,9 @@ set(SOURCE_FILES esp_iot_sdk_v1.5.2/include/json/jsontree.h esp_iot_sdk_v1.5.2/include/json/jsonparse.h esp_iot_sdk_v1.5.2/include/json/json.h - include/user_config.h include/ets_sys_extra.h + include/helpers.h user/io.c user/io.h user/cgi_wifi.c @@ -121,7 +123,6 @@ set(SOURCE_FILES user/wifimgr.h user/persist.c user/persist.h - include/helpers.h user/syscfg.c user/syscfg.h user/ascii.h @@ -139,9 +140,18 @@ set(SOURCE_FILES user/apars_osc.c user/apars_osc.h user/apars_dcs.c - user/apars_dcs.h user/uart_buffer.c user/uart_buffer.h user/jstring.c user/jstring.h user/character_sets.h user/utf8.h user/utf8.c user/cgi_logging.h) + user/apars_dcs.h + user/uart_buffer.c + user/uart_buffer.h + user/jstring.c + user/jstring.h + user/character_sets.h + user/utf8.h + user/utf8.c + user/cgi_logging.h) include_directories(include) +include_directories(libesphttpd/esphttpclient) include_directories(user) include_directories(libesphttpd/include) include_directories(libesphttpd/espfs) @@ -160,13 +170,33 @@ add_definitions( -DICACHE_FLASH_ATTR= -DICACHE_RODATA_ATTR= -DFLAG_GZIP=2 - -DADMIN_PASSWORD="asdf" + -DGIT_HASH_BACKEND="asdf" -DGIT_HASH_FRONTEND="asdf" -DGIT_HASH="blabla" + + -D__TIMEZONE__="UTC" + -DESPFS_HEATSHRINK + + -DDEBUG_ANSI=1 + -DDEBUG_ANSI_NOIMPL=1 + -DDEBUG_CAPTDNS=1 + -DDEBUG_CGI=0 + -DDEBUG_ESPFS=1 -DDEBUG_HEAP=1 + -DDEBUG_HTTP=1 + -DDEBUG_HTTPC=1 + -DDEBUG_INPUT=1 -DDEBUG_MALLOC=1 - -D__TIMEZONE__="UTC" - -DESPFS_HEATSHRINK) + -DDEBUG_PERSIST=1 + -DDEBUG_ROUTER=1 + -DDEBUG_UTFCACHE=1 + -DDEBUG_WIFI=1 + -DDEBUG_WS=1 + -DDEBUG_ROUTER=1 +) +# all the debug keys should be listed here ^ so clion thinks they are used +# and doesn't mess up the formatting and inspections + add_executable(ESPTerm ${SOURCE_FILES}) diff --git a/Makefile b/Makefile index a815b7a..b79afe8 100644 --- a/Makefile +++ b/Makefile @@ -54,7 +54,7 @@ APPGEN ?= $(SDK_BASE)/tools/gen_appbin.py TARGET = httpd # which modules (subdirectories) of the project to include in compiling -MODULES = user +MODULES = user esphttpclient EXTRA_INCDIR = include libesphttpd/include # libraries used in this project, mainly provided by the SDK @@ -194,6 +194,10 @@ endef web: $(Q) ./build_web.sh +updweb: + $(Q) cd front-end && git pull + $(Q) ./build_web.sh + parser: $(Q) ./build_parser.sh diff --git a/esphttpdconfig.mk b/esphttpdconfig.mk deleted file mode 100644 index e9eaebf..0000000 --- a/esphttpdconfig.mk +++ /dev/null @@ -1,62 +0,0 @@ -# --------------- esphttpd config options --------------- - -# If GZIP_COMPRESSION is set to "yes" then the static css, js, and html files will be compressed with gzip before added to the espfs image -# and will be served with gzip Content-Encoding header. -# This could speed up the downloading of these files, but might break compatibility with older web browsers not supporting gzip encoding -# because Accept-Encoding is simply ignored. Enable this option if you have large static files to serve (for e.g. JQuery, Twitter bootstrap) -# By default only js, css and html files are compressed. -# If you have text based static files with different extensions what you want to serve compressed then you will need to add the extension to the following places: -# - Add the extension to this Makefile at the webpages.espfs target to the find command -# - Add the extension to the gzippedFileTypes array in the user/httpd.c file -# -# Adding JPG or PNG files (and any other compressed formats) is not recommended, because GZIP compression does not works effectively on compressed files. - -#Static gzipping is disabled by default. -GZIP_COMPRESSION = yes - -# If COMPRESS_W_YUI is set to "yes" then the static css and js files will be compressed with yui-compressor -# This option works only when GZIP_COMPRESSION is set to "yes" -# http://yui.github.io/yuicompressor/ -#Disabled by default. -COMPRESS_W_YUI = no - -YUI-COMPRESSOR = /usr/bin/yui-compressor - -#If USE_HEATSHRINK is set to "yes" then the espfs files will be compressed with Heatshrink and decompressed -#on the fly while reading the file. Because the decompression is done in the esp8266, it does not require -#any support in the browser. -USE_HEATSHRINK = yes - -USE_OPENSDK = yes - -# this ugly trick is needed to allow a relative path -SDK_BASE=$(dir $(lastword $(MAKEFILE_LIST)))/esp_iot_sdk_v1.5.2/ - -# combined / separate / ota -OUTPUT_TYPE = combined - -# SPI flash size, in K -ESP_SPI_FLASH_SIZE_K = 1024 - -GLOBAL_CFLAGS = \ - -DDEBUG_ROUTER=0 \ - -DDEBUG_CAPTDNS=0 \ - -DDEBUG_HTTP=0 \ - -DDEBUG_ESPFS=0 \ - -DDEBUG_PERSIST=1 \ - -DDEBUG_UTFCACHE=0 \ - -DDEBUG_CGI=0 \ - -DDEBUG_WIFI=0 \ - -DDEBUG_WS=0 \ - -DDEBUG_ANSI=1 \ - -DDEBUG_ANSI_NOIMPL=1 \ - -DDEBUG_INPUT=0 \ - -DDEBUG_HEAP=1 \ - -DDEBUG_MALLOC=0 \ - -DHTTPD_MAX_BACKLOG_SIZE=8192 \ - -DHTTPD_MAX_HEAD_LEN=1024 \ - -DHTTPD_MAX_POST_LEN=512 \ - -DDEBUG_LOGBUF_SIZE=1024 \ - -mforce-l32 \ - -DUSE_OPTIMIZE_PRINTF=1 \ - -DHTTPD_CONN_TIMEOUT=3 diff --git a/esphttpdconfig.mk.example b/esphttpdconfig.mk.example index 617b057..714dce8 100644 --- a/esphttpdconfig.mk.example +++ b/esphttpdconfig.mk.example @@ -42,6 +42,7 @@ GLOBAL_CFLAGS = \ -DDEBUG_ROUTER=0 \ -DDEBUG_CAPTDNS=0 \ -DDEBUG_HTTP=0 \ + -DDEBUG_HTTPC=0 \ -DDEBUG_ESPFS=0 \ -DDEBUG_PERSIST=1 \ -DDEBUG_UTFCACHE=0 \ diff --git a/front-end b/front-end index 55e2def..29b8134 160000 --- a/front-end +++ b/front-end @@ -1 +1 @@ -Subproject commit 55e2def6e3899a708a9afca099252bdf44919b7c +Subproject commit 29b813457c7a185c41e050d358b001fadd2498e4 diff --git a/libesphttpd b/libesphttpd index 5772d3c..c8dda50 160000 --- a/libesphttpd +++ b/libesphttpd @@ -1 +1 @@ -Subproject commit 5772d3c9a99460dad79be730453982ecd35ed461 +Subproject commit c8dda50970d4c7c7ed2b9db4df7d433a39dde5b8 diff --git a/user/apars_short.c b/user/apars_short.c index 64ae3ab..06835b3 100644 --- a/user/apars_short.c +++ b/user/apars_short.c @@ -42,6 +42,7 @@ // #include +#include #include "apars_short.h" #include "apars_logging.h" #include "screen.h" @@ -103,6 +104,11 @@ void ICACHE_FLASH_ATTR apars_handle_hash_cmd(char c) screen_fill_with_E(); break; + // development codes - do not use! + case '7': + http_get("http://example.com", NULL); + break; + default: ansi_noimpl("ESC # %c", c); }