Commit to be compliant with ESP's SDK 1.5.1. Also, add binary blobs.

This commit is contained in:
cnlohr 2016-01-28 20:38:48 -05:00
parent 997ad27cc2
commit ae55f193cf
10 changed files with 64 additions and 49 deletions

View file

@ -92,7 +92,7 @@ int ICACHE_FLASH_ATTR issue_command(char * buffer, int retsize, char *pusrdata,
{
case 'e': case 'E': //(FE#\n) <- # = sector.
{
if( nr < 128 )
if( nr < 16 )
{
buffend += ets_sprintf(buffend, "!FE%d\r\n", nr );
break;
@ -108,7 +108,7 @@ int ICACHE_FLASH_ATTR issue_command(char * buffer, int retsize, char *pusrdata,
case 'b': case 'B': //(FB#\n) <- # = block.
{
if( nr < 8 )
if( nr < 1 ) //Not allowed to erase boot sector.
{
buffend += ets_sprintf(buffend, "!FB%d\r\n", nr );
break;
@ -133,7 +133,7 @@ int ICACHE_FLASH_ATTR issue_command(char * buffer, int retsize, char *pusrdata,
{
colon++;
const char * colon2 = (const char *) ets_strstr( (char*)colon, "\t" );
if( colon2 && nr >= 524288)
if( colon2 && nr >= 65536)
{
colon2++;
int datlen = (int)len - (colon2 - pusrdata);
@ -510,7 +510,13 @@ void ICACHE_FLASH_ATTR issue_command_udp(void *arg, char *pusrdata, unsigned sho
int r = issue_command( retbuf, 1300, pusrdata, len );
if( r > 0 )
{
espconn_sent( (struct espconn *)arg, retbuf, r );
//YUCK! Since SDK 1.4.0, we have to do this ridiculous thing to respond to senders.
struct espconn * rc = (struct espconn *)arg;
remot_info * ri = 0;
espconn_get_connection_info( rc, &ri, 0);
ets_memcpy( rc->proto.udp->remote_ip, ri->remote_ip, 4 );
rc->proto.udp->remote_port = ri->remote_port;
espconn_sendto( rc, retbuf, r );
}
}
@ -563,7 +569,7 @@ void ICACHE_FLASH_ATTR CSInit()
espconn_regist_time(pHTTPServer, 15, 0); //timeout
}
void CSTick( int slowtick )
void ICACHE_FLASH_ATTR CSTick( int slowtick )
{
static uint8_t tick_flag = 0;

View file

@ -8,20 +8,24 @@
uint32 mfs_at = 0;
void FindMPFS()
void ICACHE_FLASH_ATTR FindMPFS()
{
uint32 mfs_check[2];
EnterCritical();
flashchip->chip_size = 0x01000000;
spi_flash_read( MFS_START, mfs_check, sizeof( mfs_check ) );
if( strncmp( "MPFSPFS", mfs_check ) == 0 ) { mfs_at = MFS_START; goto done; }
if( strncmp( "MPFSMPFS", mfs_check, 8 ) == 0 ) { mfs_at = MFS_START; goto done; }
spi_flash_read( MFS_ALTERNATIVE_START, mfs_check, sizeof( mfs_check ) );
if( strncmp( "MPFSPFS", mfs_check ) == 0 ) { mfs_at = MFS_ALTERNATIVE_START; goto done; }
printf( "MFS Not found at regular address (%08x).\n", mfs_check[0], mfs_check[1] );
spi_flash_read( MFS_ALTERNATIVE_START, mfs_check, sizeof( mfs_check ) );
if( strncmp( "MPFSMPFS", mfs_check, 8 ) == 0 ) { mfs_at = MFS_ALTERNATIVE_START; goto done; }
printf( "MFS Not found at alternative address (%08x%08x).\n", mfs_check[0], mfs_check[1] );
done:
printf( "MFS Found at: %08x\n", mfs_at );
flashchip->chip_size = 0x00080000;
ExitCritical();
}
@ -32,7 +36,7 @@ extern SpiFlashChip * flashchip;
//Returns size of file if non-empty
//If positive, populates mfi.
//Returns -1 if can't find file or reached end of file list.
int8_t MFSOpenFile( const char * fname, struct MFSFileInfo * mfi )
int8_t ICACHE_FLASH_ATTR MFSOpenFile( const char * fname, struct MFSFileInfo * mfi )
{
if( mfs_at == 0 )
{

View file

@ -106,7 +106,7 @@ void PushBlob( const uint8 * buffer, int len )
}
int8_t TCPCanSend( struct espconn * conn, int size )
int8_t ICACHE_FLASH_ATTR TCPCanSend( struct espconn * conn, int size )
{
#ifdef SAFESEND
return TCPDoneSend( conn );

View file

@ -30,7 +30,7 @@ extern const char * enctypes[6];// = { "open", "wep", "wpa", "wpa2", "wpa_wpa2",
char tohex1( uint8_t i );
int8_t fromhex1( char c ); //returns -1 if not hex char.
int32 my_atoi( const char * in );
int32 my_atoi( const char * in );
void Uint32To10Str( char * out, uint32 dat );
//For holding TX packet buffers