Forum Replies Created
-
AuthorPosts
-
Mitja Cernich
ParticipantHi Hilbert,
after a few minutes it started workingMitja Cernich
ParticipantI don’t know how, but not it working:
[0031] [1] [DEBUG] [WiFi-event] event: 20[0032] [1] [DEBUG] Ethernet connected
[0033] [1] [DEBUG] [WiFi-event] event: 22Obtained ETH IP address: 192.168.0.100
ETH connected
IP address:
192.168.0.100
MAC Address: A2:A3:B3:96:47:EDMitja Cernich
ParticipantOK i switch from “info to “debug” in network_config.json on logging > min_level
[1] Setup: Starting MTC4BT…
[1] Setup: Loading network configuration…
Syslog: Server: 192.168.x.y:514
Syslog: Hostname: mtc4bt
Syslog: Appname: MTC4BT
[0000] [1] [INFO] Logging: Configured.
Config: File is empty
[0001] [1] [DEBUG] No lookuptable found, or empty
[0002] [1] [INFO] Setup: Loading controller configuration…
[0003] [1] [INFO] Config: Read controller name: MTC4BT
[0004] [1] [INFO] Config: Read ESP pin configuration (1).
[0005] [1] [DEBUG] Number of events loaded: 0.
[0006] [1] [DEBUG] Number of events loaded: 0.
[0007] [1] [INFO] CTRL: Local channels initialized.
[0008] [1] [INFO] Setup: Controller configuration completed.
[0009] [1] [INFO] setup: WiFi Event ID: 4
[0010] [1] [DEBUG] [WiFi-event] event: 0[0011] [1] [DEBUG] WiFi interface ready
[0012] [1] [DEBUG] [WiFi-event] event: 2[0013] [1] [DEBUG] WiFi client started
[0014] [1] [DEBUG] [WiFi-event] event: 18[0015] [1] [DEBUG] Ethernet started
[0016] [1] [INFO] Wait for WiFi/ETH…
[0017] [1] [INFO] MQTT: Connecting to 192.168.0.200:1883…
[0018] [1] [INFO] Setup: Initializing BLE…
[0019] [1] [INFO] Setup: MattzoTrainController for BLE running.
[0020] [1] [INFO] Setup: Number of locos to discover hubs for: 2
[0021] [1] [INFO] Setup: Number of remotes to discover hubs for: 0
[0022] [1] [DEBUG] SetE-Brake: 1
[0023] [1] [DEBUG] SetE-Brake: 1
[0024] [0] [INFO] BLE : Scanning for 2 hub(s)…Mitja Cernich
ParticipantHow can I switch the debug info on? Thanks
Mitja Cernich
ParticipantHi, i have the same problem:
network_config.json
{
“logging”: {“min_level”: “info”,
“serial”: {“enabled”: true
},
“syslog”: {“enabled”: true,
“server”: “192.168.x.y”,
“port”: 514,
“appname”: “MTC4BT”
}
},
“network” : {“hostname”: “mtc4bt”,
“otaPassword”: “xxxxxx”,
“type” : “wired”
},
“wifi”: {“SSID”: “Rocrail”,
“password”: “Rocc”,
“wait”: 500
},
“mqtt”: {“broker”: “192.168.0.200”,
“port”: 1883,
“keepalive”: 10,
“ping”: 0
}
}my_platformio.ini
[platformio]
default_envs = esp32; This controller must be configured through config files in the folder you define below.
; Configure your network in thenetwork_config.json
file.
; Configure the controller in thecontroller_config.json
file.
; See the/data_example
folder for example configuration files.
; Runplatformio.exe run --target uploadfs
to upload the data-folder content to the ESP32.
; moved to my_platformio.ini
; for Linux you have to add a / before $PROJECT_DIR
data_dir = /$PROJECT_DIR/data/MTC4BT1[common]
; To show memory usage every minute, uncomment the line -DTICKER=1
; To see what the hubs report back on not cached messages uncomment the lines,
; this is for debugging only and should only be used if instructed to do so
; To reduce the delays in the BLE driver loops change the value of DRIVERTASKDELAY,
; changing this yourself without a hint of the developers may cause strange behaviors
; and even crashes!
additional_build_flags =
-DWIRED
; -DTICKER=1
; -DDEBUGNOTIFYBUWIZZ2
; -DDEBUGNOTIFYPU
; -DDEBUGNOTIFYPUREMOTE
; -DDRIVERTASKDELAY=100
; -DPUFREELISTACTIONDELAY=250
upload_com_port = /dev/cu.usbserial-0001
; for macOS, just as example
;upload_com_port = /dev/tty.usb[env:esp32]
; Use either the ‘upload_port’ line above if the ESP32 is connected to your PC’s USB port or enable/configure the three lines below to use OTA updates.
; The IP address should match that of the controller on your network.
; The <otaPassword> should match the current password from the network_config.json you previously uploaded to the controller.
;upload_protocol = espota
;upload_port = 192.168.x.y
;upload_flags =
; –auth=<ota password>;[env:seeed_xiao_esp32-s3]
;upload_protocol = espota
;upload_port = 192.168.x.z
;upload_flags =
; –auth=<ota password>from the monitor on boot of eps32:
[1] Setup: Starting MTC4BT…
[1] Setup: Loading network configuration…
Syslog: Server: 192.168.x.y:514
Syslog: Hostname: mtc4bt
Syslog: Appname: MTC4BT
[0000] [1] [INFO] Logging: Configured.
Config: File is empty
[0002] [1] [INFO] Setup: Loading controller configuration…
[0003] [1] [INFO] Config: Read controller name: MTC4BT
[0004] [1] [INFO] Config: Read ESP pin configuration (0).
[0007] [1] [INFO] CTRL: Local channels initialized.
[0008] [1] [INFO] Setup: Controller configuration completed.
[0009] [1] [INFO] setup: WiFi Event ID: 4
[0016] [1] [INFO] Wait for WiFi/ETH…
[0017] [1] [INFO] MQTT: Connecting to 192.168.0.200:1883…
[0018] [1] [INFO] Setup: Initializing BLE…
[0019] [1] [INFO] Setup: MattzoTrainController for BLE running.
[0020] [1] [INFO] Setup: Number of locos to discover hubs for: 2
[0021] [1] [INFO] Setup: Number of remotes to discover hubs for: 0
[0024] [0] [INFO] BLE : Scanning for 2 hub(s)…Where am i going wrong? thank you so much
January 14, 2025 at 15:10 in reply to: First configuration of MTC4BT – how connect to the Lego hub? #8089Mitja Cernich
ParticipantI followed your advice, and it works! Now the log shows 2 hubs, and the first configured hub, as soon as I turn it on, flashes twice and then the LED stays solid, so it connects successfully.
controller_config.json:
{
“name”: “MTC4BT”,
“espPins”: [],
“locos”: [
{
“address”: 1,
“name”: “60197”,
“bleHubs”: [
{
“type”: “PU”,
“address”: “90:84:2b:cf:81:47”,
“channels”: [
{
“channel”: “A”,
“attachedDevice”: “motor”
},
{
“channel”: “B”,
“attachedDevice”: “motor”,
“direction”: “reverse”
}
]
}
]
},
{
“address”: 2,
“name”: “60051”,
“bleHubs”: [
{
“type”: “PU”,
“address”: “90:84:2b:cf:83:47”,
“channels”: [
{
“channel”: “A”,
“attachedDevice”: “motor”
},
{
“channel”: “B”,
“attachedDevice”: “motor”,
“direction”: “reverse”
}
]
}
]
}]
}Thank you to all!!!
January 14, 2025 at 12:01 in reply to: First configuration of MTC4BT – how connect to the Lego hub? #8084Mitja Cernich
ParticipantI followed the same steps on a Windows PC, and I have the same issue. The path “/loco_simple.json” in the controller_config.json file doesn’t work…
January 14, 2025 at 11:24 in reply to: First configuration of MTC4BT – how connect to the Lego hub? #8083Mitja Cernich
ParticipantI always use ‘Upload Filesystem Image.’ It uploads all the configurations of all the files, including the loco_simple.json file, because if I delete the content of this file and upload again, the ESP starts searching for Bluetooth devices. So the upload works. The problem is in the part of the code in controller_config.json, specifically:
“locoConfigs”: [ “/loco_simple.json” ]
If I change the destination by entering one that doesn’t exist (like: “/loco_simplexxx.json”, it always returns the same log:
0008] [1] [INFO] Setup: Initializing BLE…
[0009] [1] [INFO] Setup: MattzoTrainController for BLE running.
[0010] [1] [INFO] Setup: Number of locos to discover hubs for: 1
[0011] [1] [INFO] Setup: Number of remotes to discover hubs for: 0However, if I delete the content of the destination, the ESP32 starts searching for Bluetooth devices.
January 14, 2025 at 10:59 in reply to: First configuration of MTC4BT – how connect to the Lego hub? #8080Mitja Cernich
ParticipantIf I change the destination route in the controller_config.json file and add a route that doesn’t exist, the log always returns the same data:
[0008] [1] [INFO] Setup: Initializing BLE…
[0009] [1] [INFO] Setup: MattzoTrainController for BLE running.
[0010] [1] [INFO] Setup: Number of locos to discover hubs for: 1
[0011] [1] [INFO] Setup: Number of remotes to discover hubs for: 0controller_config.json:
{
“name”: “MTC4BT”,
“espPins”: [],
“locos”: [],
“locoConfigs”: [
“/loco_simplezzzz.json”
]
}-
This reply was modified 8 months, 2 weeks ago by
Mitja Cernich.
January 14, 2025 at 10:43 in reply to: First configuration of MTC4BT – how connect to the Lego hub? #8079Mitja Cernich
ParticipantOk thank you, but if this were the problem, neither the controller_config.json file nor the network_config.json file should work. Correct?
January 14, 2025 at 10:36 in reply to: First configuration of MTC4BT – how connect to the Lego hub? #8077Mitja Cernich
Participantloco_simple.json:
{
“locos”: [
{
“address”: 1,
“name”: “60197”,
“bleHubs”: [
{
“type”: “PU”,
“address”: “90:84:2b:cf:81:47”,
“channels”: [
{
“channel”: “A”,
“attachedDevice”: “motor”
},
{
“channel”: “B”,
“attachedDevice”: “motor”,
“direction”: “reverse”
}
]
}
]
},
{
“address”: 2,
“name”: “60051”,
“bleHubs”: [
{
“type”: “PU”,
“address”: “”,
“channels”: [
{
“channel”: “A”,
“attachedDevice”: “motor”
},
{
“channel”: “B”,
“attachedDevice”: “motor”,
“direction”: “reverse”
}
]
}
]
}]
}However, I notice that the output log is as follows:
[0008] [1] [INFO] Setup: Initializing BLE…
[0009] [1] [INFO] Setup: MattzoTrainController for BLE running.
[0010] [1] [INFO] Setup: Number of locos to discover hubs for: 1
[0011] [1] [INFO] Setup: Number of remotes to discover hubs for: 0The output log is identical to the configuration from before, with just one hub. I made a mistake writing the file loco_simple.json?
January 14, 2025 at 10:14 in reply to: First configuration of MTC4BT – how connect to the Lego hub? #8075Mitja Cernich
ParticipantCorrect configuration: 2 PU train motors attached to one PU HUB.
my_platformio.ini file:
[platformio]
default_envs = esp32doit-devkit-v1; This controller must be configured through config files in the folder you define below.
; Configure your network in thenetwork_config.json
file.
; Configure the controller in thecontroller_config.json
file.
; See the/data_example
folder for example configuration files.
; Runplatformio.exe run --target uploadfs
to upload the data-folder content to the ESP32.
; moved to my_platformio.ini
; for Linux you have to add a / before $PROJECT_DIR
data_dir = /$PROJECT_DIR/data/MTC4BT1[common]
; To show memory usage every minute, uncomment the line -DTICKER=1
; To use w5500 module for wired connections, uncomment the line -DWIRED
; To see what the hubs report back on not cached messages uncomment the lines,
; this is for debugging only and should only be used if instructed to do so
; To reduce the delays in the BLE driver loops change the value of DRIVERTASKDELAY,
; changing this yourself without a hint of the developers may cause strange behaviors
; and even crashes!
additional_build_flags =
; -DWIRED
; -DTICKER=1
; -DDEBUGNOTIFYBUWIZZ2
; -DDEBUGNOTIFYPU
; -DDEBUGNOTIFYPUREMOTE
; -DDRIVERTASKDELAY=250
; -DPUFREELISTACTIONDELAY=100
upload_com_port = /dev/cu.usbserial-0001
; for macOS, just as example
;upload_com_port = /dev/tty.usb[env:esp32doit-devkit-v1]
; Use either the ‘upload_port’ line above if the ESP32 is connected to your PC’s USB port or enable/configure the three lines below to use OTA updates.
; The IP address should match that of the controller on your network.
; The <otaPassword> should match the current password from the network_config.json you previously uploaded to the controller.
;upload_protocol = espota
;upload_port = 192.168.x.y
;upload_flags = –auth=<ota password>**the data_dir has “/” in front of $PROJECT_DIR/data/MTC4BT1 because I use a macbook**
serial log:
[0008] [1] [INFO] Setup: Initializing BLE…
[0009] [1] [INFO] Setup: MattzoTrainController for BLE running.
[0010] [1] [INFO] Setup: Number of locos to discover hubs for: 1
[0011] [1] [INFO] Setup: Number of remotes to discover hubs for: 0January 14, 2025 at 09:50 in reply to: First configuration of MTC4BT – how connect to the Lego hub? #8072Mitja Cernich
ParticipantHi Mattzo, I’m attaching the configurations you requested. Thank you so much.
controller_config.json:{
“name”: “MTC4BT”,
“espPins”: [],
“locos”: [],
“locoConfigs”: [
“/loco_simple.json”
]
}loco_simple.json:
{
“locos”: [
{
“address”: 1,
“name”: “60197”,
“bleHubs”: [
{
“type”: “PU”,
“address”: “90:84:2b:cf:81:47”,
“channels”: [
{
“channel”: “A”,
“attachedDevice”: “motor”
},
{
“channel”: “B”,
“attachedDevice”: “motor”,
“direction”: “reverse”
}
]
}
]
}
]
}platformio.ini:
; PlatformIO Project Configuration File
;
; Build options: build flags, source filter
; Upload options: custom upload port, speed and extra flags
; Library options: dependencies, extra library storages
; Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html[platformio]
extra_configs = my_platformio.ini[common]
platform = espressif32
framework = arduino
board_build.filesystem = spiffs
lib_deps =
knolleary/PubSubClient@^2.8
h2zero/NimBLE-Arduino@^1.4.3
bblanchon/ArduinoJson@^7.3.0
arcao/Syslog@^2.0.0
arduino-libraries/Ethernet@^2.0.2
build_flags =
-DCONFIG_BT_NIMBLE_MAX_CONNECTIONS=9
-DARDUINOJSON_ENABLE_COMMENTS=1
-Iinclude
monitor_speed = 115200[env]
platform = ${common.platform}
board_build.filesystem = ${common.board_build.filesystem}
framework = ${common.framework}
lib_deps = ${common.lib_deps}
monitor_speed = ${common.monitor_speed}
upload_port = ${common.upload_com_port}
build_flags = ${common.additional_build_flags} ${common.build_flags}[env:esp32doit-devkit-v1]
board = esp32doit-devkit-v1 -
This reply was modified 8 months, 2 weeks ago by
-
AuthorPosts