1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-19 23:22:16 +03:00

Merge branch 'master' of https://github.com/esp8266/Arduino into MD5

This commit is contained in:
Andrew Melvin 2016-01-04 13:06:16 +02:00
commit e12b6ffa40
13 changed files with 153 additions and 53 deletions

View File

@ -6,6 +6,8 @@ menu.FlashFreq=Flash Frequency
menu.UploadTool=Upload Using menu.UploadTool=Upload Using
menu.ResetMethod=Reset Method menu.ResetMethod=Reset Method
menu.ESPModule=Module menu.ESPModule=Module
menu.Debug=Debug port
menu.DebugLevel=Debug Level
############################################################## ##############################################################
generic.name=Generic ESP8266 Module generic.name=Generic ESP8266 Module
@ -26,6 +28,8 @@ generic.build.core=esp8266
generic.build.variant=generic generic.build.variant=generic
generic.build.flash_mode=qio generic.build.flash_mode=qio
generic.build.spiffs_pagesize=256 generic.build.spiffs_pagesize=256
generic.build.debug_port=
generic.build.debug_level=
generic.menu.UploadTool.esptool=Serial generic.menu.UploadTool.esptool=Serial
generic.menu.UploadTool.esptool.upload.tool=esptool generic.menu.UploadTool.esptool.upload.tool=esptool
@ -166,6 +170,42 @@ generic.menu.ResetMethod.ck.upload.resetmethod=ck
generic.menu.ResetMethod.nodemcu=nodemcu generic.menu.ResetMethod.nodemcu=nodemcu
generic.menu.ResetMethod.nodemcu.upload.resetmethod=nodemcu generic.menu.ResetMethod.nodemcu.upload.resetmethod=nodemcu
generic.menu.Debug.Disabled=Disabled
generic.menu.Debug.Disabled.build.debug_port=
generic.menu.Debug.Serial=Serial
generic.menu.Debug.Serial.build.debug_port=-DDEBUG_ESP_PORT=Serial
generic.menu.Debug.Serial1=Serial1
generic.menu.Debug.Serial1.build.debug_port=-DDEBUG_ESP_PORT=Serial1
generic.menu.DebugLevel.None=None
generic.menu.DebugLevel.None.build.debug_level=
generic.menu.DebugLevel.Core=Core
generic.menu.DebugLevel.Core.build.debug_level=-DDEBUG_ESP_CORE
generic.menu.DebugLevel.SSL=Core + SSL
generic.menu.DebugLevel.SSL.build.debug_level=-DDEBUG_ESP_CORE -DDEBUG_ESP_SSL
generic.menu.DebugLevel.WiFic=Core + WiFi
generic.menu.DebugLevel.WiFic.build.debug_level=-DDEBUG_ESP_CORE -DDEBUG_ESP_WIFI
generic.menu.DebugLevel.WiFi=WiFi
generic.menu.DebugLevel.WiFi.build.debug_level=-DDEBUG_ESP_WIFI
generic.menu.DebugLevel.HTTPClient=HTTPClient
generic.menu.DebugLevel.HTTPClient.build.debug_level=-DDEBUG_ESP_HTTP_CLIENT
generic.menu.DebugLevel.HTTPUpdate=HTTPUpdate
generic.menu.DebugLevel.HTTPUpdate.build.debug_level=-DDEBUG_ESP_HTTP_UPDATE
generic.menu.DebugLevel.HTTPUpdate2=HTTPClient + HTTPUpdate
generic.menu.DebugLevel.HTTPUpdate2.build.debug_level=-DDEBUG_ESP_HTTP_UPDATE -DDEBUG_ESP_HTTP_UPDATE
generic.menu.DebugLevel.HTTPUpdate3=HTTPClient + HTTPUpdate + Updater
generic.menu.DebugLevel.HTTPUpdate3.build.debug_level=-DDEBUG_ESP_HTTP_UPDATE -DDEBUG_ESP_HTTP_UPDATE -DDEBUG_ESP_UPDATER
generic.menu.DebugLevel.HTTPServer=HTTPServer
generic.menu.DebugLevel.HTTPServer.build.debug_level=-DDEBUG_ESP_HTTP_SERVER
generic.menu.DebugLevel.UPDATER=Updater
generic.menu.DebugLevel.UPDATER.build.debug_level=-DDEBUG_ESP_UPDATER
generic.menu.DebugLevel.OTA=OTA
generic.menu.DebugLevel.OTA.build.debug_level=-DDEBUG_ESP_OTA
generic.menu.DebugLevel.OTA2=OTA + Updater
generic.menu.DebugLevel.OTA2.build.debug_level=-DDEBUG_ESP_OTA -DDEBUG_ESP_UPDATER
generic.menu.DebugLevel.all=All
generic.menu.DebugLevel.all.build.debug_level=-DDEBUG_ESP_CORE -DDEBUG_ESP_SSL -DDEBUG_ESP_WIFI -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_UPDATE -DDEBUG_ESP_HTTP_SERVER -DDEBUG_ESP_UPDATER -DDEBUG_ESP_OTA
# disabled because espressif's bootloader refuses to write above 4M # disabled because espressif's bootloader refuses to write above 4M
# generic.menu.FlashSize.8M=8M (7M SPIFFS) # generic.menu.FlashSize.8M=8M (7M SPIFFS)
# generic.menu.FlashSize.8M.build.flash_size=1M # generic.menu.FlashSize.8M.build.flash_size=1M
@ -200,6 +240,8 @@ espduino.build.variant=espduino
espduino.build.flash_mode=dio espduino.build.flash_mode=dio
espduino.build.flash_size=4M espduino.build.flash_size=4M
espduino.build.flash_freq=40 espduino.build.flash_freq=40
espduino.build.debug_port=
espduino.build.debug_level=
espduino.menu.CpuFrequency.80=80 MHz espduino.menu.CpuFrequency.80=80 MHz
espduino.menu.CpuFrequency.80.build.f_cpu=80000000L espduino.menu.CpuFrequency.80.build.f_cpu=80000000L
@ -267,6 +309,8 @@ huzzah.build.variant=adafruit
huzzah.build.flash_mode=qio huzzah.build.flash_mode=qio
huzzah.build.flash_size=4M huzzah.build.flash_size=4M
huzzah.build.flash_freq=40 huzzah.build.flash_freq=40
huzzah.build.debug_port=
huzzah.build.debug_level=
huzzah.menu.CpuFrequency.80=80 MHz huzzah.menu.CpuFrequency.80=80 MHz
huzzah.menu.CpuFrequency.80.build.f_cpu=80000000L huzzah.menu.CpuFrequency.80.build.f_cpu=80000000L
@ -324,6 +368,8 @@ nodemcu.build.variant=nodemcu
nodemcu.build.flash_mode=qio nodemcu.build.flash_mode=qio
nodemcu.build.flash_size=4M nodemcu.build.flash_size=4M
nodemcu.build.flash_freq=40 nodemcu.build.flash_freq=40
nodemcu.build.debug_port=
nodemcu.build.debug_level=
nodemcu.menu.CpuFrequency.80=80 MHz nodemcu.menu.CpuFrequency.80=80 MHz
nodemcu.menu.CpuFrequency.80.build.f_cpu=80000000L nodemcu.menu.CpuFrequency.80.build.f_cpu=80000000L
@ -390,6 +436,8 @@ nodemcuv2.build.variant=nodemcu
nodemcuv2.build.flash_mode=dio nodemcuv2.build.flash_mode=dio
nodemcuv2.build.flash_size=4M nodemcuv2.build.flash_size=4M
nodemcuv2.build.flash_freq=40 nodemcuv2.build.flash_freq=40
nodemcuv2.build.debug_port=
nodemcuv2.build.debug_level=
nodemcuv2.menu.CpuFrequency.80=80 MHz nodemcuv2.menu.CpuFrequency.80=80 MHz
nodemcuv2.menu.CpuFrequency.80.build.f_cpu=80000000L nodemcuv2.menu.CpuFrequency.80.build.f_cpu=80000000L
@ -465,6 +513,8 @@ modwifi.build.spiffs_start=0x100000
modwifi.build.spiffs_end=0x1FB000 modwifi.build.spiffs_end=0x1FB000
modwifi.build.spiffs_pagesize=256 modwifi.build.spiffs_pagesize=256
modwifi.build.spiffs_blocksize=8192 modwifi.build.spiffs_blocksize=8192
modwifi.build.debug_port=
modwifi.build.debug_level=
modwifi.menu.CpuFrequency.80=80 MHz modwifi.menu.CpuFrequency.80=80 MHz
modwifi.menu.CpuFrequency.80.build.f_cpu=80000000L modwifi.menu.CpuFrequency.80.build.f_cpu=80000000L
@ -521,6 +571,8 @@ thing.build.spiffs_start=0x6B000
thing.build.spiffs_end=0x7B000 thing.build.spiffs_end=0x7B000
thing.build.spiffs_blocksize=4096 thing.build.spiffs_blocksize=4096
thing.build.spiffs_pagesize=256 thing.build.spiffs_pagesize=256
thing.build.debug_port=
thing.build.debug_level=
thing.menu.CpuFrequency.80=80 MHz thing.menu.CpuFrequency.80=80 MHz
thing.menu.CpuFrequency.80.build.f_cpu=80000000L thing.menu.CpuFrequency.80.build.f_cpu=80000000L
@ -570,6 +622,8 @@ esp210.build.variant=generic
esp210.build.flash_mode=qio esp210.build.flash_mode=qio
esp210.build.flash_size=4M esp210.build.flash_size=4M
esp210.build.flash_freq=40 esp210.build.flash_freq=40
esp210.build.debug_port=
esp210.build.debug_level=
esp210.menu.CpuFrequency.80=80 MHz esp210.menu.CpuFrequency.80=80 MHz
esp210.menu.CpuFrequency.80.build.f_cpu=80000000L esp210.menu.CpuFrequency.80.build.f_cpu=80000000L
@ -663,6 +717,8 @@ d1_mini.build.variant=d1_mini
d1_mini.build.flash_mode=dio d1_mini.build.flash_mode=dio
d1_mini.build.flash_size=4M d1_mini.build.flash_size=4M
d1_mini.build.flash_freq=40 d1_mini.build.flash_freq=40
d1_mini.build.debug_port=
d1_mini.build.debug_level=
d1_mini.menu.CpuFrequency.80=80 MHz d1_mini.menu.CpuFrequency.80=80 MHz
d1_mini.menu.CpuFrequency.80.build.f_cpu=80000000L d1_mini.menu.CpuFrequency.80.build.f_cpu=80000000L
@ -734,6 +790,8 @@ d1.build.variant=d1
d1.build.flash_mode=dio d1.build.flash_mode=dio
d1.build.flash_size=4M d1.build.flash_size=4M
d1.build.flash_freq=40 d1.build.flash_freq=40
d1.build.debug_port=
d1.build.debug_level=
d1.menu.CpuFrequency.80=80 MHz d1.menu.CpuFrequency.80=80 MHz
d1.menu.CpuFrequency.80.build.f_cpu=80000000L d1.menu.CpuFrequency.80.build.f_cpu=80000000L
@ -807,6 +865,8 @@ espino.build.flash_mode=qio
espino.build.flash_size=4M espino.build.flash_size=4M
espino.build.flash_freq=40 espino.build.flash_freq=40
espino.build.spiffs_pagesize=256 espino.build.spiffs_pagesize=256
espino.build.debug_port=
espino.build.debug_level=
espino.menu.UploadTool.esptool=Serial espino.menu.UploadTool.esptool=Serial
espino.menu.UploadTool.esptool.upload.tool=esptool espino.menu.UploadTool.esptool.upload.tool=esptool
@ -884,6 +944,8 @@ wifinfo.build.variant=wifinfo
wifinfo.build.flash_mode=qio wifinfo.build.flash_mode=qio
wifinfo.build.board=ESP8266_ESP12 wifinfo.build.board=ESP8266_ESP12
wifinfo.build.spiffs_pagesize=256 wifinfo.build.spiffs_pagesize=256
wifinfo.build.debug_port=
wifinfo.build.debug_level=
#wifinfo.menu.ESPModule.ESP07512=ESP07 (1M/512K SPIFFS) #wifinfo.menu.ESPModule.ESP07512=ESP07 (1M/512K SPIFFS)
#wifinfo.menu.ESPModule.ESP07512.build.board=ESP8266_ESP07 #wifinfo.menu.ESPModule.ESP07512.build.board=ESP8266_ESP07

View File

@ -22,7 +22,11 @@
#define U_SPIFFS 100 #define U_SPIFFS 100
#define U_AUTH 200 #define U_AUTH 200
//#define DEBUG_UPDATER Serial #ifdef DEBUG_ESP_UPDATER
#ifdef DEBUG_ESP_PORT
#define DEBUG_UPDATER DEBUG_ESP_PORT
#endif
#endif
class UpdaterClass { class UpdaterClass {
public: public:

View File

@ -101,6 +101,9 @@ static void loop_wrapper() {
preloop_update_frequency(); preloop_update_frequency();
if(!setup_done) { if(!setup_done) {
setup(); setup();
#ifdef DEBUG_ESP_PORT
DEBUG_ESP_PORT.setDebugOutput(true);
#endif
setup_done = true; setup_done = true;
} }
loop(); loop();

View File

@ -4,7 +4,9 @@
#include <stddef.h> #include <stddef.h>
#include <stdint.h> #include <stdint.h>
//#define DEBUGV(...) ets_printf(__VA_ARGS__) #ifdef DEBUG_ESP_CORE
#define DEBUGV(...) ets_printf(__VA_ARGS__)
#endif
#ifndef DEBUGV #ifndef DEBUGV
#define DEBUGV(...) #define DEBUGV(...)

View File

@ -18,7 +18,12 @@ extern "C" {
#include "include/UdpContext.h" #include "include/UdpContext.h"
#include <ESP8266mDNS.h> #include <ESP8266mDNS.h>
//#define OTA_DEBUG 1
#ifdef DEBUG_ESP_OTA
#ifdef DEBUG_ESP_PORT
#define OTA_DEBUG DEBUG_ESP_PORT
#endif
#endif
ArduinoOTAClass::ArduinoOTAClass() ArduinoOTAClass::ArduinoOTAClass()
: _port(0) : _port(0)
@ -109,8 +114,8 @@ void ArduinoOTAClass::begin() {
} }
_initialized = true; _initialized = true;
_state = OTA_IDLE; _state = OTA_IDLE;
#if OTA_DEBUG #ifdef OTA_DEBUG
Serial.printf("OTA server at: %s.local:%u\n", _hostname.c_str(), _port); OTA_DEBUG.printf("OTA server at: %s.local:%u\n", _hostname.c_str(), _port);
#endif #endif
} }
@ -226,8 +231,8 @@ void ArduinoOTAClass::_onRx(){
void ArduinoOTAClass::_runUpdate() { void ArduinoOTAClass::_runUpdate() {
if (!Update.begin(_size, _cmd)) { if (!Update.begin(_size, _cmd)) {
#if OTA_DEBUG #ifdef OTA_DEBUG
Serial.println("Update Begin Error"); OTA_DEBUG.println("Update Begin Error");
#endif #endif
if (_error_callback) { if (_error_callback) {
_error_callback(OTA_BEGIN_ERROR); _error_callback(OTA_BEGIN_ERROR);
@ -249,8 +254,8 @@ void ArduinoOTAClass::_runUpdate() {
WiFiClient client; WiFiClient client;
if (!client.connect(_ota_ip, _ota_port)) { if (!client.connect(_ota_ip, _ota_port)) {
#if OTA_DEBUG #ifdef OTA_DEBUG
Serial.printf("Connect Failed\n"); OTA_DEBUG.printf("Connect Failed\n");
#endif #endif
_udp_ota->listen(*IP_ADDR_ANY, _port); _udp_ota->listen(*IP_ADDR_ANY, _port);
if (_error_callback) { if (_error_callback) {
@ -265,8 +270,8 @@ void ArduinoOTAClass::_runUpdate() {
while (!client.available() && waited--) while (!client.available() && waited--)
delay(1); delay(1);
if (!waited){ if (!waited){
#if OTA_DEBUG #ifdef OTA_DEBUG
Serial.printf("Receive Failed\n"); OTA_DEBUG.printf("Receive Failed\n");
#endif #endif
_udp_ota->listen(*IP_ADDR_ANY, _port); _udp_ota->listen(*IP_ADDR_ANY, _port);
if (_error_callback) { if (_error_callback) {
@ -288,8 +293,8 @@ void ArduinoOTAClass::_runUpdate() {
client.print("OK"); client.print("OK");
client.stop(); client.stop();
delay(10); delay(10);
#if OTA_DEBUG #ifdef OTA_DEBUG
Serial.printf("Update Success\nRebooting...\n"); OTA_DEBUG.printf("Update Success\nRebooting...\n");
#endif #endif
if (_end_callback) { if (_end_callback) {
_end_callback(); _end_callback();
@ -301,8 +306,8 @@ void ArduinoOTAClass::_runUpdate() {
_error_callback(OTA_END_ERROR); _error_callback(OTA_END_ERROR);
} }
Update.printError(client); Update.printError(client);
#if OTA_DEBUG #ifdef OTA_DEBUG
Update.printError(Serial); Update.printError(OTA_DEBUG);
#endif #endif
_state = OTA_IDLE; _state = OTA_IDLE;
} }

View File

@ -25,7 +25,11 @@
#ifndef ESP8266HTTPClient_H_ #ifndef ESP8266HTTPClient_H_
#define ESP8266HTTPClient_H_ #define ESP8266HTTPClient_H_
//#define DEBUG_HTTPCLIENT(...) Serial1.printf( __VA_ARGS__ ) #ifdef DEBUG_ESP_HTTP_CLIENT
#ifdef DEBUG_ESP_PORT
#define DEBUG_HTTPCLIENT(...) DEBUG_ESP_PORT.printf( __VA_ARGS__ )
#endif
#endif
#ifndef DEBUG_HTTPCLIENT #ifndef DEBUG_HTTPCLIENT
#define DEBUG_HTTPCLIENT(...) #define DEBUG_HTTPCLIENT(...)

View File

@ -28,8 +28,13 @@
#include "ESP8266WebServer.h" #include "ESP8266WebServer.h"
#include "FS.h" #include "FS.h"
#include "detail/RequestHandlersImpl.h" #include "detail/RequestHandlersImpl.h"
// #define DEBUG
//#define DEBUG_ESP_HTTP_SERVER
#ifdef DEBUG_ESP_PORT
#define DEBUG_OUTPUT DEBUG_ESP_PORT
#else
#define DEBUG_OUTPUT Serial #define DEBUG_OUTPUT Serial
#endif
const char * AUTHORIZATION_HEADER = "Authorization"; const char * AUTHORIZATION_HEADER = "Authorization";
@ -155,7 +160,7 @@ void ESP8266WebServer::handleClient() {
return; return;
} }
#ifdef DEBUG #ifdef DEBUG_ESP_HTTP_SERVER
DEBUG_OUTPUT.println("New client"); DEBUG_OUTPUT.println("New client");
#endif #endif
@ -416,13 +421,13 @@ void ESP8266WebServer::onNotFound(THandlerFunction fn) {
void ESP8266WebServer::_handleRequest() { void ESP8266WebServer::_handleRequest() {
bool handled = false; bool handled = false;
if (!_currentHandler){ if (!_currentHandler){
#ifdef DEBUG #ifdef DEBUG_ESP_HTTP_SERVER
DEBUG_OUTPUT.println("request handler not found"); DEBUG_OUTPUT.println("request handler not found");
#endif #endif
} }
else { else {
handled = _currentHandler->handle(*this, _currentMethod, _currentUri); handled = _currentHandler->handle(*this, _currentMethod, _currentUri);
#ifdef DEBUG #ifdef DEBUG_ESP_HTTP_SERVER
if (!handled) { if (!handled) {
DEBUG_OUTPUT.println("request handler failed to handle request"); DEBUG_OUTPUT.println("request handler failed to handle request");
} }

View File

@ -24,8 +24,12 @@
#include "WiFiClient.h" #include "WiFiClient.h"
#include "ESP8266WebServer.h" #include "ESP8266WebServer.h"
//#define DEBUG //#define DEBUG_ESP_HTTP_SERVER
#ifdef DEBUG_ESP_PORT
#define DEBUG_OUTPUT DEBUG_ESP_PORT
#else
#define DEBUG_OUTPUT Serial #define DEBUG_OUTPUT Serial
#endif
bool ESP8266WebServer::_parseRequest(WiFiClient& client) { bool ESP8266WebServer::_parseRequest(WiFiClient& client) {
// Read the first line of HTTP request // Read the first line of HTTP request
@ -41,7 +45,7 @@ bool ESP8266WebServer::_parseRequest(WiFiClient& client) {
int addr_start = req.indexOf(' '); int addr_start = req.indexOf(' ');
int addr_end = req.indexOf(' ', addr_start + 1); int addr_end = req.indexOf(' ', addr_start + 1);
if (addr_start == -1 || addr_end == -1) { if (addr_start == -1 || addr_end == -1) {
#ifdef DEBUG #ifdef DEBUG_ESP_HTTP_SERVER
DEBUG_OUTPUT.print("Invalid request: "); DEBUG_OUTPUT.print("Invalid request: ");
DEBUG_OUTPUT.println(req); DEBUG_OUTPUT.println(req);
#endif #endif
@ -72,7 +76,7 @@ bool ESP8266WebServer::_parseRequest(WiFiClient& client) {
} }
_currentMethod = method; _currentMethod = method;
#ifdef DEBUG #ifdef DEBUG_ESP_HTTP_SERVER
DEBUG_OUTPUT.print("method: "); DEBUG_OUTPUT.print("method: ");
DEBUG_OUTPUT.print(methodStr); DEBUG_OUTPUT.print(methodStr);
DEBUG_OUTPUT.print(" url: "); DEBUG_OUTPUT.print(" url: ");
@ -111,7 +115,7 @@ bool ESP8266WebServer::_parseRequest(WiFiClient& client) {
headerValue.trim(); headerValue.trim();
_collectHeader(headerName.c_str(),headerValue.c_str()); _collectHeader(headerName.c_str(),headerValue.c_str());
#ifdef DEBUG #ifdef DEBUG_ESP_HTTP_SERVER
DEBUG_OUTPUT.print("headerName: "); DEBUG_OUTPUT.print("headerName: ");
DEBUG_OUTPUT.println(headerName); DEBUG_OUTPUT.println(headerName);
DEBUG_OUTPUT.print("headerValue: "); DEBUG_OUTPUT.print("headerValue: ");
@ -142,7 +146,7 @@ bool ESP8266WebServer::_parseRequest(WiFiClient& client) {
char *plainBuf = (char*)malloc(plainLen+1); char *plainBuf = (char*)malloc(plainLen+1);
client.readBytes(plainBuf, plainLen); client.readBytes(plainBuf, plainLen);
plainBuf[plainLen] = '\0'; plainBuf[plainLen] = '\0';
#ifdef DEBUG #ifdef DEBUG_ESP_HTTP_SERVER
DEBUG_OUTPUT.print("Plain: "); DEBUG_OUTPUT.print("Plain: ");
DEBUG_OUTPUT.println(plainBuf); DEBUG_OUTPUT.println(plainBuf);
#endif #endif
@ -177,7 +181,7 @@ bool ESP8266WebServer::_parseRequest(WiFiClient& client) {
headerValue = req.substring(headerDiv + 2); headerValue = req.substring(headerDiv + 2);
_collectHeader(headerName.c_str(),headerValue.c_str()); _collectHeader(headerName.c_str(),headerValue.c_str());
#ifdef DEBUG #ifdef DEBUG_ESP_HTTP_SERVER
DEBUG_OUTPUT.print("headerName: "); DEBUG_OUTPUT.print("headerName: ");
DEBUG_OUTPUT.println(headerName); DEBUG_OUTPUT.println(headerName);
DEBUG_OUTPUT.print("headerValue: "); DEBUG_OUTPUT.print("headerValue: ");
@ -192,7 +196,7 @@ bool ESP8266WebServer::_parseRequest(WiFiClient& client) {
} }
client.flush(); client.flush();
#ifdef DEBUG #ifdef DEBUG_ESP_HTTP_SERVER
DEBUG_OUTPUT.print("Request: "); DEBUG_OUTPUT.print("Request: ");
DEBUG_OUTPUT.println(url); DEBUG_OUTPUT.println(url);
DEBUG_OUTPUT.print(" Arguments: "); DEBUG_OUTPUT.print(" Arguments: ");
@ -213,7 +217,7 @@ bool ESP8266WebServer::_collectHeader(const char* headerName, const char* header
} }
void ESP8266WebServer::_parseArguments(String data) { void ESP8266WebServer::_parseArguments(String data) {
#ifdef DEBUG #ifdef DEBUG_ESP_HTTP_SERVER
DEBUG_OUTPUT.print("args: "); DEBUG_OUTPUT.print("args: ");
DEBUG_OUTPUT.println(data); DEBUG_OUTPUT.println(data);
#endif #endif
@ -233,7 +237,7 @@ void ESP8266WebServer::_parseArguments(String data) {
++i; ++i;
++_currentArgCount; ++_currentArgCount;
} }
#ifdef DEBUG #ifdef DEBUG_ESP_HTTP_SERVER
DEBUG_OUTPUT.print("args count: "); DEBUG_OUTPUT.print("args count: ");
DEBUG_OUTPUT.println(_currentArgCount); DEBUG_OUTPUT.println(_currentArgCount);
#endif #endif
@ -244,7 +248,7 @@ void ESP8266WebServer::_parseArguments(String data) {
for (iarg = 0; iarg < _currentArgCount;) { for (iarg = 0; iarg < _currentArgCount;) {
int equal_sign_index = data.indexOf('=', pos); int equal_sign_index = data.indexOf('=', pos);
int next_arg_index = data.indexOf('&', pos); int next_arg_index = data.indexOf('&', pos);
#ifdef DEBUG #ifdef DEBUG_ESP_HTTP_SERVER
DEBUG_OUTPUT.print("pos "); DEBUG_OUTPUT.print("pos ");
DEBUG_OUTPUT.print(pos); DEBUG_OUTPUT.print(pos);
DEBUG_OUTPUT.print("=@ "); DEBUG_OUTPUT.print("=@ ");
@ -253,7 +257,7 @@ void ESP8266WebServer::_parseArguments(String data) {
DEBUG_OUTPUT.println(next_arg_index); DEBUG_OUTPUT.println(next_arg_index);
#endif #endif
if ((equal_sign_index == -1) || ((equal_sign_index > next_arg_index) && (next_arg_index != -1))) { if ((equal_sign_index == -1) || ((equal_sign_index > next_arg_index) && (next_arg_index != -1))) {
#ifdef DEBUG #ifdef DEBUG_ESP_HTTP_SERVER
DEBUG_OUTPUT.print("arg missing value: "); DEBUG_OUTPUT.print("arg missing value: ");
DEBUG_OUTPUT.println(iarg); DEBUG_OUTPUT.println(iarg);
#endif #endif
@ -265,7 +269,7 @@ void ESP8266WebServer::_parseArguments(String data) {
RequestArgument& arg = _currentArgs[iarg]; RequestArgument& arg = _currentArgs[iarg];
arg.key = data.substring(pos, equal_sign_index); arg.key = data.substring(pos, equal_sign_index);
arg.value = urlDecode(data.substring(equal_sign_index + 1, next_arg_index)); arg.value = urlDecode(data.substring(equal_sign_index + 1, next_arg_index));
#ifdef DEBUG #ifdef DEBUG_ESP_HTTP_SERVER
DEBUG_OUTPUT.print("arg "); DEBUG_OUTPUT.print("arg ");
DEBUG_OUTPUT.print(iarg); DEBUG_OUTPUT.print(iarg);
DEBUG_OUTPUT.print(" key: "); DEBUG_OUTPUT.print(" key: ");
@ -279,7 +283,7 @@ void ESP8266WebServer::_parseArguments(String data) {
pos = next_arg_index + 1; pos = next_arg_index + 1;
} }
_currentArgCount = iarg; _currentArgCount = iarg;
#ifdef DEBUG #ifdef DEBUG_ESP_HTTP_SERVER
DEBUG_OUTPUT.print("args count: "); DEBUG_OUTPUT.print("args count: ");
DEBUG_OUTPUT.println(_currentArgCount); DEBUG_OUTPUT.println(_currentArgCount);
#endif #endif
@ -308,7 +312,7 @@ uint8_t ESP8266WebServer::_uploadReadByte(WiFiClient& client){
bool ESP8266WebServer::_parseForm(WiFiClient& client, String boundary, uint32_t len){ bool ESP8266WebServer::_parseForm(WiFiClient& client, String boundary, uint32_t len){
#ifdef DEBUG #ifdef DEBUG_ESP_HTTP_SERVER
DEBUG_OUTPUT.print("Parse Form: Boundary: "); DEBUG_OUTPUT.print("Parse Form: Boundary: ");
DEBUG_OUTPUT.print(boundary); DEBUG_OUTPUT.print(boundary);
DEBUG_OUTPUT.print(" Length: "); DEBUG_OUTPUT.print(" Length: ");
@ -346,14 +350,14 @@ bool ESP8266WebServer::_parseForm(WiFiClient& client, String boundary, uint32_t
argFilename = argName.substring(nameStart+2, argName.length() - 1); argFilename = argName.substring(nameStart+2, argName.length() - 1);
argName = argName.substring(0, argName.indexOf('"')); argName = argName.substring(0, argName.indexOf('"'));
argIsFile = true; argIsFile = true;
#ifdef DEBUG #ifdef DEBUG_ESP_HTTP_SERVER
DEBUG_OUTPUT.print("PostArg FileName: "); DEBUG_OUTPUT.print("PostArg FileName: ");
DEBUG_OUTPUT.println(argFilename); DEBUG_OUTPUT.println(argFilename);
#endif #endif
//use GET to set the filename if uploading using blob //use GET to set the filename if uploading using blob
if (argFilename == "blob" && hasArg("filename")) argFilename = arg("filename"); if (argFilename == "blob" && hasArg("filename")) argFilename = arg("filename");
} }
#ifdef DEBUG #ifdef DEBUG_ESP_HTTP_SERVER
DEBUG_OUTPUT.print("PostArg Name: "); DEBUG_OUTPUT.print("PostArg Name: ");
DEBUG_OUTPUT.println(argName); DEBUG_OUTPUT.println(argName);
#endif #endif
@ -366,7 +370,7 @@ bool ESP8266WebServer::_parseForm(WiFiClient& client, String boundary, uint32_t
client.readStringUntil('\r'); client.readStringUntil('\r');
client.readStringUntil('\n'); client.readStringUntil('\n');
} }
#ifdef DEBUG #ifdef DEBUG_ESP_HTTP_SERVER
DEBUG_OUTPUT.print("PostArg Type: "); DEBUG_OUTPUT.print("PostArg Type: ");
DEBUG_OUTPUT.println(argType); DEBUG_OUTPUT.println(argType);
#endif #endif
@ -378,7 +382,7 @@ bool ESP8266WebServer::_parseForm(WiFiClient& client, String boundary, uint32_t
if (argValue.length() > 0) argValue += "\n"; if (argValue.length() > 0) argValue += "\n";
argValue += line; argValue += line;
} }
#ifdef DEBUG #ifdef DEBUG_ESP_HTTP_SERVER
DEBUG_OUTPUT.print("PostArg Value: "); DEBUG_OUTPUT.print("PostArg Value: ");
DEBUG_OUTPUT.println(argValue); DEBUG_OUTPUT.println(argValue);
DEBUG_OUTPUT.println(); DEBUG_OUTPUT.println();
@ -389,7 +393,7 @@ bool ESP8266WebServer::_parseForm(WiFiClient& client, String boundary, uint32_t
arg.value = argValue; arg.value = argValue;
if (line == ("--"+boundary+"--")){ if (line == ("--"+boundary+"--")){
#ifdef DEBUG #ifdef DEBUG_ESP_HTTP_SERVER
DEBUG_OUTPUT.println("Done Parsing POST"); DEBUG_OUTPUT.println("Done Parsing POST");
#endif #endif
break; break;
@ -401,7 +405,7 @@ bool ESP8266WebServer::_parseForm(WiFiClient& client, String boundary, uint32_t
_currentUpload.type = argType; _currentUpload.type = argType;
_currentUpload.totalSize = 0; _currentUpload.totalSize = 0;
_currentUpload.currentSize = 0; _currentUpload.currentSize = 0;
#ifdef DEBUG #ifdef DEBUG_ESP_HTTP_SERVER
DEBUG_OUTPUT.print("Start File: "); DEBUG_OUTPUT.print("Start File: ");
DEBUG_OUTPUT.print(_currentUpload.filename); DEBUG_OUTPUT.print(_currentUpload.filename);
DEBUG_OUTPUT.print(" Type: "); DEBUG_OUTPUT.print(" Type: ");
@ -450,7 +454,7 @@ readfile:
_currentUpload.status = UPLOAD_FILE_END; _currentUpload.status = UPLOAD_FILE_END;
if(_currentHandler && _currentHandler->canUpload(_currentUri)) if(_currentHandler && _currentHandler->canUpload(_currentUri))
_currentHandler->upload(*this, _currentUri, _currentUpload); _currentHandler->upload(*this, _currentUri, _currentUpload);
#ifdef DEBUG #ifdef DEBUG_ESP_HTTP_SERVER
DEBUG_OUTPUT.print("End File: "); DEBUG_OUTPUT.print("End File: ");
DEBUG_OUTPUT.print(_currentUpload.filename); DEBUG_OUTPUT.print(_currentUpload.filename);
DEBUG_OUTPUT.print(" Type: "); DEBUG_OUTPUT.print(" Type: ");
@ -461,7 +465,7 @@ readfile:
line = client.readStringUntil(0x0D); line = client.readStringUntil(0x0D);
client.readStringUntil(0x0A); client.readStringUntil(0x0A);
if (line == "--"){ if (line == "--"){
#ifdef DEBUG #ifdef DEBUG_ESP_HTTP_SERVER
DEBUG_OUTPUT.println("Done Parsing POST"); DEBUG_OUTPUT.println("Done Parsing POST");
#endif #endif
break; break;
@ -507,7 +511,7 @@ readfile:
if (postArgs) delete[] postArgs; if (postArgs) delete[] postArgs;
return true; return true;
} }
#ifdef DEBUG #ifdef DEBUG_ESP_HTTP_SERVER
DEBUG_OUTPUT.print("Error: line: "); DEBUG_OUTPUT.print("Error: line: ");
DEBUG_OUTPUT.println(line); DEBUG_OUTPUT.println(line);
#endif #endif

View File

@ -32,7 +32,11 @@
#undef max #undef max
#include <vector> #include <vector>
//#define DEBUG_WIFI_MULTI(...) Serial1.printf( __VA_ARGS__ ) #ifdef DEBUG_ESP_WIFI
#ifdef DEBUG_ESP_PORT
#define DEBUG_WIFI_MULTI(...) DEBUG_ESP_PORT.printf( __VA_ARGS__ )
#endif
#endif
#ifndef DEBUG_WIFI_MULTI #ifndef DEBUG_WIFI_MULTI
#define DEBUG_WIFI_MULTI(...) #define DEBUG_WIFI_MULTI(...)

View File

@ -41,7 +41,9 @@ extern "C"
#include "include/ClientContext.h" #include "include/ClientContext.h"
#include "c_types.h" #include "c_types.h"
//#define DEBUG_SSL #ifdef DEBUG_ESP_SSL
#define DEBUG_SSL
#endif
#ifdef DEBUG_SSL #ifdef DEBUG_SSL
#define SSL_DEBUG_OPTS SSL_DISPLAY_STATES #define SSL_DEBUG_OPTS SSL_DISPLAY_STATES

View File

@ -32,7 +32,11 @@
#include <WiFiUdp.h> #include <WiFiUdp.h>
#include <ESP8266HTTPClient.h> #include <ESP8266HTTPClient.h>
//#define DEBUG_HTTP_UPDATE(...) Serial1.printf( __VA_ARGS__ ) #ifdef DEBUG_ESP_HTTP_UPDATE
#ifdef DEBUG_ESP_PORT
#define DEBUG_HTTP_UPDATE(...) DEBUG_ESP_PORT.printf( __VA_ARGS__ )
#endif
#endif
#ifndef DEBUG_HTTP_UPDATE #ifndef DEBUG_HTTP_UPDATE
#define DEBUG_HTTP_UPDATE(...) #define DEBUG_HTTP_UPDATE(...)

View File

@ -290,7 +290,8 @@ void MDNSResponder::_parsePacket(){
uint16_t servicePort = 0; uint16_t servicePort = 0;
char protoName[32]; char protoName[32];
uint8_t protoNameLen; protoName[0] = 0;
uint8_t protoNameLen = 0;
uint16_t packetHeader[6]; uint16_t packetHeader[6];
@ -330,7 +331,7 @@ void MDNSResponder::_parsePacket(){
serviceName[serviceNameLen] = '\0'; serviceName[serviceNameLen] = '\0';
if(serviceName[0] == '_'){ if(serviceName[0] == '_'){
memcpy(serviceName, serviceName+1, serviceNameLen); memmove(serviceName, serviceName+1, serviceNameLen);
serviceNameLen--; serviceNameLen--;
serviceParsed = true; serviceParsed = true;
} else if(serviceNameLen == 5 && strcmp("local", serviceName) == 0){ } else if(serviceNameLen == 5 && strcmp("local", serviceName) == 0){
@ -362,7 +363,7 @@ void MDNSResponder::_parsePacket(){
_conn_readS(protoName, protoNameLen); _conn_readS(protoName, protoNameLen);
protoName[protoNameLen] = '\0'; protoName[protoNameLen] = '\0';
if(protoNameLen == 4 && protoName[0] == '_'){ if(protoNameLen == 4 && protoName[0] == '_'){
memcpy(protoName, protoName+1, protoNameLen); memmove(protoName, protoName+1, protoNameLen);
protoNameLen--; protoNameLen--;
protoParsed = true; protoParsed = true;
} else { } else {
@ -494,7 +495,7 @@ void MDNSResponder::_reply(uint8_t replyMask, char * service, char *proto, uint1
size_t hostNameLen = hostName.length(); size_t hostNameLen = hostName.length();
char underscore[] = "_"; char underscore[] = "_";
// build service name with _ // build service name with _
char serviceName[os_strlen(service)+2]; char serviceName[os_strlen(service)+2];
os_strcpy(serviceName,underscore); os_strcpy(serviceName,underscore);

View File

@ -61,13 +61,13 @@ compiler.objcopy.eep.extra_flags=
compiler.elf2hex.extra_flags= compiler.elf2hex.extra_flags=
## Compile c files ## Compile c files
recipe.c.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.cpreprocessor.flags} {compiler.c.flags} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.c.extra_flags} {build.extra_flags} {includes} "{source_file}" -o "{object_file}" recipe.c.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.cpreprocessor.flags} {compiler.c.flags} -DF_CPU={build.f_cpu} {build.debug_port} {build.debug_level} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.c.extra_flags} {build.extra_flags} {includes} "{source_file}" -o "{object_file}"
## Compile c++ files ## Compile c++ files
recipe.cpp.o.pattern="{compiler.path}{compiler.cpp.cmd}" {compiler.cpreprocessor.flags} {compiler.cpp.flags} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.cpp.extra_flags} {build.extra_flags} {includes} "{source_file}" -o "{object_file}" recipe.cpp.o.pattern="{compiler.path}{compiler.cpp.cmd}" {compiler.cpreprocessor.flags} {compiler.cpp.flags} -DF_CPU={build.f_cpu} {build.debug_port} {build.debug_level} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.cpp.extra_flags} {build.extra_flags} {includes} "{source_file}" -o "{object_file}"
## Compile S files ## Compile S files
recipe.S.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.cpreprocessor.flags} {compiler.S.flags} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.c.extra_flags} {build.extra_flags} {includes} "{source_file}" -o "{object_file}" recipe.S.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.cpreprocessor.flags} {compiler.S.flags} -DF_CPU={build.f_cpu} {build.debug_port} {build.debug_level} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.c.extra_flags} {build.extra_flags} {includes} "{source_file}" -o "{object_file}"
## Create archives ## Create archives
recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compiler.ar.extra_flags} "{build.path}/arduino.ar" "{object_file}" recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compiler.ar.extra_flags} "{build.path}/arduino.ar" "{object_file}"