Page 1 of 1

Troubles with website, bluetooth and SPIFFS

Posted: Thu Aug 06, 2020 9:47 am
by oontuo
Hi
I'm using ESP Async WebServer to work with my website on esp32. Im including .gz fike as an array to my code like this:

Code: Select all

#include "web/index.html.gz.h"
then do this:

Code: Select all

		server.on( "/"           , HTTP_GET, [](AsyncWebServerRequest *request) {
			response(request, index_html_gz , index_html_gz_len , "text/html"); } );
			
where "response" is:

Code: Select all

	void response(AsyncWebServerRequest *request, const uint8_t *content,
				  int length, const char *contentType)
	{
		//	log.debugEx("  response file ").add(request->url()).end();
		touched();
		AsyncWebServerResponse *response = request->beginResponse_P(
			200, contentType, content, length);
		response->addHeader("Connection", "close");
		response->addHeader("Content-Encoding", "gzip");
		request->send(response);
		log.debugEx("  sent file ").add(request->url()).end();
	}
The problem is that when I link a big js file with Bluetooth turned on website doesn't work. More precisely, the browser receives .html and .css, and when it tries to receive .js, it just continues to load it with no result.
I tried to put the non-compressed .js file to SPIFFS, but i had the same result. The non-comressed .js file has a huge size (380kb), so maybe this is a problem?
Then I tryed to put comperresed .js file into SPIFFS - but it works weird. Spiffs.bin is ok (I checked it with mkspiffs before uploading and dumped it after uploading), but when I turn on esp and try to list filesystem its empty.
So I spent two weeks trying to fix at least one of this problems, but ...
Hardware esp32-wroom-32
Using platformio
framework = arduino
platform = espressif32
board = esp32dev