Sming (main)

This is the main Sming Component containing all architecture-independent code. All architecture-specific stuff is in either Sming (Esp8266) or Sming (Host).

Serial baud rate

COM_SPEED

Default baud rate for serial port.

This will recompile your application to use the revised baud rate. Note that this will change the default speed used for both flashing and serial comms. See also Esptool and Terminal for further details.

The default rate for serial ports is 115200 baud. You can change it like this:

make COM_SPEED=921600

Debug information log level and format

DEBUG_VERBOSE_LEVEL

When compiled in debug mode (:envvar:SMING_RELEASE undefined) there are four debug levels in increasing level of verbosity:

  • 0: errors
  • 1: warnings
  • 2: information (default)
  • 3: debug

Change it like this:

make DEBUG_VERBOSE_LEVEL=3
DEBUG_PRINT_FILENAME_AND_LINE

Set this to 1 to include the filename and line number in every line of debug output. This will require extra space on flash.

Note

If you change these settings and want them applied to Sming, not just your project, then you’ll need to recompile all components like this:

make components-clean
make DEBUG_VERBOSE_LEVEL=3

Task Queue

The task queue is used for System.queueCallback() calls.

TASK_QUEUE_LENGTH

Maximum number of entries in the task queue (default 16). Must be a power of 2.

ENABLE_TASK_COUNT

If problems are suspected with task queuing, it may be getting flooded. For this reason you should check the return value from queueCallback().

You can enable this option to keep track of the number of active tasks, System::getTaskCount(), and the maximum, System::getMaxTaskCount().

By default this is disabled and both methods will return 255. This is because interrupts must be disabled to ensure an accurate count, which may not be desirable.

Release builds

SMING_RELEASE

By default, this value is undefined to produce a build with debug output. To build for release, do this:

make SMING_RELEASE=1

This remains in force until you change it back:

make SMING_RELEASE=

Command Executor

ENABLE_CMD_EXECUTOR

Default: ON. This feature enables execution of certain commands by registering token handlers for text received via serial, websocket or telnet connection. If this feature is not used additional RAM/Flash can be obtained by setting ENABLE_CMD_EXECUTOR=0. This will save ~1KB RAM and ~3KB of flash memory.

group commandhandler

Provide command line interface.

Command handler provides a common command line interface. CLI is available for the following remote access methods:

  • Serial
  • Telnet
  • Websockets

By default, CLI is disabled. Enable CLI by calling “commandProcessing” on the appropriate access class object, e.g.

Serial.commandProcessing(true)

Commands can be added to and removed from the command handler. Each command will trigger a defined Delegate.

A welcome message may be shown when a user connects and end of line character may be defined. An automatic “help” display is available.

Typedefs

typedef Delegate<void(String commandLine, CommandOutput *commandOutput)> CommandFunctionDelegate

Command delegate function.

Note
CommandFunctionDelegate defines the structure of a function that handles individual commands
Note
Can use standard print functions on commandOutput
Parameters
  • commandLine: Command line entered by user at CLI, including command and parameters
  • commandOutput: Pointer to the CLI print stream

typedef CommandFunctionDelegate commandFunctionDelegate

Enums

enum VerboseMode

Verbose mode.

Values:

VERBOSE

Verbose mode.

SILENT

Silent mode.

Variables

CommandHandler commandHandler

Global instance of CommandHandler.

class CommandDelegate
#include <CommandDelegate.h>

Command delegate class.

class CommandHandler
#include <CommandHandler.h>

Command handler class.

WiFi Connection

ENABLE_WPS

Set to 1 to enable WiFi Protected Setup (WPS) WPS is not enabled by default to preserve resources, and because there may be security implications which you should consider carefully.

ENABLE_SMART_CONFIG

Set to 1 to enable WiFi Smart Configuration API SmartConfig requires extra libraries and ENABLE_ESPCONN. See Basic Smart Config sample application.

If you want to provide a default SSID and Password for connection to your default Access Point, you can do this:

make WIFI_SSID=MyAccessPoint WIFI_PWD=secret

These are provided as #defined symbols for your application to use. See Basic WiFi for a simple example, or MeteoControl for a more flexible solution using configuration files.

WIFI_SSID

SSID identifying default Access Point to connect to. By default, this is undefined.

WIFI_PWD

Password for the WIFI_SSID Access Point, if required. If the AP is open then leave this undefined.

SSL support

ENABLE_SSL

Default: undefined (disabled)

SSL requires lots of RAM and some intensive processing, so to conserve resources it is disabled by default. If you want to enable it then take a look at the Basic SSL sample.

Set to 1 to enable SSL support using the AXTLS 8266 Component.

HTTP support

HTTP_SERVER_EXPOSE_NAME

Default: 1 (enabled)

Adds “HttpServer/Sming” to the SERVER field in response headers. If disabled, the SERVER field is omitted from all responses.

HTTP_SERVER_EXPOSE_VERSION

Default: 0 (disabled)

Adds the current Sming build version to the SERVER field in response headers. For example, “Sming/4.0.0-rc2”.

Requires HTTP_SERVER_EXPOSE_NAME to be enabled.

HTTP_SERVER_EXPOSE_DATE

Default: 0 (disabled)

Sets the DATE field in response headers.

Localisation

LOCALE

Sming can format dates/time values based on a country code identified by this value. This is provided as a #define symbol for your application to use. See Sming/Core/SmingLocale.h for further details.

References