Bohbe wrote: ↑05 May 2019, 19:26
enesbcs wrote: ↑04 May 2019, 16:38
Debug:
- Enable serial port usage, but disable serial logging, also disable all plugin (P165) and device that using serial pins.
- Setup "Communication - Serial Server" plugin for debugging (port 23, baud 9600, 8n1)
https://www.letscontrolit.com/wiki/index.php/Ser2Net
- install Realterm to your PC, setup for displaying in hexadecimal in Display menu, in Capture write the ESP device IP address and port (23) and set the serial settings that matches with the ESP Ser2Net plugin
As i remember, you can premade a binary file with the necesarry command bytes, and you can send it with Realterm to the Ser2Net for testing purposes.
Thanks! I have tried to do what you described and ran into two problems:
1. I get 9600 baud rate on the serial port to the MCU and can't find a way to get it to work with 115200, which is the baud rate I communicate with
2. It sends 12 bytes, even though the file is 11 bytes. And the strange thing is that the second byte is the one inserted with "0x00".
![Verward :?](./images/smilies/icon_e_confused.gif)
Thank god for a good logic analyzer!
I also realized that serial logging was on originally and thought for a while that that would have interfered with the messaging, but nooo.
I will work on this more later on, try to figure out what happens. I'm in parallel installing Platformio but haven't a clue right now how to merge in P165 into the rest of the code...
I've just gone through that painstaking exercise of setting up PlatformIO and incorporating the plugin. I have worked it out.
basically there are a couple of things you need to do.
1. Add #ifdef USES_P165 to the first line and #endif // USES_P165 the very last line of the plugin. (This should be done to the plugin itself in github but can only be done once the plugin becomes a core plugin).
2. set up custom set of plugins in the define_plugin_sets.h e.g.:
#ifdef PLUGIN_SET_ONLY_TUYA
#ifndef PLUGIN_SET_NONE
#define PLUGIN_SET_NONE
#endif
#ifndef USES_P001
#define USES_P001 // switch input - Switch
#endif
#ifndef USES_P002
#define USES_P002 // Analogue input - internal
#endif
#ifndef USES_P003
#define USES_P003 // Pulse Counter
#endif
#ifndef USES_P020
#define USES_P020 // Communication - Serial Server
#endif
#ifndef USES_P021
#define USES_P021 // Regulator - Level Control
#endif
#ifndef USES_P026
#define USES_P026 // SysInfo
#endif
#ifndef USES_P029
#define USES_P029 // Output - Domoticz MQTT Helper
#endif
#ifndef USES_P033
#define USES_P033 // Dummy Device
#endif
#ifndef USES_P043
#define USES_P043 // Output - Clock
#endif
#ifndef USES_P165
#define USES_P165 // Serial MCU controlled Switch
#endif
#endif
3. define an environment in platformio.ini that calls the set of plugins. e.g.:
; Easy Tuya (1M) device ----------------------
[env:easy_TUYA_1M]
upload_speed = ${common.upload_speed}
monitor_speed = ${common.monitor_speed}
framework = ${common.framework}
platform = ${common.platform}
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
lib_ldf_mode = ${common.lib_ldf_mode}
lib_archive = ${common.lib_archive}
board_upload.maximum_size = ${esp8266_1M.board_upload.maximum_size}
board_build.flash_mode = ${esp8266_1M.board_build.flash_mode}
board = esp01_1m
build_flags = ${esp8266_1M.build_flags} -D PLUGIN_SET_ONLY_TUYA
4. call that environment at the start of platformio.ini:
[platformio]
;env_default = esp32dev
;env_default = dev_ESP8266_4096
env_default = easy_TUYA_1M
;env_default = normal_ESP8266_4096
; ..etc
5. (oh and obviously!
![Lach :)](./images/smilies/icon_e_smile.gif)
) copy the plugin to the src/ directory
..and that's it.