Skip to content
Snippets Groups Projects
fc_server_config.md 9.33 KiB

Fadecandy: Server Configuration

The Fadecandy Server is configured with a JSON object. There is a default configuration built-in, which you can see by running fcserver -h. A copy of this configuration is also included as examples/config/default.json.

A new configuration file can be given to fcserver on the command line in the following manner:

$ <path to fcserver> <path to config.json file>

You can use one of the examples as a starting point. Typically the default configuration will work for any single-controller setup. If you're using multiple controllers or there are other options you want to tweak, you'll want to create an fcserver configuration file for your project.

Parts of the JSON config format are shared with the network protocols. For example, color correction data and device information are stored in a common format. Some parts of the JSON configuration file can be modified at runtime.

Top-level Object

The configuration file is a JSON object. By default, it looks like this:

{
    "listen": ["127.0.0.1", 7890],
    "verbose": true,

    "color": {
        "gamma": 2.5,
        "whitepoint": [1.0, 1.0, 1.0]
    },

    "devices": [
        {
            "type": "fadecandy",
            "map": [
                [ 0, 0, 0, 512 ]
            ]
        }
    ]
}
Name Summary
listen What address and port should the server listen on?
verbose Does the server log anything except errors to the console?
color Default global color correction settings
devices List of configured devices

Listen

By default, fcserver listens on port 7890 on the local (loopback) interface. This server will not be reachable by other computers on your network, only by programs on the same computer.

The "listen" configuration key must be a JSON array of the form [host, port], where port is a number and host is either a string or null. If the host is null, fcserver listens on all network interfaces and it's reachable from other computers

Warning: Do not run fcserver on an untrusted network. It has no built-in security provisions, so anyone on your network will have control of fcserver. Additionally, bugs in fcserver may compromise the security of your computer.

Color

The "color" configuration key is a JSON object containing color correction data. This color correction data can also be changed at runtime by both the OPC and WebSocket interfaces. If instead of an object "color" is null, a linear (identity mapped) color table is used.

The default color configuration is:

"color": {
    "gamma": 2.5,
    "whitepoint": [0.98, 1.0, 1.0]
    "linearSlope": 1.0,
    "linearCutoff": 0.0
},

Supported keys in the "color" object are:

Name Description
gamma Exponent for the nonlinear portion of the brightness curve
whitepoint Vector of [red, green, blue] values to multiply by colors prior to gamma correction
linearSlope Slope (output / input) of the linear section of the brightness curve
linearCutoff Y (output) coordinate of intersection between linear and nonlinear curves