![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Backing up an unused program in case of future need
Diff: esp.cpp
- Revision:
- 6:be97d38e0b01
- Parent:
- 4:e076884ef8bd
--- a/esp.cpp Wed May 11 16:42:35 2016 +0000 +++ b/esp.cpp Tue May 31 07:35:28 2016 +0000 @@ -23,10 +23,6 @@ char EspLine[LINE_LENGTH]; static char* pLineNext; //Initialised in init to EspLine -static char* pRespBuff; -static int lenRespBuff; -static char* pRespNext; //Initialised at each request to send a string - static int addRawCharToBuffer(char* pBuff, char** ppNext, int len, char c) { @@ -62,7 +58,6 @@ static int addChar(char c) { int r = addCharToBuffer(EspLine, &pLineNext, LINE_LENGTH, c, false); - addCharToBuffer(pRespBuff, &pRespNext, lenRespBuff, c, true ); return r; } //Unsolicited ntp or http requests @@ -80,7 +75,7 @@ int EspLengthToSend; const void * EspDataToSend; -void EspSendStringF(char* respbuff, int resplen, char *fmt, ...) +void EspSendCommandF(char *fmt, ...) { va_list argptr; va_start(argptr, fmt); @@ -88,17 +83,10 @@ char snd[size + 1]; vsprintf(snd, fmt, argptr); va_end(argptr); - EspSendString(respbuff, resplen, snd); + EspSendCommand(snd); } -void EspSendString(char* respbuff, int resplen, char* p) -{ - //Reset the response buffer - pRespBuff = respbuff; - pRespNext = respbuff; - lenRespBuff = resplen; - *pRespNext = '\0'; - - //Send the string +void EspSendCommand(char* p) +{ while(*p) UartSendPush(*p++); } void EspSendData(int length, const void * snd) @@ -119,9 +107,6 @@ UartReset(); pLineNext = EspLine; *pLineNext = '\0'; - pRespBuff = NULL; - *pRespNext = NULL; - lenRespBuff = 0; EspLengthToSend = 0; EspDataToSend = NULL; state = IDLE; @@ -300,7 +285,10 @@ int c = UartRecvPull(); if (c != EOF) { - LogPush(c); + if (CfgLogNetwork) + { + LogPush(c); + } int r = handleCharacter(c); //This will set the EspAvailable one-shots if (r) return -1; }