Basic Web Skeleton (LTS)
Introduction
This is a copy of the Basic_WebSkeletonApp from the Sming LTS branch, modified to build for Sming 4.0. Sming uses ArduinoJson version 6 by default, so this sample demonstrates how to continue using version 5.
This is how it was done:
When including SmingCore.h, just use #include <SmingCore.h>.
Remove the file include/user_config.h: Sming does not require it. If you have made changes for your project then move the changes into your project’s
component.mk
file.Remove any #include <user_config.h> statements from your files.
Rename Makefile-user.mk file to component.mk.
Replace the file Makefile with the one from the Basic_Blink sample project. If you’ve ignored the instructions and modified the file (!) then you’ll need to move those changes into your new component.mk file instead.
Sming uses #pragma once style for header guards, so consider updating your own files if you’re not already doing this.
We use the OneWire Arduino Library, so add ARDUINO_LIBRARIES := OneWire to our component.mk file. Sming now only builds libraries which are specifically requested for a project.
We’re using ArduinoJson, version 6. Sming supports version 5 or 6, but you must specify which one:
Add ARDUINO_LIBRARIES=ArduinoJson6 to the project’s component.mk file.
Add #include <JsonObjectStream.h>. If you’re not using the stream class, add #include <ArduinoJson6.h> to code.
Update callback function parameter lists for
STADisconnect
andSTAGotIP
. We can also get a description for disconnection reasons, so display that instead of just a number. See Sming/Platform/WifiEvents.h.In webserver.cpp, the onConfiguration() function uses request.getBody(). It is more efficient to use streams, so just replace with request.getBodyStream().
That’s it.
References
SoC support
esp32
esp32c2
esp32c3
esp32s2
esp32s3
esp8266
host