(esp8266wabserver.h )server.handleClient() offline random timing

I still can't get it to work :confused: If i got it right i have to let the networking do things by calling 'delay(0)' or 'yield()'. But the network still goes offline almost imideatly. Here is my loop method.

void loop ( void ) {
   server.handleClient();

 if(millis() - previousMillis >= 5000) 
   { 
      WiFirssi();
      rtctime();                
    previousMillis=millis();
   }
 delay(1);     
}
void rtctime()
{
    DateTime now = rtc.now();//rtc program
    hourvalue=now.hour();
    minvalue=now.minute();
//    dayValue=now.day();
//    monthValue=now.month();
//    yearValue=now.year();
    tft.setCursor(255, 5);
    tft.setTextColor(ILI9341_WHITE,ILI9341_BLACK); tft.setTextSize(2);
    if(now.hour()<10)
    tft.print('0');
    tft.print(hourvalue);
    tft.print(':');
    if(now.minute()<10)
    tft.print('0');
    tft.print(minvalue);
}
void WiFirssi()
{
//   Serial.println(WiFi.RSSI());
  if(WiFi.RSSI()<0 && WiFi.RSSI()>-50)
  {
  tft.fillRect(25,10,3,15,ILI9341_WHITE);
  tft.fillRect(20,17, 3, 8,ILI9341_WHITE);
  tft.fillRect(15,21, 3, 4,ILI9341_WHITE);
  tft.fillRect(10,23, 3, 2,ILI9341_WHITE);    
  }
  else if(WiFi.RSSI()<-50 && WiFi.RSSI()>-70)
  {
  tft.fillRect(25,10,3,15,ILI9341_BLACK);
  tft.fillRect(20,17, 3, 8,ILI9341_WHITE);
  tft.fillRect(15,21, 3, 4,ILI9341_WHITE);
  tft.fillRect(10,23, 3, 2,ILI9341_WHITE);    
  }
  else if(WiFi.RSSI()<-70 && WiFi.RSSI()>-90)
  {
  tft.fillRect(25,10,3,15,ILI9341_BLACK);
  tft.fillRect(20,17, 3, 8,ILI9341_BLACK);
  tft.fillRect(15,21, 3, 4,ILI9341_WHITE);
  tft.fillRect(10,23, 3, 2,ILI9341_WHITE);    
  } 
  else if(WiFi.RSSI()<-90 && WiFi.RSSI()>-110)
  {
  tft.fillRect(25,10,3,15,ILI9341_BLACK);
  tft.fillRect(20,17, 3, 8,ILI9341_BLACK);
  tft.fillRect(15,21, 3, 4,ILI9341_BLACK);
  tft.fillRect(10,23, 3, 2,ILI9341_WHITE);    
  }
  else
  {
  tft.fillRect(25,10,3,15,ILI9341_BLACK);
  tft.fillRect(20,17, 3, 8,ILI9341_BLACK);
  tft.fillRect(15,21, 3, 4,ILI9341_BLACK);
  tft.fillRect(10,23, 3, 2,ILI9341_BLACK);    
  }
}

Note: it still works perfectly if i don't have any code after the handleClient call.
if iam reset esp8266 client or esp8266 server it`s working....

I would like to see the whole thing, setup(), the variable declarations and everything.

well that only gives the processor time to executed 'scheduled tasks' but i don't think that is the issue here.

well determine which of the 2 functions you call is causing the issue (my bet is on WiFirssi() )
As far as i can tell you are not using the function WiFi.RSSI() correctly.
Have another look at the 'WiFiscan' example.
You scan all networks, and then retrieve their signal strength and then you can print that. (or utilize those values otherwise)

Thanks for Quick reply!
my full code for server side....
21012022_RECEIVER.ino (5.7 KB)

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.