Skip to content

The Configuration File

Giorgioggì edited this page Jan 15, 2021 · 10 revisions

Certain features of Webbino need to be configured in one of its source files: it is named webbino_config.h and you will find it in the src subdirectory of the Webbino library directory. Libraries are usually installed in the libraries subdirectory of your Arduino sketch directory, by the way.

All the settings there have a comment that explains their purpose.

Note that Enabling means removing the comment mark, while disabling means adding back the comment mark

Platform selection

The most important setting is the first one you'll find in the file, that is the platform selection. You will have to enable only one of the subsequent lines, corresponding to the platform you will be using.

#define WEBBINO_USE_WIZ5100

This supports the original Ethernet Shield, it has no external dependencies and can be used straight away.

#define WEBBINO_USE_WIZ5500

This supports the official Arduino Ethernet Shield 2, originally released by arduino.org. It requires the Ethernet 2 library which can be installed through the Library Manager in the Arduino IDE.

#define WEBBINO_USE_ENC28J60

This supports the ENC28J60 Ethernet Controller through the EtherCard library library, which is recommended on microcontrollers/boards with limited resources, such as the Uno. It has some limitations and uses a lot of RAM for the packet buffer, which is currently set at 800 bytes including TCP/IP headers, leaving about 750 bytes for data to be sent to the client. Since the library also forces all communications to be single-packet, about 750 bytes is the maximum size of any data that is exchanged between server and client (i.e.: of webpages). See below for an alternative.

#define WEBBINO_USE_ENC28J60_UIP

This is an alternative for the ENC28J60 Ethernet Controller which uses the UIPEthernet library. It is more complete but heavier on resource usage, so it is only recommended on more powerful platforms, such as the Arduino Mega, Due or on boards based on STM32 microcontrollers.

#define WEBBINO_USE_ESP8266

Supports the ESP8266 WiFi module as an add-on to Arduino. You will need Bruno Portaluri's WiFiEsp library available in the Library Manager or at https://github.com/bportaluri/WiFiEsp.

#define WEBBINO_USE_ESP8266_STANDALONE

Supports the ESP8266 as a standalone board. You will need to install the ESP8266 core, available at https://github.com/esp8266/Arduino.

#define WEBBINO_USE_WIFI

Supports the original Arduino WiFi shield (untested) AND the ESP32 as a standalone board. For the latter you will need to install the ESP32 core.

#define WEBBINO_USE_WIFI101

Supports WINC1500-based shields through the WiFi101 library that can be installed through the Library Manager. Note that this is currently experimental and might not work.

#define WEBBINO_USE_FISHINO

Supports the WiFi module available on Fishino boards. It requires the Fishino package.

#define WEBBINO_USE_DIGIFI

Supports Digistump's DigiX clone of the Arduino Due board, which has an onboard WiFi controller. Please get in touch with me if you need to use this.

#define WEBBINO_USE_TEENSY41_NATIVE

Supports the native Ethernet controller built in the MCU used on PJRC's Teensy 4.1 board. This requires installing the Teensyduino support package.

Content Storage Options

#define WEBBINO_ENABLE_SD

The SD Content Storage can use two different libraries to access FAT filesystems. This will use Arduino's built-in SD library, which only allows DOS-style (i.e. 8+3 characters) file names. This implies that you will have to name your pages with a .htm extension instead of .html. If you don't like this, see below.

#define WEBBINO_ENABLE_SDFAT

This requires the SDFat library and allows the SD Content Storage to access files with long names (LFNs), if properly configured (see SdFatConfig.h in the library sources).

#define WEBBINO_ENABLE_LITTLEFS

This is automatically enabled when compiling for the ESP8266 and ESP32 and allows storing web content in the filesystem-on-flash that is built into these microcontrollers, but it can be disabled if desired. Please refer to this page for further information on how to take advantage of this feature.

Note that you might need to install the LITTLEFS library on ESP32.

#define WEBBINO_ENABLE_SPIFFS (DEPRECATED)

This enables support for an older mechanism that was very similar to LittleFS. It is now DEPRECATED and will be removed in a future version.

Optional Features

#define ENABLE_TAGS

Enables support for Replacement Tags, i.e.: replace $TAGS$ in served pages. Enabled by default.

#define ENABLE_PAGE_FUNCTIONS

This enables support for Page Functions. It is enabled by default and should not be turned off unless you don't need this feature and you are really low on flash.

#define ENABLE_HTTPAUTH

Define this to enable support for HTTP Basic Authorization. This feature requires the Base64 library.

#define ENABLE_ALL_METHODS

By default only the GET HTTP method/verb is supported (i.e.: all requests are implicitly assumed to be GETs). Define this to enable the parsing of the actual method that was passed in the request. It will be made available to Page Functions through the HttpRequest object.

This feature is currently EXPERIMENTAL.

#define ENABLE_REST

Enables some features that will help implementing REST services. Note that you should probably enable ENABLE_ALL_METHODS too, if you need this.

This feature is currently VEEEERY EXPERIMENTAL and UNDOCUMENTED.

#define ENABLE_EXTRA_MIMETYPES

By default, only MIME types for html, css, js, png, jpeg, gif and ico files are enabled. Define this to enable some extra types, namely xml, pdf, zip and gz.

Internal Options

You probably should not touch these, but they might be tweaked if you are low on RAM/flash.

const byte TAG_CHAR = static_cast ('$');

Character that delimits tags.

NOTE: Make sure this is a byte and not a char.

#define MAX_TAG_LEN 24

Maximum length of a replacement tag placeholder.

#define MAX_FLASH_FNLEN 16

Maximum length of a filename in the Flash storage.

#define BUF_LEN 32

Maximum length of a GET-style URL parameter name and value.

#define MAX_URL_LEN 128

Maximum length of an URL to process.

#define SERVER_PORT 80

TCP port the server will listen on.

NOTE: Port 80 can not be used on DigiFi. NOTE: Currently changing this will have no effect with most cards. Sorry.

#define CLIENT_BUFSIZE 64

Size of output buffer. This speeds up transmission, by sending clients more than one character at a time. Size it appropriately according to available RAM. Theoretically it could be reduced to 1, but this has not been tested.

#define MAX_USERPASS_LEN 32

This is the maximum length of the username:password string that needs to be hashed for validating Basic Authorization requests.

#define CLIENT_TIMEOUT 2500

Maximum time in milliseconds without receiving characters after which a client connection is dropped. Solves hanging connection from Chrome on OSX. Undefine to turn off this feature.

NOTE: This feature is not available on ENC28J60 when using the EtherCard library.

Debug Options

You are not going to need these unless you are a developer, in which case I'll let you figure out what they do on your own ;).

#define WEBBINO_NDEBUG

DEFINE this to DISABLE debug messages

#define VERBOSE_REQUEST_PARSER

Clone this wiki locally