Willkommen bei MattzoBricks Foren Sensors Address conflict?

Ansicht von 5 Antwort-Themen
  • Autor
    Beiträge
    • #8664
      Edwin BlomEdwin Blom
      Teilnehmer

      Hello,
      I am pulling my already grey, hair out because of this issue 🙂
      I have an MLC controller (Joy-it NodeMCU V2 ESP8266) with the following configuration;
      – A level controller using D0 for booms with address 1101 and D1 and D2 for lights with address 1101
      – Four signals using D3 to D6 with addresses 3,4,5 and 6
      – A sensor using D7 with address 1
      All configured correctly in RocRail.
      The problem is when I close the level controller, lights and booms work fine but the sensor at D7 (address 1) is activated as well. This is an In sensor and in automatic mode it therefore often generates a kill because of “IN event without ENTER”.
      Any idea what I am doing wrong? I can of course rewire the sensor to another MLC but would like to understand the issue.
      Thanks in advance.
      ps using firmware 1.2.2

      • Dieses Thema wurde vor 8 Stunden, 17 Minuten von Edwin BlomEdwin Blom geändert.
    • #8666
      Matthias RunteMatthias Runte
      Administrator

      Hi Edwin,
      happy to hear that you are working on boom barriers. A nice toy, isn’t it?

      Could you paste your MLC configuration, please? The controller_config.h would be sufficient.

      Thanks!

    • #8670
      Edwin BlomEdwin Blom
      Teilnehmer

      // Number of servos
      #define NUM_SERVOS 1

      TServoConfiguration servoConfiguration[NUM_SERVOS] =
      {
      {
      .pin = D0,
      .pinType = 0,
      .detachAfterUsage = true
      },
      };

      // LED WIRING CONFIGURATION

      // LEDs are used in signals, level crossing lights or bascule bridge lights
      // As an example, 2 LEDs are required for a light signal with 2 aspects

      // Number of LEDs
      #define NUM_LEDS 6

      TLEDConfiguration ledConfiguration[NUM_LEDS] =
      {
      {
      .pin = D1,
      .pinType = 0
      },
      {
      .pin = D2,
      .pinType = 0
      },
      {
      .pin = D3,
      .pinType = 0
      },
      {
      .pin = D4,
      .pinType = 0
      },
      {
      .pin = D5,
      .pinType = 0
      },
      {
      .pin = D6,
      .pinType = 0
      }
      };

      // SENSOR WIRING CONFIGURATION

      // Sensors are generally used to indicate that a train have reached a specific position on the layout
      // Special forms are remote and virtual sensors (see below)

      // Number of sensors connected or connectable to the controller
      #define NUM_SENSORS 1

      // A special form of a sensor is the “remote sensor”
      // Remote sensors are not electrically connected to this controller, they are triggered via Rocrail commands.
      // Remote sensors can be used for level crossings in Autonomous Mode.
      // Set REMOTE_SENSORS_ENABLED to true to generally enable remote sensors.
      // If you do not control a level crossing in Autonomous Mode with this controller, set to false!
      #define REMOTE_SENSORS_ENABLED false

      TSensorConfiguration sensorConfiguration[NUM_SENSORS] =
      {
      {
      .pin = D7,
      .pinType = LOCAL_SENSOR_PIN_TYPE,
      .remoteMattzoControllerId = -1
      },
      };

      // STATUS LED WIRING CONFIGURATION

      // Digital output pin to monitor controller operation (typically a LED)
      // Set to false if no status LED is installed
      const bool STATUS_LED_PIN_INSTALLED = true;
      // If installed, the pin controlling the status LED
      const uint8_t STATUS_LED_PIN = D8;
      // If installed, set to true to flip high/low state of the status led pin
      const bool STATUS_LED_REVERSE = false;
      // Power level of the status LED (0..1023)
      // Recommended max. power levels: white: 800, blue: 600, green: 500, yellow: 350, red: 300
      const int STATUS_LED_POWER = 600;

      // ****************************
      // LOGICAL OBJECT CONFIGURATION
      // ****************************

      // SWITCH CONFIGURATION

      // Number of switches
      #define NUM_SWITCHES 0

      TSwitchConfiguration switchConfiguration[NUM_SWITCHES] = {};

      // SIGNAL CONFIGURATION

      // Number of signals
      #define NUM_SIGNALS 2
      // Maximum number of signal aspects (e.g. 2 for red/green, 3 for red/green/yellow etc.)
      #define NUM_SIGNAL_ASPECTS 2
      // Number of signal LEDs (usually equal to NUM_SIGNAL_ASPECTS)
      #define NUM_SIGNAL_LEDS 2
      // Maximum number of servos for form signals (e.g. one for the primary and another one for the secondary semaphore)
      // If no form signals are used, just set to 0
      #define NUM_SIGNAL_SERVOS 0

      TSignalConfiguration signalConfiguration[NUM_SIGNALS] =
      {
      // signal 0: light signal with 2 aspects, controlled via Rocrail ports 1 and 2
      {
      .aspectRocrailPort = {3, 4},
      .aspectLEDPort = {2, 3},
      .aspectLEDMapping = {
      {true, false},
      {false, true}},
      .servoIndex = {},
      .aspectServoAngle = {},
      .overshootSensorIndex = -1
      },
      // signal 1: light signal with 2 aspects, controlled via Rocrail ports 1 and 2
      {
      .aspectRocrailPort = {5, 6},
      .aspectLEDPort = {4, 5},
      .aspectLEDMapping = {
      {true, false},
      {false, true}},
      .servoIndex = {},
      .aspectServoAngle = {},
      .overshootSensorIndex = -1
      }
      };

      // LEVEL CROSSING CONFIGURATION

      // General switch for level crossing (false = no level crossing connected; true = level crossing connected)
      #define LEVEL_CROSSING_CONNECTED true

      // Number of boom barrier servos configured for the level crossing
      #define LC_NUM_BOOM_BARRIERS 1

      // Number of signals configured for the level crossing
      #define LC_NUM_LEDS 2

      // Number of level crossing sensors
      #define LC_NUM_SENSORS 0

      // Number of tracks leading over the level crossing
      #define LC_NUM_TRACKS 1

      TLevelCrossingConfiguration levelCrossingConfiguration =
      {
      .rocRailPort = 1101,
      .servoIndex = {0},
      .bbClosingPeriod_ms = 3500,
      .bbClosingDelayPrimary_ms = 0,
      .bbClosingDelaySecondary_ms = 1250,
      .bbOpeningPeriod_ms = 3500,
      .bbAnglePrimaryUp = 0,
      .bbAnglePrimaryDown = 60,
      .bbAngleSecondaryUp = 180,
      .bbAngleSecondaryDown = 90,
      .ledIndex = {0, 1},
      .ledFlashingPeriod_ms = 750,
      .ledsFading = true,
      .sensorIndexBoomsClosed = 0,
      .sensorIndexBoomsOpened = 1,

      .autonomousModeEnabled = false,
      .trackReleaseTimeout_ms = 30000,
      .sensorConfiguration =
      {}
      };

    • #8671
      Edwin BlomEdwin Blom
      Teilnehmer

      Matthias,
      Great toy indeed. It was working before but this year I ‘optimised’ my lay-out to use only 4 MLC instead of 6 and maybe that caused some issues.
      By the way, very happy with firmware 1.2.2. Seems faster. Also, using a ESP32S3 for MTC4BT seems to improve the response time of train stops. many thanks for all your work

    • #8672
      Matthias RunteMatthias Runte
      Administrator

      It guys like you that we are doing this for. I am happy that people actually use all this stuff and enjoy it.

      The problem in your configuration is the “sensorIndexBoomsClosed” property of the levelCrossingConfiguration object. It is set to zero. That means that sensor index 0 is triggered when the booms are closed. This is your sensor on D7. This is why the sensor is triggred when the booms are closed.

      You can either set sensorIndexBoomsClosed (and for consistency also sensorIndexBoomsOpened) to -1, which would disable sending sensor events upon booms opened or closed; or you define two additional virtual sensors (type VIRTUAL_SENSOR_PIN_TYPE, check out the level crossing example configuration file) and map sensorIndexBoomsClosed and sensorIndexBoomsOpened to those sensor indices. Using those virtual sensors is quite handy, as you can use it to prevent the train going over the level crossing when the booms are not yet closed.

      • Diese Antwort wurde vor 3 Stunden, 1 Minute von Matthias RunteMatthias Runte geändert.
    • #8674
      Edwin BlomEdwin Blom
      Teilnehmer

      Many thanks Matthias. D7 was always unused on this controller hence the mistake remained unnoticed. Thanks for the quick response!

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