These are chat archives for SmingHub/Sming

8th
Sep 2016
zhivko
@zhivko
Sep 08 2016 05:49
@hreintke i have a HttpServer_WebSockets ppp that hangs esp. How can i troubleshoot?
In console output everything seems fine.
No exception is thrown.
It hangs at moment when web browser connects to it.
zhivko
@zhivko
Sep 08 2016 06:39
@petrynchyn yes but that it: SDK: v1.4.0(c599790) as outputed from ShowInfo() od SmingRTOS and not 1.4.2 as you mentioned? Can you recheck/confirm?
zhivko
@zhivko
Sep 08 2016 06:42
AH! OK!
so its patch applied to github SmingRTOS...
Alexander V. Ribchansky
@avr39-ripe
Sep 08 2016 07:03

@hreintke just try this for websocket send stability and performance issue:

diff --git a/Sming/SmingCore/Network/WebSocket.cpp b/Sming/SmingCore/Network/WebSocket.cpp
index bfdd0fc..3e743ca 100644
--- a/Sming/SmingCore/Network/WebSocket.cpp
+++ b/Sming/SmingCore/Network/WebSocket.cpp
@@ -51,7 +51,7 @@ void WebSocket::send(const char* message, int length, wsFrameType type)
        wsMakeFrame(nullptr, length, frameHeader, &headSize, type);
        connection->write((char*)frameHeader, headSize, TCP_WRITE_FLAG_COPY | TCP_WRITE_FLAG_MORE);
        connection->write(message, length, TCP_WRITE_FLAG_COPY);
-       connection->flush();
+//     connection->flush();
 }

 void WebSocket::sendString(const String& message)

It ADDS some minor additionally delay in comparison with orig version, but overall performance and STABILITY improves :)
test case was sending in for-loop 10..15 websocket binary messages 5..10 bytes long to 1..3 clients. with this fix it works as a charm, without - esp almost hangs for a while, not all clients gets all messages and so on :(

zhivko
@zhivko
Sep 08 2016 09:29
@hreintke: I think I am onto something - in Station.cpp:
void StationClass::internalCheckConnection()
{
    uint32 duration = millis() - connectionStarted;
    if (isConnected())
    {
        ConnectionDelegate callOk = nullptr;
        if (onConnectOk) {
            //if next line is missing onConnectOk is never called
            onConnectOk();
            callOk = onConnectOk;
        }

        onConnectOk = nullptr;
        onConnectFail = nullptr;
        delete connectionTimer;
        connectionTimeOut = 0;

        if (callOk) {
            callOk();
        }
    }
    else if (connectionTimeOut > 0 && duration > (uint32)connectionTimeOut * 1000)
    {
        ConnectionDelegate call = onConnectFail;
        onConnectOk = nullptr;
        onConnectFail = nullptr;
        delete connectionTimer;
        connectionTimeOut = 0;

        if (call)
            call();
    }
}
@hreintke: check my comment: "//if next line is missing onConnectOk is never called"

@hreintke: I had problem in:

WifiStation.waitConnection(connectOk,25,connectNotOk);

connectOk was never called...

zhivko
@zhivko
Sep 08 2016 12:42

Has somebody taken care of this in Sming:
esp8266/Arduino#2304
Quote from Igrrr:
"
Bigger issue which you are going to face is that now we need to reserve an extra sector for RF calibration data somewhere (see documentation for user_rf_cal_sector_set). This means that linker scripts need to be changed to reserve another sector at the end of the application, before the beginning of SPIFFS. This will lead to some changes to OTA update code, because right now it assumes that the end of the application region is the beginning of SPIFFS, which will be no longer true. So, extra symbol has to be added to linker script to point to the real end of the application region.

If you are just hacking this and not interested in using EEPROM, for example, you could add a call to user_rf_cal_sector_set and point it to the sector used by EEPROM.
"

hreintke
@hreintke
Sep 08 2016 12:49
@zhivko :
This is why I not upgraded support to newer RTOS SDK versions yet.
zhivko
@zhivko
Sep 08 2016 12:52
so this means system_restart is not working because of this ?
right now websocketss are working, only restart after ota is not working for me.
zhivko
@zhivko
Sep 08 2016 13:07
AHHH
found th issue!
that was a problem...
ota is not correctly reseting just after serial flash!
SkySparky
@SkySparky
Sep 08 2016 13:24
Hello!
How using sleep mode (modem or light sleep) in Sming NONOS SDK and RTOS SDK?
SkySparky
@SkySparky
Sep 08 2016 13:30
Needed sleep mode without breaking connection with AP. This modes are work in Arduino SDK.
zhivko
@zhivko
Sep 08 2016 13:44
I also needed to raise timeout on server - now it is working OK.
crosofg
@crosofg
Sep 08 2016 14:41
how to attach a response sent callback for basic server in Sming?
tiltism
@tiltism
Sep 08 2016 17:06
so, anyone have any experience including user_interface.h from the ESP SDK in a Sming application.app source?
I can't seem to figure out how to include and call functions from the base SDK... such as wifi_station_clear_cert_key() which isn't included in Sming