mirror of
https://github.com/esp8266/Arduino.git
synced 2025-04-19 23:22:16 +03:00
Merge branch 'esp8266' of https://github.com/Links2004/Arduino into Links2004-esp8266
Conflicts: hardware/esp8266com/esp8266/cores/esp8266/core_esp8266_noniso.c
This commit is contained in:
commit
b21ff941b2
@ -17,6 +17,9 @@
|
|||||||
You should have received a copy of the GNU Lesser General Public
|
You should have received a copy of the GNU Lesser General Public
|
||||||
License along with this library; if not, write to the Free Software
|
License along with this library; if not, write to the Free Software
|
||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
Modified 03 April 2015 by Markus Sattler
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@ -26,19 +29,19 @@
|
|||||||
#define sprintf ets_sprintf
|
#define sprintf ets_sprintf
|
||||||
#define strcpy ets_strcpy
|
#define strcpy ets_strcpy
|
||||||
|
|
||||||
long atol(const char* s)
|
int atoi(const char* s) {
|
||||||
{
|
return (int) atol(s);
|
||||||
int result = 0;
|
}
|
||||||
|
|
||||||
|
long atol(const char* s) {
|
||||||
|
long int result = 0;
|
||||||
int i;
|
int i;
|
||||||
const char* b = s;
|
const char* b = s;
|
||||||
int sign = 1;
|
int sign = 1;
|
||||||
for (i = 0; *b; ++i, ++b)
|
for(i = 0; *b; ++i, ++b) {
|
||||||
{
|
if(i == 0 && *b == '-') sign = -1;
|
||||||
if (i == 0 && *b == '-')
|
|
||||||
sign = -1;
|
|
||||||
int x = *b - '0';
|
int x = *b - '0';
|
||||||
if (x < 0 || x > 9)
|
if(x < 0 || x > 9) break;
|
||||||
break;
|
|
||||||
result = result * 10 + x;
|
result = result * 10 + x;
|
||||||
}
|
}
|
||||||
return sign * result;
|
return sign * result;
|
||||||
@ -46,58 +49,47 @@ long atol(const char* s)
|
|||||||
|
|
||||||
// Source:
|
// Source:
|
||||||
// https://github.com/anakod/Sming/blob/master/Sming/system/stringconversion.cpp#L93
|
// https://github.com/anakod/Sming/blob/master/Sming/system/stringconversion.cpp#L93
|
||||||
double atof(const char* s)
|
double atof(const char* s) {
|
||||||
{
|
|
||||||
double result = 0;
|
double result = 0;
|
||||||
double factor = 1.0;
|
double factor = 1.0;
|
||||||
|
|
||||||
while(*s == ' ' || *s == '\t' || *s == '\r' || *s == '\n')
|
while(*s == ' ' || *s == '\t' || *s == '\r' || *s == '\n')
|
||||||
++s;
|
++s;
|
||||||
|
|
||||||
if (*s == 0)
|
if(*s == 0) return 0;
|
||||||
return 0;
|
|
||||||
|
|
||||||
if (*s == '-')
|
if(*s == '-') {
|
||||||
{
|
|
||||||
factor = -1.0;
|
factor = -1.0;
|
||||||
++s;
|
++s;
|
||||||
}
|
}
|
||||||
if (*s == '+')
|
if(*s == '+') {
|
||||||
{
|
|
||||||
++s;
|
++s;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool decimals = false;
|
bool decimals = false;
|
||||||
char c;
|
char c;
|
||||||
while((c = *s))
|
while((c = *s)) {
|
||||||
{
|
if(c == '.') {
|
||||||
if (c == '.')
|
|
||||||
{
|
|
||||||
decimals = true;
|
decimals = true;
|
||||||
++s;
|
++s;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
int d = c - '0';
|
int d = c - '0';
|
||||||
if (d < 0 || d > 9)
|
if(d < 0 || d > 9) break;
|
||||||
break;
|
|
||||||
|
|
||||||
result = 10.0 * result + d;
|
result = 10.0 * result + d;
|
||||||
if (decimals)
|
if(decimals) factor *= 0.1;
|
||||||
factor *= 0.1;
|
|
||||||
++s;
|
++s;
|
||||||
}
|
}
|
||||||
|
|
||||||
return result * factor;
|
return result * factor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void reverse(char* begin, char* end) {
|
||||||
void reverse(char* begin, char* end)
|
|
||||||
{
|
|
||||||
char *is = begin;
|
char *is = begin;
|
||||||
char *ie = end - 1;
|
char *ie = end - 1;
|
||||||
while (is < ie)
|
while(is < ie) {
|
||||||
{
|
|
||||||
char tmp = *ie;
|
char tmp = *ie;
|
||||||
*ie = *is;
|
*ie = *is;
|
||||||
*is = tmp;
|
*is = tmp;
|
||||||
@ -106,10 +98,8 @@ void reverse(char* begin, char* end)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
char* itoa( int value, char* result, int base )
|
char* itoa(int value, char* result, int base) {
|
||||||
{
|
if(base < 2 || base > 16) {
|
||||||
if (base < 2 || base > 16)
|
|
||||||
{
|
|
||||||
*result = 0;
|
*result = 0;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -117,8 +107,7 @@ char* itoa( int value, char* result, int base )
|
|||||||
char* out = result;
|
char* out = result;
|
||||||
int quotient = abs(value);
|
int quotient = abs(value);
|
||||||
|
|
||||||
do
|
do {
|
||||||
{
|
|
||||||
const int tmp = quotient / base;
|
const int tmp = quotient / base;
|
||||||
*out = "0123456789abcdef"[quotient - (tmp * base)];
|
*out = "0123456789abcdef"[quotient - (tmp * base)];
|
||||||
++out;
|
++out;
|
||||||
@ -133,10 +122,8 @@ char* itoa( int value, char* result, int base )
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
char* ltoa( long value, char* result, int base )
|
char* ltoa(long value, char* result, int base) {
|
||||||
{
|
if(base < 2 || base > 16) {
|
||||||
if (base < 2 || base > 16)
|
|
||||||
{
|
|
||||||
*result = 0;
|
*result = 0;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -144,8 +131,7 @@ char* ltoa( long value, char* result, int base )
|
|||||||
char* out = result;
|
char* out = result;
|
||||||
long quotient = abs(value);
|
long quotient = abs(value);
|
||||||
|
|
||||||
do
|
do {
|
||||||
{
|
|
||||||
const long tmp = quotient / base;
|
const long tmp = quotient / base;
|
||||||
*out = "0123456789abcdef"[quotient - (tmp * base)];
|
*out = "0123456789abcdef"[quotient - (tmp * base)];
|
||||||
++out;
|
++out;
|
||||||
@ -160,10 +146,8 @@ char* ltoa( long value, char* result, int base )
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
char* utoa( unsigned value, char* result, int base )
|
char* utoa(unsigned value, char* result, int base) {
|
||||||
{
|
if(base < 2 || base > 16) {
|
||||||
if (base < 2 || base > 16)
|
|
||||||
{
|
|
||||||
*result = 0;
|
*result = 0;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -171,8 +155,7 @@ char* utoa( unsigned value, char* result, int base )
|
|||||||
char* out = result;
|
char* out = result;
|
||||||
unsigned quotient = value;
|
unsigned quotient = value;
|
||||||
|
|
||||||
do
|
do {
|
||||||
{
|
|
||||||
const unsigned tmp = quotient / base;
|
const unsigned tmp = quotient / base;
|
||||||
*out = "0123456789abcdef"[quotient - (tmp * base)];
|
*out = "0123456789abcdef"[quotient - (tmp * base)];
|
||||||
++out;
|
++out;
|
||||||
@ -184,10 +167,8 @@ char* utoa( unsigned value, char* result, int base )
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
char* ultoa( unsigned long value, char* result, int base )
|
char* ultoa(unsigned long value, char* result, int base) {
|
||||||
{
|
if(base < 2 || base > 16) {
|
||||||
if (base < 2 || base > 16)
|
|
||||||
{
|
|
||||||
*result = 0;
|
*result = 0;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -195,8 +176,7 @@ char* ultoa( unsigned long value, char* result, int base )
|
|||||||
char* out = result;
|
char* out = result;
|
||||||
unsigned long quotient = value;
|
unsigned long quotient = value;
|
||||||
|
|
||||||
do
|
do {
|
||||||
{
|
|
||||||
const unsigned long tmp = quotient / base;
|
const unsigned long tmp = quotient / base;
|
||||||
*out = "0123456789abcdef"[quotient - (tmp * base)];
|
*out = "0123456789abcdef"[quotient - (tmp * base)];
|
||||||
++out;
|
++out;
|
||||||
@ -208,31 +188,25 @@ char* ultoa( unsigned long value, char* result, int base )
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
char * dtostrf (double number, signed char width, unsigned char prec, char *s)
|
char * dtostrf(double number, signed char width, unsigned char prec, char *s) {
|
||||||
{
|
|
||||||
size_t n = 0;
|
size_t n = 0;
|
||||||
|
|
||||||
if (isnan(number))
|
if(isnan(number)) {
|
||||||
{
|
|
||||||
strcpy(s, "nan");
|
strcpy(s, "nan");
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
if (isinf(number))
|
if(isinf(number)) {
|
||||||
{
|
|
||||||
strcpy(s, "inf");
|
strcpy(s, "inf");
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (number > 4294967040.0 ||
|
if(number > 4294967040.0 || number < -4294967040.0) {
|
||||||
number <-4294967040.0)
|
|
||||||
{
|
|
||||||
strcpy(s, "ovf");
|
strcpy(s, "ovf");
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
char* out = s;
|
char* out = s;
|
||||||
// Handle negative numbers
|
// Handle negative numbers
|
||||||
if (number < 0.0)
|
if(number < 0.0) {
|
||||||
{
|
|
||||||
*out = '-';
|
*out = '-';
|
||||||
++out;
|
++out;
|
||||||
number = -number;
|
number = -number;
|
||||||
@ -256,8 +230,7 @@ char * dtostrf (double number, signed char width, unsigned char prec, char *s)
|
|||||||
++out;
|
++out;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (prec-- > 0)
|
while(prec-- > 0) {
|
||||||
{
|
|
||||||
remainder *= 10.0;
|
remainder *= 10.0;
|
||||||
}
|
}
|
||||||
sprintf(out, "%d", (int) remainder);
|
sprintf(out, "%d", (int) remainder);
|
||||||
|
@ -18,6 +18,9 @@
|
|||||||
You should have received a copy of the GNU Lesser General Public
|
You should have received a copy of the GNU Lesser General Public
|
||||||
License along with this library; if not, write to the Free Software
|
License along with this library; if not, write to the Free Software
|
||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
Modified 03 April 2015 by Markus Sattler
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
@ -43,24 +46,34 @@ void* realloc(void* ptr, size_t size) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int printf(const char* format, ...) {
|
int printf(const char* format, ...) {
|
||||||
|
int ret;
|
||||||
va_list arglist;
|
va_list arglist;
|
||||||
va_start(arglist, format);
|
va_start(arglist, format);
|
||||||
ets_vprintf(format, arglist);
|
ret = ets_vprintf(format, arglist);
|
||||||
va_end(arglist);
|
va_end(arglist);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int sprintf(char* buffer, const char* format, ...) {
|
int sprintf(char* buffer, const char* format, ...) {
|
||||||
|
int ret;
|
||||||
va_list arglist;
|
va_list arglist;
|
||||||
va_start(arglist, format);
|
va_start(arglist, format);
|
||||||
ets_vsprintf(buffer, format, arglist);
|
ret = ets_vsprintf(buffer, format, arglist);
|
||||||
va_end(arglist);
|
va_end(arglist);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int snprintf(char* buffer, size_t size, const char* format, ...) {
|
int snprintf(char* buffer, size_t size, const char* format, ...) {
|
||||||
|
int ret;
|
||||||
va_list arglist;
|
va_list arglist;
|
||||||
va_start(arglist, format);
|
va_start(arglist, format);
|
||||||
ets_vsnprintf(buffer, size, format, arglist);
|
ret = ets_vsnprintf(buffer, size, format, arglist);
|
||||||
va_end(arglist);
|
va_end(arglist);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
int vsnprintf(char * buffer, size_t size, const char * format, va_list arg) {
|
||||||
|
return ets_vsnprintf(buffer, size, format, arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
int memcmp(const void *s1, const void *s2, size_t n) {
|
int memcmp(const void *s1, const void *s2, size_t n) {
|
||||||
@ -99,3 +112,202 @@ char *ets_strstr(const char *haystack, const char *needle) {
|
|||||||
return strstr(haystack, needle);
|
return strstr(haystack, needle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char *strchr(const char * str, int character) {
|
||||||
|
while(1) {
|
||||||
|
if(*str == 0x00) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
if(*str == (char) character) {
|
||||||
|
return (char *) str;
|
||||||
|
}
|
||||||
|
str++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
char *strrchr(const char * str, int character) {
|
||||||
|
char * ret = NULL;
|
||||||
|
while(1) {
|
||||||
|
if(*str == 0x00) {
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
if(*str == (char) character) {
|
||||||
|
ret = (char *) str;
|
||||||
|
}
|
||||||
|
str++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
char *strcat(char * dest, const char * src) {
|
||||||
|
return strncat(dest, src, strlen(src));
|
||||||
|
}
|
||||||
|
|
||||||
|
char *strncat(char * dest, const char * src, size_t n) {
|
||||||
|
uint32_t offset = strlen(dest);
|
||||||
|
for(uint32_t i = 0; i < n; i++) {
|
||||||
|
*(dest + i + offset) = *(src + i);
|
||||||
|
if(*(src + i) == 0x00) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return dest;
|
||||||
|
}
|
||||||
|
|
||||||
|
char *strtok_r(char * str, const char * delimiters, char ** temp) {
|
||||||
|
static char * ret = NULL;
|
||||||
|
char * start = NULL;
|
||||||
|
char * end = NULL;
|
||||||
|
uint32_t size = 0;
|
||||||
|
|
||||||
|
if(str == NULL) {
|
||||||
|
start = *temp;
|
||||||
|
} else {
|
||||||
|
start = str;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(start == NULL) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
end = start;
|
||||||
|
|
||||||
|
while(1) {
|
||||||
|
for(uint16_t i = 0; i < strlen(delimiters); i++) {
|
||||||
|
if(*end == *(delimiters + i)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
end++;
|
||||||
|
if(*end == 0x00) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
*temp = end;
|
||||||
|
|
||||||
|
if(ret != NULL) {
|
||||||
|
free(ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
size = (end - start);
|
||||||
|
ret = (char *) malloc(size);
|
||||||
|
strncpy(ret, start, size);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ##########################################################################
|
||||||
|
// ctype functions
|
||||||
|
// ##########################################################################
|
||||||
|
|
||||||
|
int isalnum(int c) {
|
||||||
|
if(isalpha(c) || isdigit(c)) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int isalpha(int c) {
|
||||||
|
if(islower(c) || isupper(c)) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int iscntrl(int c) {
|
||||||
|
if(c <= 0x1F || c == 0x7F) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int isdigit(int c) {
|
||||||
|
if(c >= '0' && c <= '9') {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
int isgraph(int c) {
|
||||||
|
if(isprint(c) && c != ' ') {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int islower(int c) {
|
||||||
|
if(c >= 'a' && c <= 'z') {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int isprint(int c) {
|
||||||
|
if(!iscntrl(c)) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int ispunct(int c) {
|
||||||
|
if(isgraph(c) && !isalnum(c)) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int isspace(int c) {
|
||||||
|
switch(c) {
|
||||||
|
case 0x20: // ' '
|
||||||
|
case 0x09: // '\t'
|
||||||
|
case 0x0a: // '\n'
|
||||||
|
case 0x0b: // '\v'
|
||||||
|
case 0x0c: // '\f'
|
||||||
|
case 0x0d: // '\r'
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int isupper(int c) {
|
||||||
|
if(c >= 'A' && c <= 'Z') {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int isxdigit(int c) {
|
||||||
|
if(c >= 'A' && c <= 'F') {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if(c >= 'a' && c <= 'f') {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if(isdigit(c)) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int tolower(int c) {
|
||||||
|
if(isupper(c)) {
|
||||||
|
c += 0x20;
|
||||||
|
}
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
|
||||||
|
int toupper(int c) {
|
||||||
|
if(islower(c)) {
|
||||||
|
c -= 0x20;
|
||||||
|
}
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
|
||||||
|
int isblank(int c) {
|
||||||
|
switch(c) {
|
||||||
|
case 0x20: // ' '
|
||||||
|
case 0x09: // '\t'
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ##########################################################################
|
||||||
|
|
||||||
|
@ -7,6 +7,9 @@
|
|||||||
#define PGM_P const char *
|
#define PGM_P const char *
|
||||||
#define PSTR(str) (str)
|
#define PSTR(str) (str)
|
||||||
|
|
||||||
|
#define vsnprintf_P(...) vsnprintf( __VA_ARGS__ )
|
||||||
|
#define snprintf_P(...) snprintf( __VA_ARGS__ )
|
||||||
|
|
||||||
#define _SFR_BYTE(n) (n)
|
#define _SFR_BYTE(n) (n)
|
||||||
|
|
||||||
typedef void prog_void;
|
typedef void prog_void;
|
||||||
|
@ -26,9 +26,11 @@
|
|||||||
extern "C"{
|
extern "C"{
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
long atol_internal(const char*);
|
int atoi(const char *s);
|
||||||
|
|
||||||
float atof_internal(const char*);
|
long atol(const char* s);
|
||||||
|
|
||||||
|
double atof(const char* s);
|
||||||
|
|
||||||
char* itoa (int val, char *s, int radix);
|
char* itoa (int val, char *s, int radix);
|
||||||
|
|
||||||
|
@ -40,11 +40,6 @@ extern "C"
|
|||||||
#include "include/ClientContext.h"
|
#include "include/ClientContext.h"
|
||||||
#include "c_types.h"
|
#include "c_types.h"
|
||||||
|
|
||||||
#define MIN_LOCAL_PORT 1024
|
|
||||||
#define MAX_LOCAL_PORT 1124
|
|
||||||
|
|
||||||
static int g_localPort = MIN_LOCAL_PORT;
|
|
||||||
|
|
||||||
ICACHE_FLASH_ATTR WiFiClient::WiFiClient()
|
ICACHE_FLASH_ATTR WiFiClient::WiFiClient()
|
||||||
: _client(0)
|
: _client(0)
|
||||||
{
|
{
|
||||||
@ -98,18 +93,6 @@ int ICACHE_FLASH_ATTR WiFiClient::connect(IPAddress ip, uint16_t port)
|
|||||||
if (!pcb)
|
if (!pcb)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
while(true)
|
|
||||||
{
|
|
||||||
err_t err = tcp_bind(pcb, INADDR_ANY, g_localPort);
|
|
||||||
if (++g_localPort == MAX_LOCAL_PORT)
|
|
||||||
g_localPort = MIN_LOCAL_PORT;
|
|
||||||
if (err == ERR_OK)
|
|
||||||
break;
|
|
||||||
if (err == ERR_USE)
|
|
||||||
continue;
|
|
||||||
tcp_abort(pcb);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
ip_addr_t addr;
|
ip_addr_t addr;
|
||||||
addr.addr = ip;
|
addr.addr = ip;
|
||||||
tcp_arg(pcb, this);
|
tcp_arg(pcb, this);
|
||||||
@ -136,7 +119,7 @@ int8_t ICACHE_FLASH_ATTR WiFiClient::_connected(void* pcb, int8_t err)
|
|||||||
|
|
||||||
void ICACHE_FLASH_ATTR WiFiClient::_err(int8_t err)
|
void ICACHE_FLASH_ATTR WiFiClient::_err(int8_t err)
|
||||||
{
|
{
|
||||||
DEBUGV(":err\r\n");
|
DEBUGV(":err %d\r\n", err);
|
||||||
esp_schedule();
|
esp_schedule();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,6 +73,7 @@ public:
|
|||||||
|
|
||||||
void unref()
|
void unref()
|
||||||
{
|
{
|
||||||
|
err_t err;
|
||||||
DEBUGV(":ur %d\r\n", _refcnt);
|
DEBUGV(":ur %d\r\n", _refcnt);
|
||||||
if (--_refcnt == 0)
|
if (--_refcnt == 0)
|
||||||
{
|
{
|
||||||
@ -82,7 +83,11 @@ public:
|
|||||||
tcp_sent(_pcb, NULL);
|
tcp_sent(_pcb, NULL);
|
||||||
tcp_recv(_pcb, NULL);
|
tcp_recv(_pcb, NULL);
|
||||||
tcp_err(_pcb, NULL);
|
tcp_err(_pcb, NULL);
|
||||||
tcp_close(_pcb);
|
err = tcp_close(_pcb);
|
||||||
|
if(err != ERR_OK) {
|
||||||
|
DEBUGV(":tc err %d\r\n", err);
|
||||||
|
tcp_abort(_pcb);
|
||||||
|
}
|
||||||
_pcb = 0;
|
_pcb = 0;
|
||||||
}
|
}
|
||||||
delete this;
|
delete this;
|
||||||
@ -269,7 +274,7 @@ private:
|
|||||||
|
|
||||||
void _error(err_t err)
|
void _error(err_t err)
|
||||||
{
|
{
|
||||||
DEBUGV(":er\r\n");
|
DEBUGV(":er %d\r\n", err);
|
||||||
_pcb = 0;
|
_pcb = 0;
|
||||||
if (_size_sent && _send_waiting)
|
if (_size_sent && _send_waiting)
|
||||||
esp_schedule();
|
esp_schedule();
|
||||||
|
@ -23,7 +23,7 @@ compiler.S.flags=-c -g -x assembler-with-cpp -MMD
|
|||||||
compiler.c.elf.ldscript=eagle.app.v6.ld
|
compiler.c.elf.ldscript=eagle.app.v6.ld
|
||||||
compiler.c.elf.flags=-nostdlib -Wl,--no-check-sections -u call_user_start -Wl,-static "-L{compiler.sdk.path}/lib" "-L{compiler.sdk.path}/ld" "-T{compiler.c.elf.ldscript}"
|
compiler.c.elf.flags=-nostdlib -Wl,--no-check-sections -u call_user_start -Wl,-static "-L{compiler.sdk.path}/lib" "-L{compiler.sdk.path}/ld" "-T{compiler.c.elf.ldscript}"
|
||||||
compiler.c.elf.cmd=xtensa-lx106-elf-gcc
|
compiler.c.elf.cmd=xtensa-lx106-elf-gcc
|
||||||
compiler.c.elf.libs=-lgcc -lhal -lphy -lnet80211 -llwip -lwpa -lmain -lpp
|
compiler.c.elf.libs=-lgcc -lm -lhal -lphy -lnet80211 -llwip -lwpa -lmain -lpp
|
||||||
|
|
||||||
compiler.cpp.cmd=xtensa-lx106-elf-g++
|
compiler.cpp.cmd=xtensa-lx106-elf-g++
|
||||||
compiler.cpp.flags=-c -Os -mlongcalls -mtext-section-literals -fno-exceptions -fno-rtti -std=c++11 -MMD
|
compiler.cpp.flags=-c -Os -mlongcalls -mtext-section-literals -fno-exceptions -fno-rtti -std=c++11 -MMD
|
||||||
@ -66,7 +66,7 @@ recipe.S.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.cpreprocessor.fla
|
|||||||
recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compiler.ar.extra_flags} "{build.path}/{archive_file}" "{object_file}"
|
recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compiler.ar.extra_flags} "{build.path}/{archive_file}" "{object_file}"
|
||||||
|
|
||||||
## Combine gc-sections, archives, and objects
|
## Combine gc-sections, archives, and objects
|
||||||
recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" {compiler.c.elf.flags} {compiler.c.elf.extra_flags} -o "{build.path}/{build.project_name}.elf" -Wl,--start-group {object_files} "{build.path}/{archive_file}" {compiler.c.elf.libs} -Wl,--end-group -lc "-L{build.path}"
|
recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" {compiler.c.elf.flags} {compiler.c.elf.extra_flags} -o "{build.path}/{build.project_name}.elf" -Wl,--start-group {object_files} "{build.path}/{archive_file}" {compiler.c.elf.libs} -Wl,--end-group "-L{build.path}"
|
||||||
|
|
||||||
## Create eeprom
|
## Create eeprom
|
||||||
recipe.objcopy.eep.pattern=
|
recipe.objcopy.eep.pattern=
|
||||||
|
Loading…
x
Reference in New Issue
Block a user