8000 Merge branch 'master' into pr-hwdt-stack-dump · esp8266/Arduino@32737bb · GitHub
[go: up one dir, main page]

Skip to content

Commit 32737bb

Browse files
authored
Merge branch 'master' into pr-hwdt-stack-dump
2 parents e8bf3f0 + d600cc7 commit 32737bb

File tree

6 files changed

+59
-16
lines changed
  • libraries/ESP8266WebServer
  • tools
  • 6 files changed

    +59
    -16
    lines changed

    cores/esp8266/Tone.cpp

    Lines changed: 2 additions & 2 deletions
    Original file line numberDiff line numberDiff line change
    @@ -35,8 +35,8 @@ static void _startTone(uint8_t _pin, uint32_t high, uint32_t low, unsigned long
    3535

    3636
    pinMode(_pin, OUTPUT);
    3737

    38-
    high = std::max(high, (uint32_t)100);
    39-
    low = std::max(low, (uint32_t)100);
    38+
    high = std::max(high, (uint32_t)25); // new 20KHz maximum tone frequency,
    39+
    low = std::max(low, (uint32_t)25); // (25us high + 25us low period = 20KHz)
    4040

    4141
    if (startWaveform(_pin, high, low, (uint32_t) duration * 1000)) {
    4242
    _toneMap |= 1 << _pin;

    cores/esp8266/core_esp8266_wiring_digital.cpp

    Lines changed: 3 additions & 6 deletions
    Original file line numberDiff line numberDiff line change
    @@ -236,12 +236,9 @@ extern void __attachInterrupt(uint8_t pin, voidFuncPtr userFunc, int mode)
    236236
    }
    237237

    238238
    extern void __resetPins() {
    239-
    for (int i = 0; i <= 5; ++i) {
    240-
    pinMode(i, INPUT);
    241-
    }
    242-
    // pins 6-11 are used for the SPI flash interface
    243-
    for (int i = 12; i <= 16; ++i) {
    244-
    pinMode(i, INPUT);
    239+
    for (int i = 0; i <= 16; ++i) {
    240+
    if (!isFlashInterfacePin(i))
    241+
    pinMode(i, INPUT);
    245242
    }
    246243
    }
    247244

    libraries/ESP8266WebServer/examples/FSBrowser/FSBrowser.ino

    Lines changed: 22 additions & 5 deletions
    Original file line numberDiff line numberDiff line change
    @@ -186,12 +186,27 @@ void handleFileList() {
    186186
    Dir dir = filesystem->openDir(path);
    187187
    path.clear();
    188188

    189-
    String output = "[";
    189+
    // use HTTP/1.1 Chunked response to avoid building a huge temporary string
    190+
    if (!server.chunkedResponseModeStart(200, "text/json")) {
    191+
    server.send(505, FPSTR("text/html"), FPSTR("HTTP1.1 required"));
    192+
    return;
    193+
    }
    194+
    195+
    // use the same string for every line
    196+
    String output;
    197+
    output.reserve(64);
    190198
    while (dir.next()) {
    191-
    File entry = dir.openFile("r");
    192-
    if (output != "[") {
    193-
    output += ',';
    199+
    200+
    if (output.length()) {
    201+
    // send string from previous iteration
    202+
    // as an HTTP chunk
    203+
    server.sendContent(output);
    204+
    output = ',';
    205+
    } else {
    206+
    output = '[';
    194207
    }
    208+
    209+
    File entry = dir.openFile("r");
    195210
    bool isDir = false;
    196211
    output += "{\"< E864 /span>type\":\"";
    197212
    output += (isDir) ? "dir" : "file";
    @@ -205,8 +220,10 @@ void handleFileList() {
    205220
    entry.close();
    206221
    }
    207222

    223+
    // send last string
    208224
    output += "]";
    209-
    server.send(200, "text/json", output);
    225+
    server.sendContent(output);
    226+
    server.chunkedResponseFinalize();
    210227
    }
    211228

    212229
    void setup(void) {

    libraries/ESP8266WebServer/src/ESP8266WebServer.h

    Lines changed: 20 additions & 2 deletions
    Original file line numberDiff line numberDiff line change
    @@ -149,18 +149,36 @@ class ESP8266WebServerTemplate
    149149
    void sendContent(const char *content) { sendContent_P(content); }
    150150
    void sendContent(const char *content, size_t size) { sendContent_P(content, size); }
    151151

    152+
    bool chunkedResponseModeStart_P (int code, PGM_P content_type) {
    153+
    if (_currentVersion == 0)
    154+
    // no chunk mode in HTTP/1.0
    155+
    return false;
    156+
    setContentLength(CONTENT_LENGTH_UNKNOWN);
    157+
    send_P(code, content_type, "");
    158+
    return true;
    159+
    }
    160+
    bool chunkedResponseModeStart (int code, const char* content_type) {
    161+
    return chunkedResponseModeStart_P(code, content_type);
    162+
    }
    163+
    bool chunkedResponseModeStart (int code, const String& content_type) {
    164+
    return chunkedResponseModeStart_P(code, content_type.c_str());
    165+
    }
    166+
    void chunkedResponseFinalize () {
    167+
    sendContent(emptyString);
    168+
    }
    169+
    152170
    static String credentialHash(const String& username, const String& realm, const String& password);
    153171

    154172
    static String urlDecode(const String& text);
    155173

    156-
    // Handle a GET request by sending a response header and stream file content to response body
    174+
    // Handle a GET request by sending a response header and stream file content to response body
    157175
    template<typename T>
    158176
    size_t streamFile(T &file, const String& contentType) {
    159177
    return streamFile(file, contentType, HTTP_GET);
    160178
    }
    161179

    162180
    // Implement GET and HEAD requests for files.
    163-
    // Stream body on HTTP_GET but not on HTTP_HEAD requests.
    181+
    // Stream body on HTTP_GET but not on HTTP_HEAD requests.
    164182
    template<typename T>
    165183
    size_t streamFile(T &file, const String& contentType, HTTPMethod requestMethod) {
    166184
    size_t contentLength = 0;

    tools/platformio-build.py

    Lines changed: 4 additions & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -247,9 +247,12 @@ def scons_patched_match_splitext(path, suffixes=None):
    247247
    #
    248248

    249249
    current_vtables = None
    250+
    fp_in_irom = ""
    250251
    for d in flatten_cppdefines:
    251252
    if str(d).startswith("VTABLES_IN_"):
    252253
    current_vtables = d
    254+
    if str(d) == "FP_IN_IROM":
    255+
    fp_in_irom = "-DFP_IN_IROM"
    253256
    if not current_vtables:
    254257
    current_vtables = "VTABLES_IN_FLASH"
    255258
    env.Append(CPPDEFINES=[current_vtables])
    @@ -260,7 +263,7 @@ def scons_patched_match_splitext(path, suffixes=None):
    260263
    join("$BUILD_DIR", "ld", "local.eagle.app.v6.common.ld"),
    261264
    join(FRAMEWORK_DIR, "tools", "sdk", "ld", "eagle.app.v6.common.ld.h"),
    262265
    env.VerboseAction(
    263-
    "$CC -CC -E -P -D%s $SOURCE -o $TARGET" % current_vtables,
    266+
    "$CC -CC -E -P -D%s %s $SOURCE -o $TARGET" % (current_vtables, fp_in_irom),
    264267
    "Generating LD script $TARGET"))
    265268
    env.Depends("$BUILD_DIR/$PROGNAME$PROGSUFFIX", app_ld)
    266269

    tools/sdk/ld/eagle.app.v6.common.ld.h

    Lines changed: 8 additions & 0 deletions
    Original file line numberDiff line numberDiff line change
    @@ -151,6 +151,14 @@ SECTIONS
    151151

    152152
    *libc.a:(.literal .text .literal.* .text.*)
    153153
    *libm.a:(.literal .text .literal.* .text.*)
    154+
    #ifdef FP_IN_IROM
    155+
    *libgcc.a:*f2.o(.literal .text)
    156+
    *libgcc.a:*f3.o(.literal .text)
    157+
    *libgcc.a:*fsi.o(.literal .text)
    158+
    *libgcc.a:*fdi.o(.literal .text)
    159+
    *libgcc.a:*ifs.o(.literal .text)
    160+
    *libgcc.a:*idf.o(.literal .text)
    161+
    #endif
    154162
    *libgcc.a:_umoddi3.o(.literal .text)
    155163
    *libgcc.a:_udivdi3.o(.literal .text)
    156164
    *libstdc++.a:( .literal .text .literal.* .text.*)

    0 commit comments

    Comments
     (0)
    0