diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 007cbb6898..5e0887b160 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -367,9 +367,9 @@ jobs: fail-fast: false matrix: example: - - path: esp32/uart-bridge - - path: esp32/micropython - #- path: esp8266/http-client-server + - path: micropython/esp32 + - path: http/uart-bridge/esp32 + - path: http/http-client/esp8266/http-client-server name: ${{ matrix.example.path }} env: GO: 0 @@ -377,7 +377,7 @@ jobs: - uses: actions/checkout@v4 with: { fetch-depth: 2 } - run: echo # nothing specific to install or do - - run: make -C examples/${{ matrix.example.path }} build + - run: make -C tutorials/${{ matrix.example.path }} build generic_examples_arm: runs-on: ubuntu-latest diff --git a/.github/workflows/quicktest.yml b/.github/workflows/quicktest.yml index 59fdc7287d..6a6f9ba892 100644 --- a/.github/workflows/quicktest.yml +++ b/.github/workflows/quicktest.yml @@ -245,20 +245,20 @@ jobs: fail-fast: false matrix: example: - - path: esp32/uart-bridge - #- path: esp8266/http-client-server + - path: http/uart-bridge/esp32 + - path: http/http-client/esp8266/http-client-server name: ${{ matrix.example.path }} env: GO: 0 steps: - uses: actions/checkout@v4 with: { fetch-depth: 2 } - - run: if ./test/match_changed_files.sh '^src|^examples/${{ matrix.example.path }}'; then echo GO=1 >> $GITHUB_ENV ; fi + - run: if ./test/match_changed_files.sh '^src|^tutorials/http/uart-bridge|^tutorials/${{ matrix.example.path }}'; then echo GO=1 >> $GITHUB_ENV ; fi - if: ${{ env.GO == 1 }} run: | # nothing specific to install or do - if: ${{ env.GO == 1 }} - run: make -C examples/${{ matrix.example.path }} build + run: make -C tutorials/${{ matrix.example.path }} build generic_examples_arm: runs-on: ubuntu-latest diff --git a/examples/esp32/uart-bridge/main/mongoose.c b/examples/esp32/uart-bridge/main/mongoose.c deleted file mode 120000 index 7a2752cb74..0000000000 --- a/examples/esp32/uart-bridge/main/mongoose.c +++ /dev/null @@ -1 +0,0 @@ -../../../../mongoose.c \ No newline at end of file diff --git a/examples/esp32/uart-bridge/main/mongoose.h b/examples/esp32/uart-bridge/main/mongoose.h deleted file mode 120000 index daff16334a..0000000000 --- a/examples/esp32/uart-bridge/main/mongoose.h +++ /dev/null @@ -1 +0,0 @@ -../../../../mongoose.h \ No newline at end of file diff --git a/examples/esp32/uart-bridge/main/net.c b/examples/esp32/uart-bridge/main/net.c deleted file mode 120000 index 11b4a308dc..0000000000 --- a/examples/esp32/uart-bridge/main/net.c +++ /dev/null @@ -1 +0,0 @@ -../../../uart-bridge/net.c \ No newline at end of file diff --git a/examples/esp32/uart-bridge/main/packed_fs.c b/examples/esp32/uart-bridge/main/packed_fs.c deleted file mode 120000 index 2ad10a44cb..0000000000 --- a/examples/esp32/uart-bridge/main/packed_fs.c +++ /dev/null @@ -1 +0,0 @@ -../../../uart-bridge/packed_fs.c \ No newline at end of file diff --git a/examples/uart-bridge/mongoose.c b/examples/uart-bridge/mongoose.c deleted file mode 120000 index 8ef6e62d4e..0000000000 --- a/examples/uart-bridge/mongoose.c +++ /dev/null @@ -1 +0,0 @@ -../../mongoose.c \ No newline at end of file diff --git a/examples/uart-bridge/mongoose.h b/examples/uart-bridge/mongoose.h deleted file mode 120000 index 488ef35873..0000000000 --- a/examples/uart-bridge/mongoose.h +++ /dev/null @@ -1 +0,0 @@ -../../mongoose.h \ No newline at end of file diff --git a/tutorials/arduino/esp32-http b/tutorials/arduino/esp32-http new file mode 120000 index 0000000000..31fa9867e5 --- /dev/null +++ b/tutorials/arduino/esp32-http @@ -0,0 +1 @@ +../http/http-server/arduino/esp32 \ No newline at end of file diff --git a/tutorials/arduino/esp32-mqtt b/tutorials/arduino/esp32-mqtt new file mode 120000 index 0000000000..6dd3aa7363 --- /dev/null +++ b/tutorials/arduino/esp32-mqtt @@ -0,0 +1 @@ +../mqtt/mqtt-client/arduino/esp32 \ No newline at end of file diff --git a/tutorials/arduino/sim800-mqtt b/tutorials/arduino/sim800-mqtt new file mode 120000 index 0000000000..59d71e0aff --- /dev/null +++ b/tutorials/arduino/sim800-mqtt @@ -0,0 +1 @@ +../mqtt/mqtt-client/arduino/sim800 \ No newline at end of file diff --git a/tutorials/arduino/teensy41-http b/tutorials/arduino/teensy41-http new file mode 120000 index 0000000000..3e120c66fa --- /dev/null +++ b/tutorials/arduino/teensy41-http @@ -0,0 +1 @@ +../http/http-server/arduino/teensy41 \ No newline at end of file diff --git a/tutorials/arduino/w5500-http b/tutorials/arduino/w5500-http new file mode 120000 index 0000000000..193a99e696 --- /dev/null +++ b/tutorials/arduino/w5500-http @@ -0,0 +1 @@ +../http/http-server/arduino/w5500 \ No newline at end of file diff --git a/tutorials/arduino/w5500-mqtt b/tutorials/arduino/w5500-mqtt new file mode 120000 index 0000000000..82279794d7 --- /dev/null +++ b/tutorials/arduino/w5500-mqtt @@ -0,0 +1 @@ +../mqtt/mqtt-client/arduino/w5500 \ No newline at end of file diff --git a/tutorials/http/http-client/esp8266/http-client-server/Makefile b/tutorials/http/http-client/esp8266/http-client-server/Makefile index 62868a9825..b28bf6308c 100644 --- a/tutorials/http/http-client/esp8266/http-client-server/Makefile +++ b/tutorials/http/http-client/esp8266/http-client-server/Makefile @@ -1,5 +1,5 @@ THISDIR = $(realpath $(CURDIR)) -ROOTDIR = $(realpath $(CURDIR)/../../..) +ROOTDIR = $(realpath $(CURDIR)/../../../../..) DOCKER ?= docker run --rm $(DA) -v $(ROOTDIR):$(ROOTDIR) -w $(THISDIR) docker.io/mdashnet/8266 CMD ?= make -C src defconfig app PORT ?= /dev/ttyUSB0 diff --git a/tutorials/http/http-client/esp8266/http-client-server/src/main/mongoose.c b/tutorials/http/http-client/esp8266/http-client-server/src/main/mongoose.c index fe5764e5c9..cfa88e5259 120000 --- a/tutorials/http/http-client/esp8266/http-client-server/src/main/mongoose.c +++ b/tutorials/http/http-client/esp8266/http-client-server/src/main/mongoose.c @@ -1 +1 @@ -../../../../../mongoose.c \ No newline at end of file +../../../../../../../mongoose.c \ No newline at end of file diff --git a/tutorials/http/http-client/esp8266/http-client-server/src/main/mongoose.h b/tutorials/http/http-client/esp8266/http-client-server/src/main/mongoose.h index 4cd6a2b4ca..e6d3f17835 120000 --- a/tutorials/http/http-client/esp8266/http-client-server/src/main/mongoose.h +++ b/tutorials/http/http-client/esp8266/http-client-server/src/main/mongoose.h @@ -1 +1 @@ -../../../../../mongoose.h \ No newline at end of file +../../../../../../../mongoose.h \ No newline at end of file diff --git a/examples/uart-bridge/Makefile b/tutorials/http/uart-bridge/Makefile similarity index 97% rename from examples/uart-bridge/Makefile rename to tutorials/http/uart-bridge/Makefile index 2297bcccad..48701c4e48 100644 --- a/examples/uart-bridge/Makefile +++ b/tutorials/http/uart-bridge/Makefile @@ -23,7 +23,7 @@ ifneq ($(OS),Windows_NT) packed_fs.c: $(shell find web_root -type f) Makefile rm -rf tmp/web_root && mkdir tmp && cp -r web_root tmp/ find tmp -type f | xargs -n1 gzip - $(CC) ../../test/pack.c -o pack + $(CC) ../../../test/pack.c -o pack cd tmp && ../pack `find web_root -type f` > ../$@ endif diff --git a/examples/uart-bridge/README.md b/tutorials/http/uart-bridge/README.md similarity index 100% rename from examples/uart-bridge/README.md rename to tutorials/http/uart-bridge/README.md diff --git a/examples/esp32/uart-bridge/CMakeLists.txt b/tutorials/http/uart-bridge/esp32/CMakeLists.txt similarity index 100% rename from examples/esp32/uart-bridge/CMakeLists.txt rename to tutorials/http/uart-bridge/esp32/CMakeLists.txt diff --git a/examples/esp32/uart-bridge/Makefile b/tutorials/http/uart-bridge/esp32/Makefile similarity index 93% rename from examples/esp32/uart-bridge/Makefile rename to tutorials/http/uart-bridge/esp32/Makefile index 16fec21051..d59ec0d83b 100644 --- a/examples/esp32/uart-bridge/Makefile +++ b/tutorials/http/uart-bridge/esp32/Makefile @@ -1,5 +1,5 @@ CWD = $(realpath $(CURDIR)) -MNT = $(realpath $(CURDIR)/../../..) +MNT = $(realpath $(CURDIR)/../../../..) PORT ?= /dev/ttyUSB0 CMD ?= build diff --git a/examples/esp32/uart-bridge/README.md b/tutorials/http/uart-bridge/esp32/README.md similarity index 100% rename from examples/esp32/uart-bridge/README.md rename to tutorials/http/uart-bridge/esp32/README.md diff --git a/examples/esp32/uart-bridge/main/CMakeLists.txt b/tutorials/http/uart-bridge/esp32/main/CMakeLists.txt similarity index 100% rename from examples/esp32/uart-bridge/main/CMakeLists.txt rename to tutorials/http/uart-bridge/esp32/main/CMakeLists.txt diff --git a/examples/esp32/uart-bridge/main/cli.c b/tutorials/http/uart-bridge/esp32/main/cli.c similarity index 100% rename from examples/esp32/uart-bridge/main/cli.c rename to tutorials/http/uart-bridge/esp32/main/cli.c diff --git a/examples/esp32/uart-bridge/main/main.c b/tutorials/http/uart-bridge/esp32/main/main.c similarity index 100% rename from examples/esp32/uart-bridge/main/main.c rename to tutorials/http/uart-bridge/esp32/main/main.c diff --git a/examples/esp32/uart-bridge/main/main.h b/tutorials/http/uart-bridge/esp32/main/main.h similarity index 100% rename from examples/esp32/uart-bridge/main/main.h rename to tutorials/http/uart-bridge/esp32/main/main.h diff --git a/tutorials/http/uart-bridge/esp32/main/mongoose.c b/tutorials/http/uart-bridge/esp32/main/mongoose.c new file mode 120000 index 0000000000..fe5764e5c9 --- /dev/null +++ b/tutorials/http/uart-bridge/esp32/main/mongoose.c @@ -0,0 +1 @@ +../../../../../mongoose.c \ No newline at end of file diff --git a/tutorials/http/uart-bridge/esp32/main/mongoose.h b/tutorials/http/uart-bridge/esp32/main/mongoose.h new file mode 120000 index 0000000000..4cd6a2b4ca --- /dev/null +++ b/tutorials/http/uart-bridge/esp32/main/mongoose.h @@ -0,0 +1 @@ +../../../../../mongoose.h \ No newline at end of file diff --git a/examples/esp32/uart-bridge/main/mongoose_config.h b/tutorials/http/uart-bridge/esp32/main/mongoose_config.h similarity index 100% rename from examples/esp32/uart-bridge/main/mongoose_config.h rename to tutorials/http/uart-bridge/esp32/main/mongoose_config.h diff --git a/tutorials/http/uart-bridge/esp32/main/net.c b/tutorials/http/uart-bridge/esp32/main/net.c new file mode 120000 index 0000000000..2541c1ab25 --- /dev/null +++ b/tutorials/http/uart-bridge/esp32/main/net.c @@ -0,0 +1 @@ +../../net.c \ No newline at end of file diff --git a/tutorials/http/uart-bridge/esp32/main/packed_fs.c b/tutorials/http/uart-bridge/esp32/main/packed_fs.c new file mode 120000 index 0000000000..3d58f82d00 --- /dev/null +++ b/tutorials/http/uart-bridge/esp32/main/packed_fs.c @@ -0,0 +1 @@ +../../packed_fs.c \ No newline at end of file diff --git a/examples/esp32/uart-bridge/main/uart.c b/tutorials/http/uart-bridge/esp32/main/uart.c similarity index 100% rename from examples/esp32/uart-bridge/main/uart.c rename to tutorials/http/uart-bridge/esp32/main/uart.c diff --git a/examples/esp32/uart-bridge/main/wifi.c b/tutorials/http/uart-bridge/esp32/main/wifi.c similarity index 100% rename from examples/esp32/uart-bridge/main/wifi.c rename to tutorials/http/uart-bridge/esp32/main/wifi.c diff --git a/examples/esp32/uart-bridge/make b/tutorials/http/uart-bridge/esp32/make similarity index 100% rename from examples/esp32/uart-bridge/make rename to tutorials/http/uart-bridge/esp32/make diff --git a/examples/esp32/uart-bridge/partitions.csv b/tutorials/http/uart-bridge/esp32/partitions.csv similarity index 100% rename from examples/esp32/uart-bridge/partitions.csv rename to tutorials/http/uart-bridge/esp32/partitions.csv diff --git a/examples/esp32/uart-bridge/sdkconfig.defaults b/tutorials/http/uart-bridge/esp32/sdkconfig.defaults similarity index 100% rename from examples/esp32/uart-bridge/sdkconfig.defaults rename to tutorials/http/uart-bridge/esp32/sdkconfig.defaults diff --git a/examples/uart-bridge/main.c b/tutorials/http/uart-bridge/main.c similarity index 100% rename from examples/uart-bridge/main.c rename to tutorials/http/uart-bridge/main.c diff --git a/tutorials/http/uart-bridge/mongoose.c b/tutorials/http/uart-bridge/mongoose.c new file mode 120000 index 0000000000..5e522bbcd4 --- /dev/null +++ b/tutorials/http/uart-bridge/mongoose.c @@ -0,0 +1 @@ +../../../mongoose.c \ No newline at end of file diff --git a/tutorials/http/uart-bridge/mongoose.h b/tutorials/http/uart-bridge/mongoose.h new file mode 120000 index 0000000000..ee4ac82323 --- /dev/null +++ b/tutorials/http/uart-bridge/mongoose.h @@ -0,0 +1 @@ +../../../mongoose.h \ No newline at end of file diff --git a/examples/uart-bridge/net.c b/tutorials/http/uart-bridge/net.c similarity index 100% rename from examples/uart-bridge/net.c rename to tutorials/http/uart-bridge/net.c diff --git a/examples/uart-bridge/packed_fs.c b/tutorials/http/uart-bridge/packed_fs.c similarity index 98% rename from examples/uart-bridge/packed_fs.c rename to tutorials/http/uart-bridge/packed_fs.c index 6e25c6b729..1ed28b5000 100644 --- a/examples/uart-bridge/packed_fs.c +++ b/tutorials/http/uart-bridge/packed_fs.c @@ -2,8 +2,17 @@ #include #include +#if defined(__cplusplus) +extern "C" { +#endif +const char *mg_unlist(size_t no); +const char *mg_unpack(const char *, size_t *, time_t *); +#if defined(__cplusplus) +} +#endif + static const unsigned char v1[] = { - 31, 139, 8, 8, 29, 105, 247, 99, 0, 3, 105, 110, // .....i.c..in + 31, 139, 8, 8, 6, 78, 191, 103, 0, 3, 105, 110, // .....N.g..in 100, 101, 120, 46, 104, 116, 109, 108, 0, 93, 144, 177, // dex.html.].. 78, 196, 48, 12, 134, 247, 123, 138, 144, 153, 180, 176, // N.0...{..... 49, 36, 149, 208, 245, 6, 38, 24, 64, 130, 49, 77, // 1$....&.@.1M @@ -28,7 +37,7 @@ static const unsigned char v1[] = { 130, 117, 1, 0, 0, 0 // .u... }; static const unsigned char v2[] = { - 31, 139, 8, 8, 29, 105, 247, 99, 0, 3, 109, 97, // .....i.c..ma + 31, 139, 8, 8, 6, 78, 191, 103, 0, 3, 109, 97, // .....N.g..ma 105, 110, 46, 106, 115, 0, 181, 88, 109, 111, 219, 70, // in.js..Xmo.F 18, 254, 174, 95, 49, 80, 125, 37, 121, 165, 72, 43, // ..._1P}%y.H+ 113, 225, 131, 44, 235, 144, 6, 45, 112, 135, 38, 233, // q..,...-p.&. @@ -195,7 +204,7 @@ static const unsigned char v2[] = { 154, 248, 11, 218, 252, 214, 171, 12, 23, 0, 0, 0 // ........... }; static const unsigned char v3[] = { - 31, 139, 8, 8, 29, 105, 247, 99, 0, 3, 112, 114, // .....i.c..pr + 31, 139, 8, 8, 6, 78, 191, 103, 0, 3, 112, 114, // .....N.g..pr 101, 97, 99, 116, 46, 109, 105, 110, 46, 106, 115, 0, // eact.min.js. 157, 91, 123, 119, 219, 182, 146, 255, 127, 63, 69, 164, // .[{w.....?E. 211, 163, 18, 43, 68, 177, 147, 182, 187, 75, 5, 213, // ...+D....K.. @@ -641,7 +650,7 @@ static const unsigned char v3[] = { 138, 51, 0, 0, 0 // .3.. }; static const unsigned char v4[] = { - 31, 139, 8, 8, 29, 105, 247, 99, 0, 3, 115, 116, // .....i.c..st + 31, 139, 8, 8, 6, 78, 191, 103, 0, 3, 115, 116, // .....N.g..st 121, 108, 101, 46, 99, 115, 115, 0, 149, 85, 193, 142, // yle.css..U.. 155, 48, 16, 189, 231, 43, 92, 173, 42, 181, 171, 192, // .0...+..*... 134, 16, 96, 33, 151, 222, 250, 17, 85, 15, 6, 155, // ..`!....U... @@ -718,10 +727,10 @@ static const struct packed_file { size_t size; time_t mtime; } packed_files[] = { - {"/web_root/index.html.gz", v1, sizeof(v1), 1677158685}, - {"/web_root/main.js.gz", v2, sizeof(v2), 1677158685}, - {"/web_root/preact.min.js.gz", v3, sizeof(v3), 1677158685}, - {"/web_root/style.css.gz", v4, sizeof(v4), 1677158685}, + {"/web_root/index.html.gz", v1, sizeof(v1), 1740590598}, + {"/web_root/main.js.gz", v2, sizeof(v2), 1740590598}, + {"/web_root/preact.min.js.gz", v3, sizeof(v3), 1740590598}, + {"/web_root/style.css.gz", v4, sizeof(v4), 1740590598}, {NULL, NULL, 0, 0} }; @@ -729,11 +738,9 @@ static int scmp(const char *a, const char *b) { while (*a && (*a == *b)) a++, b++; return *(const unsigned char *) a - *(const unsigned char *) b; } -const char *mg_unlist(size_t no); const char *mg_unlist(size_t no) { return packed_files[no].name; } -const char *mg_unpack(const char *path, size_t *size, time_t *mtime); const char *mg_unpack(const char *name, size_t *size, time_t *mtime) { const struct packed_file *p; for (p = packed_files; p->name != NULL; p++) { diff --git a/examples/uart-bridge/web_root/index.html b/tutorials/http/uart-bridge/web_root/index.html similarity index 100% rename from examples/uart-bridge/web_root/index.html rename to tutorials/http/uart-bridge/web_root/index.html diff --git a/examples/uart-bridge/web_root/main.js b/tutorials/http/uart-bridge/web_root/main.js similarity index 100% rename from examples/uart-bridge/web_root/main.js rename to tutorials/http/uart-bridge/web_root/main.js diff --git a/examples/uart-bridge/web_root/preact.min.js b/tutorials/http/uart-bridge/web_root/preact.min.js similarity index 100% rename from examples/uart-bridge/web_root/preact.min.js rename to tutorials/http/uart-bridge/web_root/preact.min.js diff --git a/examples/uart-bridge/web_root/style.css b/tutorials/http/uart-bridge/web_root/style.css similarity index 100% rename from examples/uart-bridge/web_root/style.css rename to tutorials/http/uart-bridge/web_root/style.css diff --git a/tutorials/tcp/uart-bridge b/tutorials/tcp/uart-bridge new file mode 120000 index 0000000000..b48b430e55 --- /dev/null +++ b/tutorials/tcp/uart-bridge @@ -0,0 +1 @@ +../http/uart-bridge \ No newline at end of file diff --git a/tutorials/websocket/uart-bridge b/tutorials/websocket/uart-bridge new file mode 120000 index 0000000000..b48b430e55 --- /dev/null +++ b/tutorials/websocket/uart-bridge @@ -0,0 +1 @@ +../http/uart-bridge \ No newline at end of file