> For the complete documentation index, see [llms.txt](https://irnas.gitbook.io/opencollar/-MDJCI9OmpOqWrQzjNIR/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://irnas.gitbook.io/opencollar/-MDJCI9OmpOqWrQzjNIR/firmware/settings-module/settings-json.md).

# Settings JSON

Settings, values, commands and messaging structures.

## settings.json

Settings, values, commands and messages are determined by the settings.json structure, that is parsed in build time to several .h and .c files, as described below.&#x20;

It contains the following main fields:

* **fw\_version**
  * **major**
  * **minor**
* **hardware**
  * **type** - firmware type, for example "wisentedge\_nrf52840"
  * **version**
    * major
    * minor
* **settings**
  * **port** - port on which settings are sent and received from
  * **type** - settings type, based on tracker type
  * **setting of the form:**
  * setting\_name
    * id - for "basic settings" from 0x01 to 0x0F, for "advanced" from 0x11 to 0x9F
    * enabled - true or false&#x20;
    * default - default value
    * min - min value
    * max - max value
    * length - in bytes
    * conversion - data type, possible options:
      * uint8, uint16, uint32, int8, int16, int32
      * float
      * byte\_array
      * bool
* **commands**
  * **port** - port on which commands are sent and received from
  * **commands of the form:**
  * command\_name
    * id - from 0xA1 to 0xCF
    * length - length of send command value, if 0 none
    * conversion - data type of send value, if there is non uint8 is used
    * value - default value, 0 if none
* **values**
  * **port** - port on which settings are sent and received from
  * **values of the form:**
  * value\_name
    * id - from 0xD1 to 0xEF
    * enabled - true or false&#x20;
    * default - default value
    * min - min value
    * max - max value
    * length - in bytes
    * conversion - data type, possible options:
      * uint8, uint16, uint32, int8, int16, int32
      * float
      * byte\_array
      * bool
* **messages**
  * **messages of the form:**
  * message\_name
    * port - to send message on
    * id - from 0xF1 to 0xFF
    * length - in bytes
    * conversion - data type, possible options:
      * uint8, uint16, uint32, int8, int16, int32
      * float
      * byte\_array
      * bool

## Python parser

Python parser `py2h.py` and validation script `validate_data.py` are used to convert `settings.json` file to c files.&#x20;

In particular the following files are generated:

* `hardware_def.h` - containing only definitions from "hardware" field
* `settings_def.h` and `settings_def.c` - containing settings structure and auto-generated functions for access and writing to structure
* `commands_def.h` and `commands_def.c` - commands defines and settings
* `values_def.h` and `values_def.c` - containing main values structure and auto-generated functions for access and writing to structure
* `messages_def.h` and `messages_def.c` - message defines and messages

All auto-generated files are equipped with `/* AUTOGENERATED FILE - DO NOT MODIFY!  */` comment. Sections below describe content of each generated file and helping files.
