iotappstory / ESP-Library

Software Distribution and Management Over the Air
GNU Lesser General Public License v2.1
124 stars 35 forks source link

PlatformIO errors on pins the specific board is missing #75

Closed Bolukan closed 6 years ago

Bolukan commented 6 years ago

Compiling on PlatformIO for the WeMos D1 R2 & mini the compiler errors on

#elif defined ESP8266_WEMOS_D1MINI || defined ESP8266_WEMOS_D1MINILITE || defined ESP8266_WEMOS_D1MINIPRO || defined ESP8266_NODEMCU || defined WIFINFO

        // DEBUG_PRINTLN("- Special ESP's -");
        if      (orgVal == "D0"  || orgVal == "16")   return D0;
        else if (orgVal == "D1"  || orgVal == "5")    return D1;
        else if (orgVal == "D2"  || orgVal == "4")    return D2;
        else if (orgVal == "D3"  || orgVal == "0")    return D3;
        else if (orgVal == "D4"  || orgVal == "2")    return D4;
        else if (orgVal == "D5"  || orgVal == "14")   return D5;
        else if (orgVal == "D6"  || orgVal == "12")   return D6;
        else if (orgVal == "D7"  || orgVal == "13")   return D7;
        else if (orgVal == "D8"  || orgVal == "15")   return D8;
        else if (orgVal == "D9"  || orgVal == "3")    return D9;
        else if (orgVal == "D10" || orgVal == "1")    return D10;
        else                                          return D0;

Lines 1003-1017 as D9 and D10 are not defined for this board. (but called RX and TX).

Not knowing the function of this code, maybe this is not a good solution, but I propose to consider return 3 and 1 in stead?

Onno-Dirkzwager commented 6 years ago

We never had compile errors while testing in Arduino IDE but you are right.

As you migh have noticed this function is also used in case of the nodemcu and wifinfo that do have D9 and D10

So we will have to split this up.

As for why we have this basterd of a function check [this](https://iotappstory.com/wiki/arduino-esp/library-api-20/api-methods/dpinconv()) wiki page.

Bolukan commented 6 years ago

Yeah, found the source code of the definition of the pins available for the compiler:

For variant "d1_mini", as the "WeMos D1 R2 & mini", "WeMos D1 mini Lite" and "WeMos D1 mini Pro": https://github.com/esp8266/Arduino/blob/master/variants/d1_mini/pins_arduino.h

and variant "d1" as the "WEMOS D1 R1 (Retired)": https://github.com/esp8266/Arduino/blob/master/variants/d1/pins_arduino.h

(edit: post crossed the above)

Onno-Dirkzwager commented 6 years ago

Closing as you already Pull requested a solutions.