Ansicht von 1 Antwort-Thema
  • Autor
    Beiträge
    • #6565
      R. v/d MeulenR. v/d Meulen
      Teilnehmer

      Hello everyone,

      I was wondering if the 4dbrix wifi train controller is working with the software. The 4dbrix controller is on the same network with the same mqtt broker as the MTC4PF but there is no response. Hereby the code:
      / LOCOS
      // *****

      // Number of locos (aka. MattzoLocos) controlled by this controller
      const int NUM_LOCOS = 1;

      // List of MattzoLocos
      // The parameters have the following meaning:
      // – locoName: name of the loco as setup in Rocrail
      // – locoAddress: address of the loco as setup in Rocrail
      // – accelerationInterval: time interval for acceleration / braking (default: 100 ms)
      // – accelerateStep: power increment for each acceleration step
      // – brakeStep: : power decrement for each braking step
      MattzoLocoConfiguration* getMattzoLocoConfiguration() {
      static MattzoLocoConfiguration locoConf[NUM_LOCOS];

      locoConf[0] = (MattzoLocoConfiguration){
      .locoName = “REDPASSENGERTRAIN”,
      .locoAddress = 7889,
      .accelerationInterval = 100,
      .accelerateStep = 2,
      .brakeStep = 5
      };

      return locoConf;
      }

      // *************
      // MOTOR SHIELDS
      // *************
      // Number of motor shields connected to this controller
      const int NUM_MOTORSHIELDS = 1;

      // List of motor shields that are controlled by this controller
      // The parameters have the following meaning:
      // – locoAddress: loco that this motor shields is attached to
      // – motorShieldType: motor shield type
      // – L298N_enA, L298N_enB: PWM signal pin for motor A / B, if L298N is used.
      // – in1..in4: pin for motor direction control for motor shields L298N and L9110 (in1: forward motor A, in2: reverse motor A, in3: forward motor B, in4: reverse motor B).
      // – minArduinoPower: minimum power setting for Arduino based motor shields
      // – maxArduinoPower: maximum power setting for Arduino based motor shields (max. 1023)
      // – configMotorA: turning direction of motor A (1 = forward, -1 = backward, 0 = unused). In case of LEGO IR Receiver 8884, this is the motor connected to the red port.
      // – configMotorB: same for motor B; if IR receiver: blue port
      // – irChannel: if a LEGO IR Receiver 8884 is used, the selected channel of the receiver. May be 0, 1, 2 or 3. If the loco uses multiple IR receivers on different channels, additional motor shields for the loco are required.
      MattzoMotorShieldConfiguration* getMattzoMotorShieldConfiguration() {
      static MattzoMotorShieldConfiguration msConf[NUM_MOTORSHIELDS];

      // Type of motor shield directly wired to the controller.
      // (The different motor shield types are defined in MTC4PF.ino)
      // Set to MotorShieldType::NONE if only virtual motor shields are used!
      const MotorShieldType MOTORSHIELD_TYPE = MotorShieldType::NONE;

      msConf[0] = (MattzoMotorShieldConfiguration){};
      //; .locoAddress = 7889,
      // .motorShieldType = MotorShieldType::NONE,
      // .L298N_enA = 0,
      // .L298N_enB = 0,
      // .in1 = 0,
      // .in2 = 0,
      // .in3 = 0,
      // .in4 = 0,
      // .minArduinoPower = 0,
      // .maxArduinoPower = MAX_ARDUINO_POWER,
      // .configMotorA = 1,
      // .configMotorB = 1,
      // .irChannel = 0
      //};

      return msConf;
      }

      // *************************
      // TRAIN LIGHT CONFIGURATION
      // *************************

      // Number of train lights controlled by this controller
      #define NUM_TRAIN_LIGHTS 1

      TTrainLightConfiguration trainLightConfiguration[NUM_TRAIN_LIGHTS] =
      {
      {
      // head lights for Red Passenger Train
      .trainLightType = TrainLightType::POWER_FUNCTIONS,
      .pin = D0,
      .motorShieldIndex = 0,
      .motorPortIndex = 1,
      .powerLevelOff = 0,
      .powerLevelOn = MAX_ARDUINO_POWER}};

      // ******************************
      // FUNCTION MAPPING CONFIGURATION
      // ******************************

      // Rocrail functions are used to MANUALLY switch train lights on and off

      // Number of function mappings
      #define NUM_FUNCTION_MAPPINGS 2

      TLocoFunctionMappingConfiguration locoFunctionMappingConfiguration[NUM_FUNCTION_MAPPINGS] =
      {
      {.locoAddress = 7889,
      .fnNo = 1,
      .fnOnOff = true,
      .trainLightIndex = 0,
      .trainLightStatus = TrainLightStatus::ON},
      {.locoAddress = 7889,
      .fnNo = 1,
      .fnOnOff = false,
      .trainLightIndex = 0,
      .trainLightStatus = TrainLightStatus::OFF}};

      // *********************************
      // TRAIN LIGHT TRIGGER CONFIGURATION
      // *********************************

      // Triggers are used to AUTOMATICALLY switch train lights on and off

      // Number of train light triggers as defined just below
      #define NUM_TRAIN_LIGHT_TRIGGERS 2

      TTrainLightTriggerConfiguration trainLightTriggerConfiguration[NUM_TRAIN_LIGHT_TRIGGERS] =
      {
      {.locoAddress = 7889,
      .lightEventType = LightEventType::FORWARD,
      .trainLightIndex = 0,
      .trainLightStatus = TrainLightStatus::ON},
      {.locoAddress = 7889,
      .lightEventType = LightEventType::REVERSE,
      .trainLightIndex = 0,
      .trainLightStatus = TrainLightStatus::OFF},
      };

      // ************************
      // CONTROLLER CONFIGURATION
      // ************************

      // Configuration for motorshield type Lego IR Receiver 8884
      const uint8_t IR_LED_PIN=D5; // pin on which the IR LED is installed that controls all attached Lego IR Receiver 8884s.

      // Digital output PIN to monitor controller operation (typically a LED)
      const bool STATUS_LED_PIN_INSTALLED=true;
      const uint8_t STATUS_LED_PIN=D8;
      const bool STATUS_LED_REVERSE=true;

      // Report battery level
      #define REPORT_BATTERYLEVEL false // set to true or false to allow or omit battery level reports
      #define SEND_BATTERYLEVEL_INTERVAL 60000 // interval for sending battery level in milliseconds
      #define BATTERY_PIN A0
      const int VOLTAGE_MULTIPLIER = 20000 / 5000 – 1; // Rbottom = 5 kOhm; Rtop = 20 kOhm; => voltage split factor
      #define MAX_AI_VOLTAGE 5100 // maximum analog input voltage on pin A0. Usually 5000 = 5V = 5000mV. Can be slightly adapted to correct small deviations

      // ****************
      // NETWORK SETTINGS
      // ****************

      // Trigger emergency brake upon disconnect
      const bool TRIGGER_EBREAK_UPON_DISCONNECT=true;

      // WiFi Hostname
      // Hostnames must start with a-z, A-Z, 0-9. From 2nd character, hyphens (“-“) may also be used
      const char* MC_HOSTNAME = “MTC4PF-RedPassengerTrain”;

      // Syslog application name
      const char* SYSLOG_APP_NAME = “MTC4PF-RedPassengerTrain”;

      Best regards,

      R. v/d Meulen

    • #6569
      Matthias RunteMatthias Runte
      Administrator

      We have supported 4DBrix Wifi Train Controllers for a long time, but apparently nobody was really interested in that. After I sold most of my 4DBrix stuff, I removed the 4DBrix support from the firmware in February 2022. 4DBrix is supported in older versions of the MTC4PF firmware only (versions before V1.0, I believe).

Ansicht von 1 Antwort-Thema
  • Du musst angemeldet sein, um auf dieses Thema antworten zu können.