Skip to content

Commit

Permalink
Merge branch 'master' into lwip2/build-2024_02_03T13_28_00_00
Browse files Browse the repository at this point in the history
  • Loading branch information
mcspr authored Feb 9, 2024
2 parents 69bc8fe + d7d50ff commit 3123a68
Show file tree
Hide file tree
Showing 20 changed files with 71 additions and 101 deletions.
12 changes: 0 additions & 12 deletions .github/workflows/style-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,8 @@ jobs:
with:
python-version: '3.x'
- name: Style check
env:
LLVM_SNAPSHOT_KEY: "6084F3CF814B57C1CF12EFD515CF4D18AF4F7421"
run: |
export GNUPGHOME=$(mktemp -d)
gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$LLVM_SNAPSHOT_KEY"
gpg --batch --armor --export "$LLVM_SNAPSHOT_KEY" | \
sudo tee /etc/apt/trusted.gpg.d/llvm-snapshot.gpg.asc
gpgconf --kill all
rm -r $GNUPGHOME
echo "deb http://apt.llvm.org/focal/ llvm-toolchain-focal-13 main" | \
sudo tee /etc/apt/sources.list.d/llvm.list
sudo apt update
sudo apt install clang-format-13
pip3 install pyyaml
bash ./tests/ci/style_check.sh
# Validate orthography
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
bin/PostServer/PostServer
then put your PC's IP address in SERVER_IP below, port 9080 (instead of default 80):
*/
//#define SERVER_IP "10.0.1.7:9080" // PC address with emulation on host
// #define SERVER_IP "10.0.1.7:9080" // PC address with emulation on host
#define SERVER_IP "192.168.1.42"

#ifndef STASSID
Expand Down
6 changes: 3 additions & 3 deletions libraries/ESP8266WebServer/examples/FSBrowser/FSBrowser.ino
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@

// Select the FileSystem by uncommenting one of the lines below

//#define USE_SPIFFS
// #define USE_SPIFFS
#define USE_LITTLEFS
//#define USE_SDFS
// #define USE_SDFS

// Uncomment the following line to embed a version of the web page in the code
// (program code will be larger, but no file will have to be written to the filesystem).
// Note: the source file "extras/index_htm.h" must have been generated by "extras/reduce_index.sh"

//#define INCLUDE_FALLBACK_INDEX_HTM
// #define INCLUDE_FALLBACK_INDEX_HTM

////////////////////////////////

Expand Down
4 changes: 2 additions & 2 deletions libraries/ESP8266WebServer/examples/Graph/Graph.ino
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@

// Select the FileSystem by uncommenting one of the lines below

//#define USE_SPIFFS
// #define USE_SPIFFS
#define USE_LITTLEFS
//#define USE_SDFS
// #define USE_SDFS

////////////////////////////////

Expand Down
8 changes: 0 additions & 8 deletions libraries/ESP8266WebServer/src/ESP8266WebServer-impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -590,10 +590,6 @@ const String& ESP8266WebServerTemplate<ServerType>::pathArg(unsigned int i) cons

template <typename ServerType>
const String& ESP8266WebServerTemplate<ServerType>::arg(const String& name) const {
for (int j = 0; j < _postArgsLen; ++j) {
if ( _postArgs[j].key == name )
return _postArgs[j].value;
}
for (int i = 0; i < _currentArgCount + _currentArgsHavePlain; ++i) {
if ( _currentArgs[i].key == name )
return _currentArgs[i].value;
Expand Down Expand Up @@ -622,10 +618,6 @@ int ESP8266WebServerTemplate<ServerType>::args() const {

template <typename ServerType>
bool ESP8266WebServerTemplate<ServerType>::hasArg(const String& name) const {
for (int j = 0; j < _postArgsLen; ++j) {
if (_postArgs[j].key == name)
return true;
}
for (int i = 0; i < _currentArgCount + _currentArgsHavePlain; ++i) {
if (_currentArgs[i].key == name)
return true;
Expand Down
4 changes: 1 addition & 3 deletions libraries/ESP8266WebServer/src/ESP8266WebServer.h
Original file line number Diff line number Diff line change
Expand Up @@ -323,8 +323,6 @@ class ESP8266WebServerTemplate
RequestArgument* _currentArgs = nullptr;
int _currentArgsHavePlain = 0;
std::unique_ptr<HTTPUpload> _currentUpload;
int _postArgsLen = 0;
RequestArgument* _postArgs = nullptr;

int _headerKeysCount = 0;
RequestArgument* _currentHeaders = nullptr;
Expand Down Expand Up @@ -352,4 +350,4 @@ class ESP8266WebServerTemplate
using ESP8266WebServer = esp8266webserver::ESP8266WebServerTemplate<WiFiServer>;
using RequestHandler = esp8266webserver::RequestHandler<WiFiServer>;

#endif //ESP8266WEBSERVER_H
#endif //ESP8266WEBSERVER_H
26 changes: 10 additions & 16 deletions libraries/ESP8266WebServer/src/Parsing-impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -358,9 +358,8 @@ bool ESP8266WebServerTemplate<ServerType>::_parseForm(ClientType& client, const
client.readStringUntil('\n');
//start reading the form
if (line == ("--"+boundary)){
if(_postArgs) delete[] _postArgs;
_postArgs = new RequestArgument[WEBSERVER_MAX_POST_ARGS];
_postArgsLen = 0;
std::unique_ptr<RequestArgument[]> postArgs(new RequestArgument[WEBSERVER_MAX_POST_ARGS]);
int postArgsLen = 0;
while(1){
String argName;
String argValue;
Expand Down Expand Up @@ -408,7 +407,7 @@ bool ESP8266WebServerTemplate<ServerType>::_parseForm(ClientType& client, const
}
DBGWS("PostArg Value: %s\n\n", argValue.c_str());

RequestArgument& arg = _postArgs[_postArgsLen++];
RequestArgument& arg = postArgs[postArgsLen++];
arg.key = argName;
arg.value = argValue;

Expand Down Expand Up @@ -488,25 +487,20 @@ bool ESP8266WebServerTemplate<ServerType>::_parseForm(ClientType& client, const
}

int iarg;
int totalArgs = ((WEBSERVER_MAX_POST_ARGS - _postArgsLen) < _currentArgCount)?(WEBSERVER_MAX_POST_ARGS - _postArgsLen):_currentArgCount;
int totalArgs = ((WEBSERVER_MAX_POST_ARGS - postArgsLen) < _currentArgCount)?(WEBSERVER_MAX_POST_ARGS - postArgsLen):_currentArgCount;
for (iarg = 0; iarg < totalArgs; iarg++){
RequestArgument& arg = _postArgs[_postArgsLen++];
RequestArgument& arg = postArgs[postArgsLen++];
arg.key = _currentArgs[iarg].key;
arg.value = _currentArgs[iarg].value;
}
if (_currentArgs) delete[] _currentArgs;
_currentArgs = new RequestArgument[_postArgsLen];
for (iarg = 0; iarg < _postArgsLen; iarg++){
delete[] _currentArgs;
_currentArgs = new RequestArgument[postArgsLen];
for (iarg = 0; iarg < postArgsLen; iarg++){
RequestArgument& arg = _currentArgs[iarg];
arg.key = _postArgs[iarg].key;
arg.value = _postArgs[iarg].value;
arg.key = postArgs[iarg].key;
arg.value = postArgs[iarg].value;
}
_currentArgCount = iarg;
if (_postArgs) {
delete[] _postArgs;
_postArgs = nullptr;
_postArgsLen = 0;
}
return true;
}
DBGWS("Error: line: %s\n", line.c_str());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const char *pass = STAPSK;
// The HTTPS server
BearSSL::WiFiServerSecure server(443);

//#define USE_EC // Enable Elliptic Curve signed cert
// #define USE_EC // Enable Elliptic Curve signed cert

#define USING_INSECURE_CERTS_AND_KEYS_AND_CAS 1
#include <ssl-tls-ca-key-cert-example.h>
Expand All @@ -58,7 +58,7 @@ BearSSL::WiFiServerSecure server(443);
// Caching SSL sessions shortens the length of the SSL handshake.
// You can see the performance improvement by looking at the
// Network tab of the developer tools of your browser.
//#define DYNAMIC_CACHE // Whether to dynamically allocate the cache.
// #define DYNAMIC_CACHE // Whether to dynamically allocate the cache.

#if defined(USE_CACHE) && defined(DYNAMIC_CACHE)
// Dynamically allocated cache.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

/*
SWAP_PINS:
0: use Serial1 for logging (legacy example)
0: use Serial1 for logging
1: configure Hardware Serial port on RX:GPIO13 TX:GPIO15
and use EspSoftwareSerial for logging on
standard Serial pins RX:GPIO3 and TX:GPIO1
Expand Down Expand Up @@ -90,6 +90,8 @@ void setup() {
logger->enableIntTx(false);
logger->println("\n\nUsing EspSoftwareSerial for logging");
#else
// Hardware serial0 is on RX(3)/TX(1)
// Hardware serial1 is on (no RX)/TX(2)
logger->begin(BAUD_LOGGER);
logger->println("\n\nUsing Serial1 for logging");
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const char *ap_default_psk = APPSK; ///< Default PSK.
/// @}

/// Uncomment the next line for verbose output over UART.
//#define SERIAL_VERBOSE
// #define SERIAL_VERBOSE

/**
@brief Read WiFi connection information from file system.
Expand Down
4 changes: 2 additions & 2 deletions libraries/LittleFS/examples/SpeedTest/SpeedTest.ino
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
// WARNING: The filesystem will be formatted at the start of the test!

#define TESTFS LittleFS
//#define TESTFS SPIFFS
//#define TESTFS SDFS
// #define TESTFS SPIFFS
// #define TESTFS SDFS

// How large of a file to test
#define TESTSIZEKB 512
Expand Down
2 changes: 1 addition & 1 deletion libraries/Netdump/examples/Netdump/Netdump.ino
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>
#include <ESP8266mDNS.h>
//#include <FS.h>
// #include <FS.h>
#include <LittleFS.h>
#include <map>

Expand Down
8 changes: 4 additions & 4 deletions libraries/esp8266/examples/LowPowerDemo/LowPowerDemo.ino
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
#include <PolledTimeout.h>
#include <include/WiFiState.h> // WiFiState structure details

//#define DEBUG // prints WiFi connection info to serial, uncomment if you want WiFi messages
// #define DEBUG // prints WiFi connection info to serial, uncomment if you want WiFi messages
#ifdef DEBUG
#define DEBUG_PRINTLN(x) Serial.println(x)
#define DEBUG_PRINT(x) Serial.print(x)
Expand All @@ -56,8 +56,8 @@

// uncomment one of the two lines below for your LED connection (optional)
#define LED 5 // D1/GPIO5 external LED for modules with built-in LEDs so it doesn't add amperage
//#define LED 2 // D4/GPIO2 LED for ESP-01,07 modules; D4 is LED_BUILTIN on most other modules
// you can use LED_BUILTIN, but it adds to the measured amperage by 0.3mA to 6mA.
// #define LED 2 // D4/GPIO2 LED for ESP-01,07 modules; D4 is LED_BUILTIN on most other modules
// you can use LED_BUILTIN, but it adds to the measured amperage by 0.3mA to 6mA.

ADC_MODE(ADC_VCC); // allows you to monitor the internal VCC level; it varies with WiFi load
// don't connect anything to the analog input pin(s)!
Expand All @@ -72,7 +72,7 @@ IPAddress dns1(0, 0, 0, 0);
IPAddress dns2(0, 0, 0, 0);
uint32_t timeout = 30E3; // 30 second timeout on the WiFi connection

//#define TESTPOINT // used to track the timing of several test cycles (optional)
// #define TESTPOINT // used to track the timing of several test cycles (optional)
#ifdef TESTPOINT
#define testPointPin 4 // D2/GPIO4, you can use any pin that supports interrupts
#define testPoint_HIGH digitalWrite(testPointPin, HIGH)
Expand Down
4 changes: 2 additions & 2 deletions libraries/esp8266/examples/NTP-TZ-DST/NTP-TZ-DST.ino
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@
// check for your nearest city in TZ.h

// espressif headquarter TZ
//#define MYTZ TZ_Asia_Shanghai
// #define MYTZ TZ_Asia_Shanghai

// example for "Not Only Whole Hours" timezones:
// Kolkata/Calcutta is shifted by 30mn
//#define MYTZ TZ_Asia_Kolkata
// #define MYTZ TZ_Asia_Kolkata

// example of a timezone with a variable Daylight-Saving-Time:
// demo: watch automatic time adjustment on Summer/Winter change (DST)
Expand Down
44 changes: 22 additions & 22 deletions libraries/esp8266/examples/SerialStress/SerialStress.ino
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@

/*
Serial read/write/verify/benchmark
Using internal loopback
Using EspSoftwareSerial library for logging
Using Serial0 for internal loopback
Using Serial1 for logging
Sketch meant for debugging only
Released to public domain
*/

#include <ESP8266WiFi.h>
#include <SoftwareSerial.h>

#define SSBAUD 115200 // logger on console for humans
#define LOGBAUD 115200 // logger on console for humans
#define BAUD 3000000 // hardware serial stress test
#define BUFFER_SIZE 4096 // may be useless to use more than 2*SERIAL_SIZE_RX
#define SERIAL_SIZE_RX 1024 // Serial.setRxBufferSize()
Expand All @@ -21,6 +20,9 @@
#define TIMEOUT 5000
#define DEBUG(x...) // x

#define READING_PIN 4
#define TIMEOUT_PIN 5

uint8_t buf[BUFFER_SIZE];
uint8_t temp[BUFFER_SIZE];
bool reading = true;
Expand Down Expand Up @@ -51,18 +53,18 @@ void error(const char* what) {
void setup() {
pinMode(LED_BUILTIN, OUTPUT);

pinMode(READING_PIN, INPUT);
pinMode(TIMEOUT_PIN, INPUT);

Serial.begin(BAUD);
Serial.swap(); // RX=GPIO13 TX=GPIO15
Serial.setRxBufferSize(SERIAL_SIZE_RX);

// using HardwareSerial0 pins,
// so we can still log to the regular usbserial chips
SoftwareSerial* ss = new SoftwareSerial(3, 1);
ss->begin(SSBAUD);
ss->enableIntTx(false);
logger = ss;
Serial1.begin(LOGBAUD); // RX=NONE TX=GPIO2
logger = &Serial1;

logger->println();
logger->printf("\n\nOn Software Serial for logging\n");
logger->printf("\n\nOn Serial1 for logging\n");

int baud = Serial.baudRate();
logger->printf(ESP.getFullVersion().c_str());
Expand Down Expand Up @@ -140,15 +142,13 @@ void loop() {
timeout = (last_ms = now_ms) + TIMEOUT;
}

if (logger->available()) switch (logger->read()) {
case 's':
logger->println("now stopping reading, keeping writing");
reading = false;
break;
case 't':
testReadBytesTimeout ^= FAKE_INCREASED_AVAILABLE;
logger->printf("testing readBytes timeout: %d\n", !!testReadBytesTimeout);
break;
default:;
}
if (reading && (digitalRead(READING_PIN) == 0)) {
logger->println("now stopping reading, keeping writing");
reading = false;
}

if (digitalRead(TIMEOUT_PIN) == 0) {
testReadBytesTimeout ^= FAKE_INCREASED_AVAILABLE;
logger->printf("testing readBytes timeout: %d\n", !!testReadBytesTimeout);
}
}
4 changes: 2 additions & 2 deletions libraries/esp8266/examples/TestEspApi/TestEspApi.ino
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ extern "C" {
}
#endif

// Set up output serial port (could be a SoftwareSerial
// if really wanted).
// Set up output on the first serial port
// (can be any Stream, if needed)

Stream& ehConsolePort(Serial);

Expand Down
8 changes: 4 additions & 4 deletions libraries/lwIP_PPP/examples/PPPServer/PPPServer.ino
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#include <lwip/dns.h>
#include <PPPServer.h>
#include <ESP8266WiFi.h>
#include <SoftwareSerial.h>

#ifndef STASSID
#define STASSID "your-ssid"
Expand All @@ -36,8 +35,8 @@
#define RX 13 // d1mini D7
#define TX 15 // d1mini D8

SoftwareSerial ppplink(RX, TX);
HardwareSerial& logger = Serial;
HardwareSerial& ppplink = Serial;
HardwareSerial& logger = Serial1;
PPPServer ppp(&ppplink);

void PPPConnectedCallback(netif* nif) {
Expand Down Expand Up @@ -74,7 +73,8 @@ void setup() {
logger.printf("\nSTA: %s (dns: %s / %s)\n", WiFi.localIP().toString().c_str(), WiFi.dnsIP(0).toString().c_str(), WiFi.dnsIP(1).toString().c_str());

ppplink.begin(PPPLINKBAUD);
ppplink.enableIntTx(true);
ppplink.swap(); // RX=GPIO13 TX=GPIO15

logger.println();
logger.printf("\n\nhey, trying to be a PPP server here\n\n");
logger.printf("Now try this on your linux host:\n\n");
Expand Down
4 changes: 3 additions & 1 deletion libraries/lwIP_enc28j60/src/utility/enc28j60.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,9 @@ bool ENC28J60::reset(void)

/* Wait for OST */
PRINTF("waiting for ESTAT_CLKRDY\n");
while ((readreg(ESTAT) & ESTAT_CLKRDY) == 0) { };
while ((readreg(ESTAT) & ESTAT_CLKRDY) == 0)
{
};
PRINTF("ESTAT_CLKRDY\n");

setregbank(ERXTX_BANK);
Expand Down
Loading

0 comments on commit 3123a68

Please sign in to comment.