These are chat archives for esp8266/Arduino

2nd
Nov 2016
Clemens Kirchgatterer
@everslick
Nov 02 2016 12:16
you bet I have! :-D
ps, kill, df, top, ls, mv, cat, localtime, uptime and bunch more that are hardware related, like setting gpio's syncing clock to rts and ntp, saving config in eeprom a.s.o.
espade:~$ help
available commands are:
    init <m>     ... initialize module <m>
    fini <m>     ... finalize module <m>
    state [m]    ... query state of module [m]
    turbo [0|1]  ... switch cpu turbo mode on or off
    conf <k|k=v> ... get or set config key <k>
    save         ... save config to EEPROM
    format       ... create / filesystem
    ls           ... list filesystem content
    cat <f>      ... print content of file <f>
    rm <f>       ... remove file <f> from filesystem
    df           ... report file system disk space usage
    ntp          ... set system time from ntp server
    rtc          ... set system time from RTC
    date [d]     ... get/set time [YYYY/MM/DD HH:MM:SS]
    systohc      ... set RTC from system time
    uptime       ... get system uptime
    localtime    ... get local time
    toggle <p>   ... toggle GPIO pin <p>
    high <p>     ... set GPIO pin <p> high
    low <p>      ... set GPIO pin <p> low
    blink <l>    ... let led <l> blink
    on <l>       ... switch led <l> on
    off <l>      ... switch led <l> off
    ping <h>     ... send 3 ICMP ping requests to host <h>
    scan         ... scan WiFi for available accesspoints
    ps           ... list all currently running tasks
    top          ... show runtime system usage statistics
    c64          ... 'hello, world!' demo
    clear        ... clear screen
    reboot       ... reboot device
    reset        ... perform factory reset
    help         ... print this info
Clemens Kirchgatterer
@everslick
Nov 02 2016 13:26
maybe i should lift vi from busybox! ;-P
André Pedro
@anmaped
Nov 02 2016 18:30
@everslick Do you have published it ?
Michael Miller
@Makuna
Nov 02 2016 21:28
I get yet again getting strange client problems. WiFi.status() after a 10 seconds or so of being connected returns disconnected. Inside this method, the call to wifi_station_get_connect_status() is returning STATION_CONNECTING which gets mapped to disconnected. This was not happening days ago. A very simple client sketch of connecting to a very simple server sketch (both on ESP).
Michael Miller
@Makuna
Nov 02 2016 21:39

server loop code

loop() {
       WiFiClient newClient = _server.available();
        if (newClient)
        {
            Serial.println("client connected");
            _client.stop();
            _client = newClient;
        }
}

client code

    void ConnectClient()
    {
        IPAddress ipGateway = WiFi.gatewayIP();
        Serial.println("Gateway IP address:");
        Serial.println(ipGateway);

        for (int attempts = 0; attempts < 3; ++attempts)
        {
            if (_client.connect(ipGateway, 777))
            {
                break;
            }

            Serial.print(".");
            delay(1000);
        }

        if (_client)
        {
            Serial.println("Client connected");

            Serial.println("Remote IP address:");
            Serial.println(_client.remoteIP());
            Serial.println();
            WiFi.printDiag(Serial);
        }
        else
        {
            Serial.println("RESETTING");
            Serial.flush();

            ESP.reset();
            delay(1000);
        }
    }
loop() {
if (WiFi.isConnected())
        {
            if (!_client)
            {
                Serial.println("WiFi lost connection");
                ConnectClient();
            }
        }
        else
        {
            delay(500);
            Serial.print(" .");
            Serial.print(WiFi.status());
        }
}
Michael Miller
@Makuna
Nov 02 2016 21:48
but if change the client to send the server a packet of data every second, it stays connected. Is there a property on the server / client that can disable this disconnect on lack of data being sent in 10 seconds?
Michael Miller
@Makuna
Nov 02 2016 22:23
The timeout is just over 8 seconds. If I send something every 8 seconds it keeps the client alive, slightly over 8 seconds, the client is stopped.
Michael Miller
@Makuna
Nov 02 2016 22:45
more testing shows that even sending a heart beat every 3 seconds does not stop the disconnects, it only reduces the occurrences. A two second heartbeat seems to be required (10 minutes testing so far).