-
-
Notifications
You must be signed in to change notification settings - Fork 347
Migrating from Sming v3.8.x to v4
With the new Sming version 3.9.0 there will be a lot of backwards incompatible changes. This page is provided to help with migrating your applications.
The folder structure has been revised to provide support for additional architectures, such as the ESP32.
The Sming/Arch
directory should never be accessed directly: it contains specific files for the target architecture, and may provide different header file versions to the main ones. Instead, consider these directories to be your 'root' include directories:
Sming
Sming/Components
Sming/Core
Sming/Wiring
Examples of #include statements:
Old-style | Recommended |
---|---|
"SmingCore/SmingCore.h" |
<SmingCore.h> |
"SmingCore/Network/SmtpClient.h" |
<Network/SmtpClient.h> |
"SmingCore/Data/Stream/FlashMemoryStream.h" |
<Data/Stream/FlashMemoryStream.h> |
"Wiring/WString.h" |
<WString.h> |
"SmingCore/Platform/Station.h" |
<Platform/Station.h> |
If you use some of the includes below directly in your application make sure to apply the following changes:
Description | Old name | New name |
---|---|---|
uart driver | "espinc/uart.h" |
<driver/uart.h> |
flesh memory | "flashmem.h" |
<esp_spi_flash.h> |
C compatible types | <espinc/c_types_compatible.h> |
<c_types.h> . |
This file is generally #included ahead of everything else so that common architecture-specific definitions are available. Unless you've made changes to the file, it is not required and you should delete it: Sming provides a default which will be used.
If you have made customisations, please amend the file as follows:
#pragma once
#include_next <user_config.h>
<< User Customisations here >>
Instead of Makefile-user.mk
a project should provide a component.mk
. To convert to the new style:
- Copy
Makefile
andcomponent.mk
from theBasic_Blink
sample project - Copy any customisations from
Makefile-user.mk
intocomponent.mk
file. (Or, renameMakefile-user.mk
tocomponent.mk
then edit it.) - Delete
Makefile-user.mk
- If the project uses any Arduino libraries, set the
ARDUINO_LIBRARIES
variable
You can find more detailed information about component.mk
in Sming/building.md
.
ArduinoJson has been updated to Version 6 from version 5. See the Version 6 Migration Guide for details.
Note some methods of JsonVariant
have been removed, replacements are:
asString()
-> as<char*>()
or as<const char*>
. Note that as<String>
produces a serialized version, so you'll get "null" instead of an empty/invalid result String.
asArray()
-> as<JsonArray>()
asObject()
-> as<JsonObject>()
There are also some useful helper functions available in the Json
namespace. See Libraries/ArduinoJson6/include/ArduinoJson.h
.
ArduinoJson is now an optional Component, so you need to make a couple of changes to use it:
- Add
ARDUINO_LIBRARIES=ArduinoJson6
to the project's component.mk file. To support migration of existing projects, you can elect to continue using version 5 by specifyingArduinoJson5
instead. - Add
#include <JsonObjectStream.h>
to your source code. If you're not using the stream class, add#include <ArduinoJson.h>
instead.