10000 Revert "Allman now (#6080)" (#6090) · freenaut/Arduino@eea9999 · GitHub
[go: up one dir, main page]

Skip to content

Commit eea9999

Browse files
Allman-astylerd-a-v
authored andcommitted
Revert "Allman now (esp8266#6080)" (esp8266#6090)
This reverts commit 98125f8.
1 parent 98125f8 commit eea9999
  • libb64
  • spiffs
  • umm_malloc
  • libraries
  • tests
  • Some content is hidden

    Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

    255 files changed

    +42994
    -51248
    lines changed

    cores/esp8266/AddrList.h

    Lines changed: 52 additions & 121 deletions
    Original file line numberDiff line numberDiff line change
    @@ -1,27 +1,27 @@
    11
    /*
    2-
    AddrList.h - cycle through lwIP netif's ip addresses like a c++ list
    3-
    Copyright (c) 2018 david gauchard. All right reserved.
    4-
    5-
    This library is free software; you can redistribute it and/or
    6-
    modify it under the terms of the GNU Lesser General Public
    7-
    License as published by the Free Software Foundation; either
    8-
    version 2.1 of the License, or (at your option) any later version.
    9-
    10-
    This library is distributed in the hope that it will be useful,
    11-
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    12-
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    13-
    Lesser General Public License for more details.
    14-
    15-
    You should have received a copy of the GNU Lesser General Public
    16-
    License along with this library; if not, write to the Free Software
    17-
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
    18-
    */
    2+
    AddrList.h - cycle through lwIP netif's ip addresses like a c++ list
    3+
    Copyright (c) 2018 david gauchard. All right reserved.
    4+
    5+
    This library is free software; you can redistribute it and/or
    6+
    modify it under the terms of the GNU Lesser General Public
    7+
    License as published by the Free Software Foundation; either
    8+
    version 2.1 of the License, or (at your option) any later version.
    9+
    10+
    This library is distributed in the hope that it will be useful,
    11+
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    12+
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    13+
    Lesser General Public License for more details.
    14+
    15+
    You should have received a copy of the GNU Lesser General Public
    16+
    License along with this library; if not, write to the Free Software
    17+
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
    18+
    */
    1919

    2020
    /*
    21-
    This class allows to explore all configured IP addresses
    22-
    in lwIP netifs, with that kind of c++ loop:
    21+
    This class allows to explore all configured IP addresses
    22+
    in lwIP netifs, with that kind of c++ loop:
    2323
    24-
    for (auto a: addrList)
    24+
    for (auto a: addrList)
    2525
    out.printf("IF='%s' index=%d legacy=%d IPv4=%d local=%d hostname='%s' addr= %s\n",
    2626
    a.iface().c_str(),
    2727
    a.ifnumber(),
    @@ -31,14 +31,14 @@
    3131
    a.hostname().c_str(),
    3232
    a.addr().toString().c_str());
    3333
    34-
    This loop:
    34+
    This loop:
    3535
    3636
    while (WiFi.status() != WL_CONNECTED()) {
    3737
    Serial.print('.');
    3838
    delay(500);
    3939
    }
    4040
    41-
    can be replaced by:
    41+
    can be replaced by:
    4242
    4343
    for (bool configured = false; !configured; ) {
    4444
    for (auto iface: addrList)
    @@ -48,7 +48,7 @@
    4848
    delay(500);
    4949
    }
    5050
    51-
    waiting for an IPv6 global address:
    51+
    waiting for an IPv6 global address:
    5252
    5353
    for (bool configured = false; !configured; ) {
    5454
    for (auto iface: addrList)
    @@ -59,7 +59,7 @@
    5959
    delay(500);
    6060
    }
    6161
    62-
    waiting for an IPv6 global address, on a specific interface:
    62+
    waiting for an IPv6 global address, on a specific interface:
    6363
    6464
    for (bool configured = false; !configured; ) {
    6565
    for (auto iface: addrList)
    @@ -94,8 +94,8 @@ namespace AddressListImplementation
    9494

    9595
    struct netifWrapper
    9696
    {
    97-
    netifWrapper(netif* netif) : _netif(netif), _num(-1) {}
    98-
    netifWrapper(const netifWrapper& o) : _netif(o._netif), _num(o._num) {}
    97+
    netifWrapper (netif* netif) : _netif(netif), _num(-1) {}
    98+
    netifWrapper (const netifWrapper& o) : _netif(o._netif), _num(o._num) {}
    9999

    100100
    netifWrapper& operator= (const netifWrapper& o)
    101101
    {
    @@ -110,64 +110,25 @@ struct netifWrapper
    110110
    }
    111111

    112112
    // address properties
    113-
    IPAddress addr() const
    114-
    {
    115-
    return ipFromNetifNum();
    116-
    }
    117-
    bool isLegacy() const
    118-
    {
    119-
    return _num == 0;
    120-
    }
    121-
    bool isLocal() const
    122-
    {
    123-
    return addr().isLocal();
    124-
    }
    125-
    bool isV4() const
    126-
    {
    127-
    return addr().isV4();
    128-
    }
    129-
    bool isV6() const
    130-
    {
    131-
    return !addr().isV4();
    132-
    }
    133-
    String toString() const
    134-
    {
    135-
    return addr().toString();
    136-
    }
    113+
    IPAddress addr () const { return ipFromNetifNum(); }
    114+
    bool isLegacy () const { return _num == 0; }
    115+
    bool isLocal () const { return addr().isLocal(); }
    116+
    bool isV4 () const { return addr().isV4(); }
    117+
    bool isV6 () const { return !addr().isV4(); }
    118+
    String toString() const { return addr().toString(); }
    137119

    138120
    // related to legacy address (_num=0, ipv4)
    139-
    IPAddress ipv4() const
    140-
    {
    141-
    return _netif->ip_addr;
    142-
    }
    143-
    IPAddress netmask() const
    144-
    {
    145-
    return _netif->netmask;
    146-
    }
    147-
    IPAddress gw() const
    148-
    {
    149-
    return _netif->gw;
    150-
    }
    121+
    IPAddress ipv4 () const { return _netif->ip_addr; }
    122+
    IPAddress netmask () const { return _netif->netmask; }
    123+
    IPAddress gw () const { return _netif->gw; }
    151124

    152125
    // common to all addresses of this interface
    153-
    String ifname() const
    154-
    {
    155-
    return String(_netif->name[0]) + _netif->name[1];
    156-
    }
    157-
    const char* ifhostname() const
    158-
    {
    159-
    return _netif->hostname ? : emptyString.c_str();
    160-
    }
    161-
    const char* ifmac() const
    162-
    {
    163-
    return (const char*)_netif->hwaddr;
    164-
    }
    165-
    int ifnumber() const
    166-
    {
    167-
    return _netif->num;
    168-
    }
    126+
    String ifname () const { return String(_netif->name[0]) + _netif->name[1]; }
    127+
    const char* ifhostname () const { return _netif->hostname?: emptyString.c_str(); }
    128+
    const char* ifmac () const { return (const char*)_netif->hwaddr; }
    129+
    int ifnumber () const { return _netif->num; }
    169130

    170-
    const ip_addr_t* ipFromNetifNum() const
    131+
    const ip_addr_t* ipFromNetifNum () const
    171132
    {
    172133
    #if LWIP_IPV6
    173134
    return _num ? &_netif->ip6_addr[_num - 1] : &_netif->ip_addr;
    @@ -189,8 +150,8 @@ struct netifWrapper
    189150
    class AddressListIterator
    190151
    {
    191152
    public:
    192-
    AddressListIterator(const netifWrapper& o) : netIf(o) {}
    193-
    AddressListIterator(netif* netif) : netIf(netif)
    153+
    AddressListIterator (const netifWrapper& o) : netIf(o) {}
    154+
    AddressListIterator (netif* netif) : netIf(netif)
    194155
    {
    195156
    // This constructor is called with lwIP's global netif_list, or
    196157
    // nullptr. operator++() is designed to loop through _configured_
    @@ -199,29 +160,13 @@ class AddressListIterator
    199160
    (void)operator++();
    200161
    }
    201162

    202-
    const netifWrapper& operator* () const
    203-
    {
    204-
    return netIf;
    205-
    }
    206-
    const netifWrapper* operator-> () const
    207-
    {
    208-
    return &netIf;
    209-
    }
    163+
    const netifWrapper& operator* () const { return netIf; }
    164+
    const netifWrapper* operator-> () const { return &netIf; }
    210165

    211-
    bool operator== (AddressListIterator& o)
    212-
    {
    213-
    return netIf.equal(*o);
    214-
    }
    215-
    bool operator!= (AddressListIterator& o)
    216-
    {
    217-
    return !netIf.equal(*o);
    218-
    }
    166+
    bool operator== (AddressListIterator& o) { return netIf.equal(*o); }
    167+
    bool operator!= (AddressListIterator& o) { return !netIf.equal(*o); }
    219168

    220-
    AddressListIterator& operator= (const AddressListIterator& o)
    221-
    {
    222-
    netIf = o.netIf;
    223-
    return *this;
    224-
    }
    169+
    AddressListIterator& operator= (const AddressListIterator& o) { netIf = o.netIf; return *this; }
    225170

    226171
    AddressListIterator operator++ (int)
    227172
    {
    @@ -243,9 +188,7 @@ class AddressListIterator
    243188
    }
    244189
    if (!ip_addr_isany(netIf.ipFromNetifNum()))
    245190
    // found an initialized address
    246-
    {
    247191
    break;
    248-
    }
    249192
    }
    250193
    return *this;
    251194
    }
    @@ -257,27 +200,15 @@ class AddressListIterator
    257200
    class AddressList
    258201
    {
    259202
    public:
    260-
    using const_iterator = const AddressListIterator;
    203+
    using const_iterator = const AddressListIterator;
    261204

    262-
    const_iterator begin() const
    263-
    {
    264-
    return const_iterator(netif_list);
    265-
    }
    266-
    const_iterator end() const
    267-
    {
    268-
    return const_iterator(nullptr);
    269-
    }
    205+
    const_iterator begin () const { return const_iterator(netif_list); }
    206+
    const_iterator end () const { return const_iterator(nullptr); }
    270207

    271208
    };
    272209

    273-
    inline AddressList::const_iterator begin(const AddressList& a)
    274-
    {
    275-
    return a.begin();
    276-
    }
    277-
    inline AddressList::const_iterator end(const AddressList& a)
    278-
    {
    279-
    return a.end();
    280-
    }
    210+
    inline AddressList::const_iterator begin (const AddressList& a) { return a.begin(); }
    211+
    inline AddressList::const_iterator end (const AddressList& a) { return a.end(); }
    281212

    282213

    283214
    } // AddressListImplementation

    cores/esp8266/Arduino.h

    Lines changed: 19 additions & 20 deletions
    Original file line numberDiff line numberDiff line change
    @@ -1,21 +1,21 @@
    11
    /*
    2-
    Arduino.h - Main include file for the Arduino SDK
    3-
    Copyright (c) 2005-2013 Arduino Team. All right reserved.
    2+
    Arduino.h - Main include file for the Arduino SDK
    3+
    Copyright (c) 2005-2013 Arduino Team. All right reserved.
    44
    5-
    This library is free software; you can redistribute it and/or
    6-
    modify it under the terms of the GNU Lesser General Public
    7-
    License as published by the Free Software Foundation; either
    8-
    version 2.1 of the License, or (at your option) any later version.
    5+
    This library is free software; you can redistribute it and/or
    6+
    modify it under the terms of the GNU Lesser General Public
    7+
    License as published by the Free Software Foundation; either
    8+
    version 2.1 of the License, or (at your option) any later version.
    99
    10-
    This library is distributed in the hope that it will be useful,
    11-
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    12-
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    13-
    Lesser General Public License for more details.
    10+
    This library is distributed in the hope that it will be useful,
    11+
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    12+
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    13+
    Lesser General Public License for more details.
    1414
    15-
    You should have received a copy of the GNU Lesser General Public
    16-
    License along with this library; if not, write to the Free Software
    17-
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
    18-
    */
    15+
    You should have received a copy of the GNU Lesser General Public
    16+
    License along with this library; if not, write to the Free Software
    17+
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
    18+
    */
    1919

    2020
    #ifndef Arduino_h
    2121
    #define Arduino_h
    @@ -86,11 +86,10 @@ extern "C" {
    8686
    #define EXTERNAL 0
    8787

    8888
    //timer dividers
    89-
    enum TIM_DIV_ENUM
    90-
    {
    91-
    TIM_DIV1 = 0, //80MHz (80 ticks/us - 104857.588 us max)
    92-
    TIM_DIV16 = 1, //5MHz (5 ticks/us - 1677721.4 us max)
    93-
    TIM_DIV256 = 3 //312.5Khz (1 tick = 3.2us - 26843542.4 us max)
    89+
    enum TIM_DIV_ENUM {
    90+
    TIM_DIV1 = 0, //80MHz (80 ticks/us - 104857.588 us max)
    91+
    TIM_DIV16 = 1, //5MHz (5 ticks/us - 1677721.4 us max)
    92+
    TIM_DIV256 = 3 //312.5Khz (1 tick = 3.2us - 26843542.4 us max)
    9493
    };
    9594

    9695

    @@ -296,7 +295,7 @@ long secureRandom(long, long);
    296295
    long map(long, long, long, long, long);
    297296

    298297
    extern "C" void configTime(long timezone, int daylightOffset_sec,
    299-
    const char* server1, const char* server2 = nullptr, const char* server3 = nullptr);
    298+
    const char* server1, const char* server2 = nullptr, const char* server3 = nullptr);
    300299

    301300
    #endif
    302301

    0 commit comments

    Comments
     (0)
    0