Description
Please fill the info fields, it helps to get you faster support ;)
if you have a stack dump decode it:
https://github.com/esp8266/Arduino/blob/master/doc/Troubleshooting/stack_dump.md
for better debug messages:
https://github.com/esp8266/Arduino/blob/master/doc/Troubleshooting/debugging.md
----------------------------- Remove above -----------------------------
Basic Infos
Hardware
Hardware: ESP-12s
Core Version: 2.3.0
Description
I have made a server using the server.handleClient(); and that stuff, but now I 've implemented the universal telegram bot library, which keeps crashing or freezing the esp. At first, the webserver works finely, but when you execute a function from the library and you send a message through the bot, the webserver stops working, and after having the bot answering commands for a short random time, it crashes. It sometimes gives me different stacks.
I personaly think the problem may have to be with teh client breaking the server, and the esp without knowing what to do when receive a request, and that is what makes it to break
`
3fff2f50: 3fff22fc 00000534 00000534 402295cb
3fff2f60: 00000208 3fff4e2c 3fff4c44 40229764
3fff2f70: 00000104 00002790 000004f2 3fff4e2c
3fff2f80: 00000040 00000082 3fff9b74 40229a16
3fff2f90: 00800000 00000080 00000000 00000041
3fff2fa0: 00000040 0000003f 4020b6a0 00000041
3fff2fb0: 3fff60bc 3fff4e2c 3fff44c4 3fff70e4
3fff2fc0: 3fff65d0 ffffffff 3fff4e2c 3fff4e2c
3fff2fd0: 00000040 3fff4e2c 3fff9b74 3fff4e2c
3fff2fe0: 00000040 3fff4e2c 3fff9b74 4022a572
3fff2ff0: 3fff54ac 0000003f caed0aa8 00000001
3fff3000: 3fff4e2c 3fff9b5c 3fff9b74 00000001
3fff3010: 00000010 3fff4e2c 0000000f 4022a7cd
3fff3020: 3fff44c4 3fff4fcc 0000000f 00000001
3fff3030: 00000001 3fffa054 3fffa4e1 40229630
3fff3040: 00000100 3fff547c 3fffa4df 00000000
3fff3050: 00000100 3fff547c 3fffa4df 4022b859
3fff3060: 3fff3090 00000000 000000d0 00000030
3fff3070: 9888cf1c 9225d911 6acfa58b 00000004
3fff3080: 00000004 3fff8ae4 3fffa4d9 40227964
3fff3090: a5d70203 1abb0e96 214ad1dc 66815643
3fff30a0: 77b614de 91ad80cd c2162c9d 25b2602f
3fff30b0: 60ffa040 8052d18a e84ac83b cf1cc776
3fff30c0: 00000004 3fffa4d9 3fff8ae4 40227d65
3fff30d0: 74189ebf 4b3693ed bb2b5f8c 3fff6b5c
3fff30e0: 00000000 00000004 00000004 40203dff
3fff30f0: 3fffa4dd 3fffa4d9 3fff9ce4 00001200
3fff3100: 000012a0 3fffb744 00000034 00000004
3fff3110: 3fff8ae4 3fffa4d9 00000004 00000004
3fff3120: 00000004 3fffa4d9 3fff8ae4 4022775c
3fff3130: 00000000 3fffa4d9 3fff8ae4 40227b04
3fff3140: 00000010 3ffea458 00000011 401004d8
3fff3150: 3fff31a0 0000000e 00000010 00000000
3fff3160: 3fff8594 3ffea458 3fff8ae4 01000000
3fff3170: 3fff31a0 3fff17f0 3fff8ae4 402278b4
3fff3180: 3ffea458 00000000 3fff4464 00001387
3fff3190: 0000bcd1 3fff17f0 3fff4464 40204271
3fff31a0: 000001bb 3fff9c14 3fff17f0 402036d6
3fff31b0: c7a79a95 00000015 3fff3208 3fff3260
3fff31c0: 000001bb 3fff17f0 3ffea458 40204481
3fff31d0: 3ffeab40 c7a79a95 3ffeab40 c7a79a95
3fff31e0: 3fff326c 3fff6fe0 3fff177c 40209929
3fff31f0: 40100296 00000023 3fff6a70 3fff32fc
3fff3200: 00000040 3fff3260 3fff6ad4 0000000f
3fff3210: 00000000 0000003c 3fff3260 4020af13
3fff3220: 3fff22fc 000005a6 3fff3260 4020af45
3fff3230: 0000db76 3fff6fe0 3fff3260 4020b04c
3fff3240: 3ffea740 3fff6fe0 3fff177c 3fff32fc
3fff3250: 0000db76 3fff6fe0 3fff177c 40209b6c
3fff3260: 3fff6a74 0000003f 0000003c 3fff6abc
3fff3270: 0000000f 00000000 3fff6b14 0000003f
3fff3280: 0000003c 3fff6fe0 00000000 40208b54
3fff3290: 00000010 3fff32f0 3fff32f0 3fff32fc
3fff32a0: 3fff177c 3fff32f0 3fff6fe0 40209c3d
3fff32b0: 3ffea9a0 3fff3310 3fff6fd4 00000200
3fff32c0: 3fff3308 00000001 3fff32f0 4020af96
3fff32d0: 3ffeb520 000005a6 000005a6 402051ec
3fff32e0: 00000001 00000001 3fff48d4 4020227a
3fff32f0: 3fff4494 0000000f 00000000 3fff8abc
3fff3300: 0000001f 00000010 3fff89ec 0000000f
3fff3310: 00000009 00000995 00000995 4010020c
3fff3320: 00000001 00000001 3fff3350 4020b8be
3fff3330: 00000000 00000000 3fff48d4 402051e2
3fff3340: 3fff48d4 3fff184c 3fff48d4 4020521e
3fff3350: 00000000 00000000 00000000 4020b074
3fff3360: 3fff48d4 3fff184c 3fff180c 402052b1
3fff3370: 3fffa3c4 0000000f 00000006 402039bc
3fff3380: 3fff184c 00000000 3fff180c 00000001
3fff3390: 00000001 402047f4 00000019 00000000
3fff33a0: 00000000 00000000 3fff180c 3fff23e0
3fff33b0: 00000001 3fff1830 3fff180c 402054eb
3fff33c0: 3ffe9f20 00000000 000003e8 40208405
3fff33d0: 00000000 3fff6aec 40207cf0 3fff23e0
3fff33e0: 3fffdad0 00000000 3fff23d8 4020294e
3fff33f0: 3fffdad0 00000000 3fff23d8 4020b6ec
3fff3400: feefeffe feefeffe 3fff23f0 40100718
`
Settings in IDE
Module: Adafruit huzzah esp8266
Flash Size: 4MB(3M SPIFFS)
CPU Frequency: 80Mhz
Flash Mode: doesnt appear
Flash Frequency: 80Mhz
Upload Using: SERIAL
Reset Method: idk
this code is a simplified version of the original, (which crashes less, but still does)
#include <ESP8266WebServer.h>
#include <WiFiClient.h>
#include <ESP8266mDNS.h>
#include <WiFiUdp.h>
#include <ArduinoOTA.h>
#include <UniversalTelegramBot.h>
//CONFIG
#define SERIAL_DEBUGGING true
char ssid[] = "wifiName";
char password[] = "wifiPassword";
//IP
IPAddress ip(10, 11, 12, 106); //89
IPAddress puerta_de_enlace(10, 11, 12, 68);
IPAddress subred(255, 255, 255, 0);
ESP8266WebServer server(80);
//TELEGRAM
#define BOTtoken "000000000:AAAAAAAAAAAAAAAAAAAAAAAAAAAA" //token of TestBOT
#define BOTname "botName"
#define BOTusername "botUsername"
WiFiClientSecure client;
UniversalTelegramBot bot(BOTtoken, client);
int Bot_mtbs = 1000; //frecuencia checkeo mensajes
long Bot_lasttime; //tiempo ult. comprobacion
long work_time = 0;
String text;
String chat_id;
String from_id;
String from_name;
String date;
void setup() {
Serial.begin(115200);
delay(10);
Serial.printf("\n");
delay(10);
WiFi.persistent( false );
WiFi.begin(ssid, password);
WiFi.config(ip, puerta_de_enlace, subred);
while (WiFi.status() != WL_CONNECTED)
{
delay(250);
#if SERIAL_DEBUGGING == true
Serial.printf(".");
#endif
}
WiFi.setAutoReconnect(true);
#if SERIAL_DEBUGGING == true
Serial.printf("\n");
Serial.printf("Wifi = <");
Serial.printf(ssid);
Serial.printf(">\n");
Serial.printf("IP = <");
Serial.print(WiFi.localIP());
Serial.printf(">");
#endif
ESP.wdtEnable(1000);
//ESTABLISHING ANSWERS
server.on("/", pagina_web_raiz);
server.onNotFound(noencontrado);
const char * headerkeys[] = {"User-Agent", "Cookie"} ;
size_t headerkeyssize = sizeof(headerkeys) / sizeof(char*);
//ask server to track these headers
server.collectHeaders(headerkeys, headerkeyssize );
server.begin();
}
void pagina_web_raiz() {
/*server.setContentLength(pagina_principal().length() + pagina_principal0().length());
server.send(200, "text/html", pagina_principal());
server.sendContent(pagina_principal0()); */
server.send(200, "text/html", webpage());
}
void noencontrado() {
String message = "ERROR 404, \n\n";
server.send(404, "text/plain", message);
}
void loop() {
server.handleClient();
check_bot();
}
void check_bot() {
if (millis() > Bot_lasttime + Bot_mtbs) {
int numNewMessages = bot.getUpdates(bot.last_message_received + 1);
while (numNewMessages) {
Serial.println("got response");
for (int i = 0; i < numNewMessages; i++) {
text = bot.messages[i].text;
chat_id = bot.messages[i].chat_id;
from_id = bot.messages[i].from_id;
from_name = bot.messages[i].from_name;
date = bot.messages[i].date;
Serial.println(text);
//bot.sendMessage(bot.messages[i].chat_id, bot.messages[i].text, ""); //for echo bot
work_time++;
Serial.println("chckbot");
handle_commands();
}
numNewMessages = bot.getUpdates(bot.last_message_received + 1);
}
Bot_lasttime = millis();
}
}
void handle_commands() {
if (text != "") {
Serial.println("handle_commands");
if (text == "/start") {
bot.sendMessage(chat_id, "Sif", "");
bot.sendMessage(chat_id, "/help", "");
} else if (text == "/help") {
bot.sendMessage(chat_id, "/help", "");
bot.sendMessage(chat_id, "/tfunc", "");
bot.sendMessage(chat_id, "/help", "");
bot.sendMessage(chat_id, "/tfunc", "");
bot.sendMessage(chat_id, "/help", "");
bot.sendMessage(chat_id, "/tfunc", "");
Serial.print(" help end");
} else if (text == "/tfunc") {
bot.sendMessage(chat_id, "time working = " + String(work_time) + "(in seconds)", "");
} else {
bot.sendMessage(chat_id, "X", "");//command not recognized
}
}
}