Welcome to MattzoBricks Forums MattzoTrainController for Bluetooth (MTC4BT) locoConfigs structure in controller_config.json

Viewing 2 reply threads
  • Author
    Posts
    • #6733
      Dirk SchäferDirk Schäfer
      Participant

      Hello,

      after a very long time I finally had some time to work on my train layout and to integrate new locomotives.

      After uploading the new config files the controller crashed. I realized that the size of the controller_config.json is now larger than 4K. In your documentation you describe that “If your controller_config.json file is too large, use the “locoConfigs” structure to move your locomotive configurations to separate files.”

      Can you please give me an example how this has to be done. I assume that there has to be a reference in the controller_config.json and that the separate files of the locoConfigs need a certain structure.

      Thank you in advance.
      Dirk

    • #6734
      Matthias RunteMatthias Runte
      Keymaster

      Hi Dirk,
      I will add some official examples to the source code with the next official firmware release. In the meantime, I will send you some example files via e-mail.

      The basic idea is as follows.

      The controller_config.json file could look like this:

      {
      “name”: “MTC4BT-MULT3”,
      “espPins”: [
      ],
      “fn”: [
      ],
      “locos”: [
      ],
      “locoConfigs”: [
      “/loco_e03.json”,
      “/loco_br146.json”,
      “/loco_est.json”
      ]
      }

      The single files contain the structure that is usually located within the locos array in the main controller_config.json file, e.g.:

      {
      “address”: 103,
      “name”: “E03”,
      “speedStep”: 10,
      “brakeStep”: 20,
      “bleHubs”: [
      {
      “type”: “SBrick”,
      “address”: “84:2e:14:4f:d6:04”,
      “channels”: [
      {
      “channel”: “B”,
      “attachedDevice”: “motor”,
      “direction”: “forward”
      },
      {
      “channel”: “D”,
      “attachedDevice”: “motor”,
      “direction”: “reverse”
      }
      ]
      },
      {
      “type”: “SBrick”,
      “address”: “84:2e:14:51:79:8b”,
      “channels”: [
      {
      “channel”: “A”,
      “attachedDevice”: “motor”,
      “direction”: “forward”
      },
      {
      “channel”: “D”,
      “attachedDevice”: “motor”,
      “direction”: “reverse”
      }
      ]
      }
      ],
      “fn”: [
      {
      “name”: “f2”,
      “device”: “bleHub”,
      “address”: “58:8e:81:58:b2:00”,
      “channel”: “B”
      }
      ]
      }

      Voila.

    • #6737
      Dirk SchäferDirk Schäfer
      Participant

      Hi Matthias,
      this works perfectly. And it is even more convient than a single config-file. Thank you.
      Have a nice sunday.
      Dirk

Viewing 2 reply threads
  • You must be logged in to reply to this topic.