Meaning of "o" or "b" and "i"

#1
["foo", "o", {title: "my app settings"}]
["foo.enable", "b", true, {title: "Enable foo"}]

I have questions about the meaning of “o” or “b” and sometime “i” on the above code, usually they are written in the mos.yml file.
what are they? and how many letter are they? how & when to use them?

- ["app.pin", "i", 5, {title: "GPIO pin a sensor is attached to"}]

i’m assuming " i " mean intger, what does 5 mean ?

#2

The config_schema section of the mos.yml provides a way to define configuration options for the device and override options defined elsewehre (e.g. in alibrary).
Example:

config_schema:
 - ["app", "o", {title: "My app settings"}]                                # "o"=object
 - ["app.name", "s", "My app name", {title: "Application's name"}]         # "s"=string
 - ["app.led_pin", "i", 2, {title: "LED pin. Default GPIO2"}]              # "i"=int
 - ["app.led_enable", "b", true, {title: "LED enable. Default true"}]      # "b"=bool
 - ["app.interval", "d", 123.45, {title: "A double value"}]                # "d"=double
 - ["app.uint_val", "ui", 12345678, {title: "An unsigned integer value"}]  # "ui"=unsigned int
 - ["i2c.enable", true]                                                    # overrides i2c.enable from the i2c library

During the build process, each object defined in the config_schema will be compiled in a C structure (the boolean type is translated to int with values 0 for false and 1 for true):

struct mgos_config_app {
  const char * name;
  int led_pin;
  int led_enable;
  double interval;
  unsigned int uint_val;
};

The default values can be changed at runtime running, e.g

mos config-set app.led_enable=false
mos config-set app.name="New app"

These settings can be used in your code to do an action according to their values:

  if((mgos_sys_config_get_app_led_pin() > 0) && mgos_sys_config_get_app_led_enable()){
    // toggle the led
    mgos_gpio_toggle(mgos_sys_config_get_app_led_pin());
  }
#3

Thank you Mr. Nliviu for the fast reply :blush:, make sense now,

Thanks again, I really appreciate it