These are chat archives for SmingHub/Sming

1st
Sep 2016
zhivko
@zhivko
Sep 01 2016 01:55
Uart1 can only send I think. No receive.
So only tx no rx...
Today I connected esp8266 to wifi and i got wdt reset. Than to another wifi and no reset.
What can be so diferent in first wifi that it crashes esp8266? Has this happened to anybody else?
psychegr
@psychegr
Sep 01 2016 15:06
ok i have another one. I am using the server.commandProcessing(true,"command"); to enable the command handler for websockets. Everything works fine and i have also created my own "command set" which works as expected. My question is about the format of the "processCommands(String commandLine, CommandOutput commandOutput)".
I want to transfer binary data with some of the commands. How would i do that if the input is a string? My plan is to do something like "WW T 05 .............", where WW is the command, T is for Transmit, 05 is the data length and ........ should be the binary data. I know that one way is to convert the binary to HEX strings and transmit it but that would make the packet at least 2 times bigger and i want to transmit packets of 2048 bytes.
Also another one, how can i create a task (freertos) inside the processCommands() that sends data using the
commandOutput? I am puzzled from all that.
hreintke
@hreintke
Sep 01 2016 18:04
@piperpilot :
HardwareSerial Serial_uart1(1); will create the object to the uart1.
As @zhivko mentioned, uart1 is TX only due to the espressif design
hreintke
@hreintke
Sep 01 2016 18:31
@psychegr : Not sure what you try to achieve and need to check the details -> please clarify
In SmingRTOS there is also processCommands(Command command, CommandOutput commandOutput),
Need to check on Command & Websocket. Within Websocket whole message is in command, how a partly binary message will be handled.
On the freertos task : I do not understand at all what to mean.
psychegr
@psychegr
Sep 01 2016 22:09

@hreintke ok to be a little more clear. I am creating a class to handle the websocket commands. So in my class i am doing

commandHandler.registerCommand(CommandDelegate("test","test Commands","example test",commandFunctionDelegate(&myClass::processCommands,this)));

and the function is like this

void myClass::processCommands(String commandLine, CommandOutput* commandOutput)

i guess i could change it to something like

void myClass::processCommands(Command reqCommand, CommandOutput* commandOutput)

but what i would gain from that? Command works only with strings as far as i can see in the source codes. I want to transfer binary data just right after the command. Like WW T 05 ""binary data".
What i am doing now is to convert the binary to Base64 and transmit it like this WW T 05 Base64EncodedBinData.
Hope that this is more clear now.
On the freertos task. In the command handler i want to start a new task which takes a while and in fact it is a blocking function. I want this task to transmit to the websocket through the commandprocessing. Something like this

else if (commandToken[1] == "XX")
{
int xReturned = 1;
xReturned = xTaskCreate(readTask, (signed char *)"readtsk", 0x200, commandOutput, 2, NULL);
debugf("xTaskCreate returned : %d", xReturned);
}

......

void readTask(void* pvParameters)
{
commandOutput->printf("in task print");

vTaskDelete(NULL);
}

readTask is a long task which blocks until it finishes. So i need to run it in a separate task.
I dont know if i can explain this better.

Also is there a buffer limit for the messages in websockets that i should know about? Like maximum bytes that it can send or receive?

Thank you for all the help @hreintke