From e01cffff465682db92de14d1f9f40a85ef1efe96 Mon Sep 17 00:00:00 2001 From: "Sergio R. Caprile" Date: Tue, 2 Aug 2022 16:10:34 -0300 Subject: [PATCH 1/2] Changed README to point to new tutorial location Expanded Makefile to be able to flash with Docker and esputil --- examples/esp32/device-dashboard/Makefile | 26 +++++++++++++++++++---- examples/esp32/device-dashboard/README.md | 2 +- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/examples/esp32/device-dashboard/Makefile b/examples/esp32/device-dashboard/Makefile index cf1021e0..34bb40c9 100644 --- a/examples/esp32/device-dashboard/Makefile +++ b/examples/esp32/device-dashboard/Makefile @@ -2,19 +2,37 @@ THISDIR = $(realpath $(CURDIR)) ROOTDIR = $(realpath $(CURDIR)/../../..) DOCKER ?= docker run --rm $(DA) -v $(ROOTDIR):$(ROOTDIR) -w $(THISDIR) espressif/idf CMD ?= idf.py build +PORT ?= /dev/ttyUSB0 all: example example: true -build: main/main.c Makefile +build: Makefile $(wildcard main/*) $(DOCKER) $(CMD) -COMPORT ?= /dev/cu.SLAB_USBtoUART -ESPTOOL ?= esptool.py flash: - cd build && $(ESPTOOL) --chip esp32 -p $(COMPORT) -b 460800 --before=default_reset --after=hard_reset write_flash --flash_mode dio --flash_freq 40m --flash_size 2MB 0x8000 partition_table/partition-table.bin 0x1000 bootloader/bootloader.bin 0x100000 mongoose-esp32-example.bin +flash: CMD = idf.py flash +flash: DA = --device $(PORT) +flash: build + +.PHONY: build + +dashboard.hex: build + esputil mkhex \ + 0x8000 build/partition_table/partition-table.bin \ + 0x1000 build/bootloader/bootloader.bin \ + 0x100000 build/mongoose-esp32-example.bin > $@ + +flash2: dashboard.hex + esputil -p $(PORT) -b 921600 -fp 0x220 flash dashboard.hex + esputil -p $(PORT) monitor + +ESPTOOL ?= esptool.py + +flash3: + cd build && $(ESPTOOL) --chip esp32 -p $(PORT) -b 460800 --before=default_reset --after=hard_reset write_flash --flash_mode dio --flash_freq 40m --flash_size 2MB 0x8000 partition_table/partition-table.bin 0x1000 bootloader/bootloader.bin 0x100000 mongoose-esp32-example.bin clean: $(DOCKER) rm -rf build sdkconfig diff --git a/examples/esp32/device-dashboard/README.md b/examples/esp32/device-dashboard/README.md index eeac9344..82251bf0 100644 --- a/examples/esp32/device-dashboard/README.md +++ b/examples/esp32/device-dashboard/README.md @@ -1 +1 @@ -See detailed tutorial at https://mongoose.ws/tutorials/esp32/ +See detailed tutorial at https://mongoose.ws/tutorials/esp32/device-dashboard From 96df71830413ecabf2bbf10ee1c8e9a2de73e0a4 Mon Sep 17 00:00:00 2001 From: Gisle Vanem Date: Fri, 5 Aug 2022 13:50:55 +0200 Subject: [PATCH 2/2] Fix empty initializer MSVC does not like such empty initializer: xamples/device-dashboard/net.c(116): error C2059: syntax error: '}' --- examples/device-dashboard/net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/device-dashboard/net.c b/examples/device-dashboard/net.c index 0b0ddd76..9f07d8d9 100644 --- a/examples/device-dashboard/net.c +++ b/examples/device-dashboard/net.c @@ -113,7 +113,7 @@ static void mqtt_fn(struct mg_connection *c, int ev, void *ev_data, void *fnd) { static void timer_mqtt_fn(void *param) { struct mg_mgr *mgr = (struct mg_mgr *) param; if (s_mqtt == NULL) { - struct mg_mqtt_opts opts = {}; + struct mg_mqtt_opts opts = { 0 }; s_mqtt = mg_mqtt_connect(mgr, s_config.url, &opts, mqtt_fn, NULL); } }