Discuss here different C compiler set ups, and compiling executables for the ESP8266

User avatar
By ulko
#7805
Alex_S wrote:Did you update the files mapping in the user_main.c?

yes, i did. her some debugs:
1. loading led.tpl (this is OK)
Code: Select allCon req, conn=0x3fff5018, pool slot 0
URL = /led.tpl
Is url index 2
Heatshrink compressed file; decode parms = b4
Conn 0x3fff5018 is done. Closing.
Con req, conn=0x3fff4eb8, pool slot 0
URL = /style.css
Is url index 12
Heatshrink compressed file; decode parms = b4
Conn 0x3fff4eb8 is done. Closing.
Con req, conn=0x3fff4eb8, pool slot 0

2. loading dht22.tpl (website only shows22.20 and no style.css loaded)
Code: Select allCon req, conn=0x3fff4eb8, pool slot 0
URL = /dht22.tpl
Is url index 3
Heatshrink compressed file; decode parms = b4
Temp =  2220 *C, Hum = 3160 %
Conn 0x3fff4eb8 is done. Closing.

May be url index is wrong?? What is url index??
Is order of mapping in user_main.c relevant??
User avatar
By Alex_S
#7814 OK, I found the issue reason. It is not connected to the file system.
The "espconn_sent" method is used to send the sensor data in the method "tplDHT" of chi.c.
As was described in comments for the devkit, the handling of espconn_sent is changed version 9.4. So httpdSend method shall be used instead.
Because of this the data of html page were replaced by the data of humidity sensor, so you saw wrong page.

This works correctly:
Code: Select all//Template code for the DHT 22 page.
void ICACHE_FLASH_ATTR tplDHT(HttpdConnData *connData, char *token, void **arg) {
   char buff[128];
   if (token==NULL) return;

   float * r = readDHT();
   float lastTemp=r[0];
   float lastHum=r[1];

   os_strcpy(buff, "Unknown");
   if (os_strcmp(token, "temperature")==0) {
         os_sprintf(buff, "%d.%d", (int)(lastTemp),(int)((lastTemp - (int)lastTemp)*100) );
   }
   if (os_strcmp(token, "humidity")==0) {
         os_sprintf(buff, "%d.%d", (int)(lastHum),(int)((lastHum - (int)lastHum)*100) );
   }

   httpdSend(connData, buff, -1);
}
User avatar
By ulko
#7841
The "espconn_sent" method is used to send the sensor data in the method "tplDHT" of cgi.c.
As was described in comments for the devkit, the handling of espconn_sent is changed version 9.4. So httpdSend method shall be used instead.

It's OK now. Thanks a lot Alex_S!!