Skip to content

Commit

Permalink
Merge pull request #2312 from cesanta/arduino
Browse files Browse the repository at this point in the history
no Docker, in-place build for tests
  • Loading branch information
cpq authored Jul 22, 2023
2 parents a24b6c1 + a4f5355 commit d9cbcb5
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 18 deletions.
28 changes: 11 additions & 17 deletions examples/arduino/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
DOCKER ?= docker run --platform linux/amd64 --rm $(ENV) -v $(CWD):$(CWD) -w $(CWD)
CWD ?= $(realpath $(CURDIR))

all:
example:
Expand All @@ -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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 3 additions & 1 deletion examples/arduino/w5500-mqtt/w5500-mqtt.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit d9cbcb5

Please sign in to comment.