From a4f5355161c379954ab8cc3d5a791b2c78e7c793 Mon Sep 17 00:00:00 2001 From: "Sergio R. Caprile" Date: Fri, 21 Jul 2023 16:45:14 -0300 Subject: [PATCH] no Docker, in-place build for tests --- examples/arduino/Makefile | 28 ++++++++----------- .../arduino/{w5500 => w5500-http}/mongoose.c | 0 .../arduino/{w5500 => w5500-http}/mongoose.h | 0 .../{w5500 => w5500-http}/mongoose_custom.h | 0 .../w5500.ino => w5500-http/w5500-http.ino} | 0 examples/arduino/w5500-mqtt/w5500-mqtt.ino | 4 ++- 6 files changed, 14 insertions(+), 18 deletions(-) rename examples/arduino/{w5500 => w5500-http}/mongoose.c (100%) rename examples/arduino/{w5500 => w5500-http}/mongoose.h (100%) rename examples/arduino/{w5500 => w5500-http}/mongoose_custom.h (100%) rename examples/arduino/{w5500/w5500.ino => w5500-http/w5500-http.ino} (100%) diff --git a/examples/arduino/Makefile b/examples/arduino/Makefile index db3f65e5..6e158828 100644 --- a/examples/arduino/Makefile +++ b/examples/arduino/Makefile @@ -1,5 +1,3 @@ -DOCKER ?= docker run --platform linux/amd64 --rm $(ENV) -v $(CWD):$(CWD) -w $(CWD) -CWD ?= $(realpath $(CURDIR)) all: example: @@ -11,24 +9,20 @@ arduino: mv arduino-* $@ arduino-xiao-board: - $(DOCKER) mdashnet/cc2 ./arduino/arduino --pref "boardsmanager.additional.urls=https://files.seeedstudio.com/arduino/package_seeeduino_boards_index.json" --save-prefs - $(DOCKER) mdashnet/cc2 ./arduino/arduino --pref "compiler.warning_level=all" --save-prefs - $(DOCKER) mdashnet/cc2 ./arduino/arduino --install-boards Seeeduino:samd + ./arduino/arduino --pref "boardsmanager.additional.urls=https://files.seeedstudio.com/arduino/package_seeeduino_boards_index.json" --save-prefs + ./arduino/arduino --pref "compiler.warning_level=all" --save-prefs + ./arduino/arduino --install-boards Seeeduino:samd -arduino-xiao: ENV = -v $(CWD):/root arduino-xiao: arduino arduino-xiao-board - rm -rf tmp; mkdir tmp - cp w5500/w5500.ino tmp/tmp.ino - cp ../../mongoose.[ch] w5500/mongoose_custom.h tmp/ - $(DOCKER) mdashnet/cc2 ./arduino/arduino --verbose --verify --board Seeeduino:samd:seeed_XIAO_m0 tmp/tmp.ino + cd w5500-http && ../arduino/arduino --verbose --verify --board Seeeduino:samd:seeed_XIAO_m0 w5500-http.ino + cd w5500-mqtt && ../arduino/arduino --verbose --verify --board Seeeduino:samd:seeed_XIAO_m0 w5500-mqtt.ino -arduino-nano: ENV = -v $(CWD)/arduino:/root arduino-nano: arduino - rm -rf tmp; mkdir tmp - cp w5500/w5500.ino tmp/tmp.ino - cp ../../mongoose.[ch] w5500/mongoose_custom.h tmp/ - $(DOCKER) mdashnet/cc2 ./arduino/arduino --verbose --verify --board arduino:avr:nano tmp/tmp.ino + cd w5500-http && ../arduino/arduino --pref compiler.cpp.extra_flags=-DMG_ENABLE_LOG=0 --verbose --verify --board arduino:avr:nano w5500-http.ino + cd w5500-mqtt && ../arduino/arduino --pref compiler.cpp.extra_flags=-DMG_ENABLE_LOG=0 --verbose --verify --board arduino:avr:nano w5500-mqtt.ino -clean: - rm -rf arduino tmp +clean: + rm -rf arduino +cleanall: clean #otherwise some parts of xiao-board installation will fail as already installed + rm -rf ~/.arduino15 ~/.oracle_jre_usage diff --git a/examples/arduino/w5500/mongoose.c b/examples/arduino/w5500-http/mongoose.c similarity index 100% rename from examples/arduino/w5500/mongoose.c rename to examples/arduino/w5500-http/mongoose.c diff --git a/examples/arduino/w5500/mongoose.h b/examples/arduino/w5500-http/mongoose.h similarity index 100% rename from examples/arduino/w5500/mongoose.h rename to examples/arduino/w5500-http/mongoose.h diff --git a/examples/arduino/w5500/mongoose_custom.h b/examples/arduino/w5500-http/mongoose_custom.h similarity index 100% rename from examples/arduino/w5500/mongoose_custom.h rename to examples/arduino/w5500-http/mongoose_custom.h diff --git a/examples/arduino/w5500/w5500.ino b/examples/arduino/w5500-http/w5500-http.ino similarity index 100% rename from examples/arduino/w5500/w5500.ino rename to examples/arduino/w5500-http/w5500-http.ino diff --git a/examples/arduino/w5500-mqtt/w5500-mqtt.ino b/examples/arduino/w5500-mqtt/w5500-mqtt.ino index fb1bb8d5..53feecd7 100644 --- a/examples/arduino/w5500-mqtt/w5500-mqtt.ino +++ b/examples/arduino/w5500-mqtt/w5500-mqtt.ino @@ -71,7 +71,9 @@ static void fn(struct mg_connection *c, int ev, void *ev_data, void *fn_data) { static void timer_fn(void *arg) { struct mg_mgr *mgr = (struct mg_mgr *) arg; - struct mg_mqtt_opts opts = {.clean = true}; + struct mg_mqtt_opts opts; + memset(&opts, 0, sizeof(opts)); + opts.clean = true; if (mif.state == MG_TCPIP_STATE_READY && mqtt_connection == NULL) { mqtt_connection = mg_mqtt_connect(mgr, MQTT_SERVER, &opts, fn, NULL); }