esplocalizer icon indicating copy to clipboard operation
esplocalizer copied to clipboard

Fast Acc CSV Stream is empty file

Open fmaurer opened this issue 8 years ago • 0 comments

I'm having trouble reading the accel and gyro data from a websocket. The default /firmware-c web interface gives a link to the CSV file, but I'm getting 0 bytes or "unable to connect" errors at /d/fastacc.csv

I'm able to create websockets to these endpoints I found in the source: /d/ws/echo /d/ws/evaltest /d/ws/issue

My hunch is I'd have to create a new endpoint: /d/ws/fastacc which the ESP sends websocket packets to connected devices through.

The web interface and fastacc() in /firmware-c/user/user_main.c looks like the device should already be sending this data, I'm not sure the endpoint to connect to or if this is a problem with my setup.

When I click on the Fast Acc CSV link in web interface, this function should write to socket. 'Save link as' doesn't make a difference:

static ICACHE_FLASH_ATTR void fastacc()
{
	//char mydat[128];
	//int len = URLDecode( mydat, 128, curhttp->pathbuffer+8 );

	char buf[1024];
	int times = 20;
	int len = 0;
	int16_t data[10];

	if( first_acc == 1 )
	{
		first_acc = 0;
		len += ets_sprintf( buf+len, "gx, gy, gz, ax, ay, az\r\n" );
	}

	for( ; times > 0 && lsmhead != lsmtail; times -- )
	{
		int16_t * data = &lsmdata[6*lsmtail];
		lsmtail = (lsmtail+1)%LSMBUFFERSIZE;
		
		len += ets_sprintf( buf+len, "%d, %d, %d, %d, %d, %d\r\n", data[0], data[1], data[2], data[3], data[4], data[5] );
	}

	if( len )
	{
		START_PACK;
		PushBlob( buf, len );
		END_TCP_WRITE( curhttp->socket );
	}

	if( i2cmode == 0 )
	{
		curhttp->state = HTTP_WAIT_CLOSE;
	}

}

fmaurer avatar Jan 23 '17 00:01 fmaurer