Page 1 of 1

serialsend does no write to serial pins

Posted: 13 Sep 2021, 10:46
by Soulman
Hello all,
I am very confused now.
Using 80210802 version.

What is the intention of serialsend ? Just a write to the tcp port ?

What I want is write the time via serial line to an Arduino.
I 've done everything written on the internet: setup a serial device and in the tools section : serial on ( not sure that is necessary )
When I connect with putty on the tcp port , data is coming through on the usb port ( monitoring with arduino ide ) AND on the serial pins to Arduino ( nice ! )

But when giving the command serialsend nothing appears on the arduino. Then I give a longer string and some garbage comes in ( just 2 bytes or so )

Looks like serialsend only writes to tcp port, or to serial pins with wrong baud rate ??

Greetings,
Gert

Re: serialwrite does no write to serial pins

Posted: 13 Sep 2021, 10:51
by TD-er
I searched through the source code but I cannot find the "serialwrite" command.
Where did you find this suggestion?

Re: serialsend does no write to serial pins

Posted: 13 Sep 2021, 10:56
by Soulman
Sorry , abuse must be serialsend

Re: serialsend does no write to serial pins

Posted: 13 Sep 2021, 11:10
by TD-er
"serialsend" is a command belonging to the "Ser2Net" plugin.
It does allow to send data from the TCP port to the serial port.

Code: Select all

    case PLUGIN_WRITE:
    {
      String command  = parseString(string, 1);
      P020_Task *task = static_cast<P020_Task *>(getPluginTaskData(event->TaskIndex));

      if (nullptr == task) {
        break;
      }

      if (command == F("serialsend")) {
        task->ser2netSerial->write(string.substring(11).c_str());
        task->ser2netSerial->flush();
        success = true;
      }

      if ((command == F("ser2netclientsend")) && (task->hasClientConnected())) {
        task->ser2netClient.print(string.substring(18));
        task->ser2netClient.flush();
        success = true;
      }
      break;
    }
There is however a rather "strange" part in this code, as it does send whatever is put in the command string starting at position 11 and further. ("serialsend," is 11 chars)
But strictly speaking sending "serialsend ,...." (thus space and a comma) is valid too and what if you try to wrap the command argument in quotes, then those are sent too.

A task with the Ser2Net plugin assigned to it must be present and enabled, to send something to the serial port.
You don't need to have it connected to another host.

Currently the only way to send something to the serial port, without using the Ser2Net plugin, is sending via the "logitem" command. But this will add some clutter like the uptime in msec, whether it is an "info" logentry, etc. (along with all other log items)

Re: serialsend does no write to serial pins

Posted: 13 Sep 2021, 11:38
by Soulman
A task with the Ser2Net plugin assigned to it must be present and enabled, to send something to the serial port.
So you say "it can"
Currently the only way to send something to the serial port....
"It can't "

I'll try later with "logitem"

Re: serialsend does no write to serial pins

Posted: 13 Sep 2021, 12:40
by Ath
Soulman wrote: 13 Sep 2021, 11:38 "It can't "
Please read the original sentence again, you missed the "without using the Ser2Net plugin" part. So it can, as that plugin is included in the normal and test builds (and some hardware specific ones too)

Re: serialsend does no write to serial pins

Posted: 13 Sep 2021, 12:53
by TD-er
Sorry, my posts are almost always a memory-dump and I often have to go through them several times to make them more readable for others that don't fork their thoughts into another thread on every other word, like I do :)

But like Ath already suggested, it can be done with the Ser2Net plugin active and enabled.
If you don't want to use that one, or can't use it (e.g. due to all task slots already used), you can still send out logs.


TL;DR
In order to use that command, you have to have the Ser2Net plugin assigned to a task and have it enabled.

Re: serialsend does no write to serial pins

Posted: 13 Sep 2021, 13:30
by Soulman
Hmmmm,
setup a serial device
bij writing that in the 1st post I meant the Ser2Net plugin assigned to a task and have it enabled.

So I have plugin assigned !

Then start putty and send some data -> Succes data comes in in Arduino ( So baudrate , wiring tx/rx pins all are okay )

Send some data with serialsend -> Bad Luck No data !!!

Re: serialsend does no write to serial pins

Posted: 14 Nov 2021, 22:57
by je1981
Soulman wrote: 13 Sep 2021, 13:30 Hmmmm,
setup a serial device
bij writing that in the 1st post I meant the Ser2Net plugin assigned to a task and have it enabled.

So I have plugin assigned !

Then start putty and send some data -> Succes data comes in in Arduino ( So baudrate , wiring tx/rx pins all are okay )

Send some data with serialsend -> Bad Luck No data !!!
I have the same issue, the command serialsend doesn't work, no data in the TX pin, I tryed both configuration on the Communication - Serial Server with HW Serial0 and SoftwareSerial and got nothing.

The hardware it's ok because when I use the command ser2netclientsend it's work fine. Only whith this way I can send data to TX pins.