Skip to content

Commit f1eca3f

Browse files
Merge branch 'master' into signedupdates
2 parents 5b243e2 + 92373a9 commit f1eca3f

File tree

87 files changed

+1166
-332
lines changed

Some content is hidden

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

87 files changed

+1166
-332
lines changed

Diff for: README.md

+8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
Arduino core for ESP8266 WiFi chip
22
===========================================
33

4+
# Quick links
5+
6+
- [Latest release documentation](https://arduino-esp8266.readthedocs.io/en/2.4.2/)
7+
- [Current "git version" documentation](https://arduino-esp8266.readthedocs.io/en/latest/)
8+
- [Install git version](https://arduino-esp8266.readthedocs.io/en/latest/installing.html#using-git-version) ([sources](doc/installing.rst#using-git-version))
9+
10+
# Arduino on ESP8266
11+
412
This project brings support for ESP8266 chip to the Arduino environment. It lets you write sketches using familiar Arduino functions and libraries, and run them directly on ESP8266, no external microcontroller required.
513

614
ESP8266 Arduino core comes with libraries to communicate over WiFi using TCP and UDP, set up HTTP, mDNS, SSDP, and DNS servers, do OTA updates, use a file system in flash memory, work with SD cards, servos, SPI and I2C peripherals.

Diff for: cores/esp8266/Arduino.h

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ extern "C" {
3838
#include "esp8266_peri.h"
3939
#include "twi.h"
4040
#include "core_esp8266_features.h"
41+
#include "core_esp8266_version.h"
4142

4243
#define HIGH 0x1
4344
#define LOW 0x0

Diff for: cores/esp8266/Esp-version.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ String EspClass::getFullVersion()
3535
{
3636
return String(F("SDK:")) + system_get_sdk_version()
3737
+ F("/Core:") + FPSTR(arduino_esp8266_git_ver)
38+
+ F("=") + String(esp8266::coreVersionNumeric())
3839
#if LWIP_VERSION_MAJOR == 1
3940
+ F("/lwIP:") + String(LWIP_VERSION_MAJOR) + "." + String(LWIP_VERSION_MINOR) + "." + String(LWIP_VERSION_REVISION)
4041
#if LWIP_VERSION_IS_DEVELOPMENT
@@ -47,9 +48,9 @@ String EspClass::getFullVersion()
4748
+ F("/lwIP:")
4849
#if LWIP_IPV6
4950
+ F("IPv6+")
50-
#endif
51+
#endif // LWIP_IPV6
5152
+ F(LWIP_HASH_STR)
52-
#endif
53+
#endif // LWIP_VERSION_MAJOR != 1
5354
+ FPSTR(bearssl_version)
5455
;
5556
}

Diff for: cores/esp8266/core_esp8266_version.h

+165
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
2+
/*
3+
core_esp8266_version.h - parse "git describe" at compile time
4+
Copyright (c) 2018 david gauchard. All rights reserved.
5+
This file is part of the esp8266 core for Arduino environment.
6+
7+
This library is free software; you can redistribute it and/or
8+
modify it under the terms of the GNU Lesser General Public
9+
License as published by the Free Software Foundation; either
10+
version 2.1 of the License, or (at your option) any later version.
11+
12+
This library is distributed in the hope that it will be useful,
13+
but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15+
Lesser General Public License for more details.
16+
17+
You should have received a copy of the GNU Lesser General Public
18+
License along with this library; if not, write to the Free Software
19+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20+
*/
21+
22+
#ifndef __CORE_ESP8266_VERSION_H
23+
#define __CORE_ESP8266_VERSION_H
24+
25+
#include <core_version.h>
26+
27+
#define STRHELPER(x) #x
28+
#define STR(x) STRHELPER(x)
29+
30+
#ifdef __cplusplus
31+
extern "C++"
32+
{
33+
34+
// Following constexpr functions are compiled and executed
35+
// *after* pre-processing and *during* compilation
36+
//
37+
// Their result is treated like a numeric constant in final binary code.
38+
// git tags must be in the form:
39+
// - <major>.<minor>.<revision> (2.4.2) (2.5.0)
40+
// - <major>.<minor>.<revision>-rc<rc> (2.5.0-rc1) (2.5.0-rc2)
41+
//
42+
// "git describe" = ARDUINO_ESP8266_GIT_DESC will thus be in the form:
43+
// - <tag> (2.4.2) (2.5.0)
44+
// - <tag>-<numberOfCommits>-g<git-hash> (2.4.2-91-gcb05b86d) (2.5.0-rc3-1-gcb05b86d)
45+
//
46+
// Examples:
47+
// case 2.4.2 (fresh version/tag)
48+
// esp8266CoreVersionSubRevision() is 0 Numeric is: 20402000
49+
// case 2.4.2-91-gcb05b86d:
50+
// esp8266CoreVersionSubRevision() is -91 Numeric is: 20402091
51+
// case 2.5.0-rc3-1-gcb05b86d:
52+
// esp8266CoreVersionSubRevision() is 3 Numeric is: 20499903
53+
// case 2.5.0:
54+
// esp8266CoreVersionSubRevision() is 0 Numeric is: 20500000
55+
56+
namespace conststr {
57+
58+
constexpr
59+
bool isDecimal (const char c)
60+
{
61+
return c >= '0' && c <= '9';
62+
}
63+
64+
template<unsigned N> constexpr
65+
bool isMinus (const char (&arr) [N], unsigned i)
66+
{
67+
return arr[i] == '-' && isDecimal(arr[i+1]);
68+
}
69+
70+
template<unsigned N> constexpr
71+
int atoi (const char (&arr) [N], unsigned i)
72+
{
73+
return ({ // <= c++11 requires a "return statement"
74+
int ret = 0;
75+
int sign = 1;
76+
if (arr[i] == '-')
77+
{
78+
sign = -1;
79+
i++;
80+
}
81+
while (isDecimal(arr[i]))
82+
ret = 10*ret + arr[i++] - '0';
83+
ret * sign;
84+
});
85+
}
86+
87+
template<unsigned N> constexpr
88+
int parseNthInteger (const char (&arr) [N], unsigned f)
89+
{
90+
return ({ // <= c++11 requires a "return statement"
91+
unsigned i = 0;
92+
while (f && arr[i])
93+
{
94+
if (isMinus(arr, i))
95+
i++;
96+
for (; isDecimal(arr[i]); i++);
97+
f--;
98+
for (; arr[i] && !isMinus(arr, i) && !isDecimal(arr[i]); i++);
99+
}
100+
atoi(arr, i);
101+
});
102+
}
103+
104+
}; // namespace conststr
105+
106+
namespace esp8266 {
107+
108+
/*
109+
* version major
110+
*/
111+
constexpr
112+
int coreVersionMajor ()
113+
{
114+
return conststr::parseNthInteger(STR(ARDUINO_ESP8266_GIT_DESC), 0);
115+
}
116+
117+
/*
118+
* version minor
119+
*/
120+
constexpr
121+
int coreVersionMinor ()
122+
{
123+
return conststr::parseNthInteger(STR(ARDUINO_ESP8266_GIT_DESC), 1);
124+
}
125+
126+
/*
127+
* version revision
128+
*/
129+
constexpr
130+
int coreVersionRevision ()
131+
{
132+
return conststr::parseNthInteger(STR(ARDUINO_ESP8266_GIT_DESC), 2);
133+
}
134+
135+
/*
136+
* git commit number since last tag (negative)
137+
* or RC-number (positive)
138+
*/
139+
constexpr
140+
int coreVersionSubRevision ()
141+
{
142+
return conststr::parseNthInteger(STR(ARDUINO_ESP8266_GIT_DESC), 3);
143+
}
144+
145+
/*
146+
* unique revision indentifier (never decreases)
147+
*/
148+
constexpr
149+
int coreVersionNumeric ()
150+
{
151+
return coreVersionMajor() * 10000000
152+
+ coreVersionMinor() * 100000
153+
+ coreVersionRevision() * 1000
154+
+ (coreVersionSubRevision() < 0 ?
155+
-coreVersionSubRevision() :
156+
coreVersionSubRevision() ?
157+
coreVersionSubRevision() - 100 :
158+
0);
159+
}
160+
161+
}; // namespace esp8266
162+
163+
} // extern "C++"
164+
#endif // __cplusplus
165+
#endif // __CORE_ESP8266_ESP8266_VERSION_H

Diff for: cores/esp8266/core_version.h

+5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1+
#ifndef ARDUINO_ESP8266_GIT_VER
12
#define ARDUINO_ESP8266_GIT_VER 0x00000000
3+
#endif
4+
5+
#ifndef ARDUINO_ESP8266_GIT_DESC
26
#define ARDUINO_ESP8266_GIT_DESC unspecified
7+
#endif
38

49
// ARDUINO_ESP8266_RELEASE is defined for released versions as a string containing the version name, i.e. "2_3_0_RC1"
510
// ARDUINO_ESP8266_RELEASE is used in the core internally. Please use ESP.getCoreVersion() function instead.

Diff for: libraries/ArduinoOTA/examples/BasicOTA/BasicOTA.ino

+7-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,13 @@
33
#include <WiFiUdp.h>
44
#include <ArduinoOTA.h>
55

6-
const char* ssid = "..........";
7-
const char* password = "..........";
6+
#ifndef STASSID
7+
#define STASSID "your-ssid"
8+
#define STAPSK "your-password"
9+
#endif
10+
11+
const char* ssid = STASSID;
12+
const char* password = STAPSK;
813

914
void setup() {
1015
Serial.begin(115200);

Diff for: libraries/ArduinoOTA/examples/OTALeds/OTALeds.ino

+7-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,13 @@
33
#include <WiFiUdp.h>
44
#include <ArduinoOTA.h>
55

6-
const char* ssid = "...";
7-
const char* password = "...";
6+
#ifndef STASSID
7+
#define STASSID "your-ssid"
8+
#define STAPSK "your-password"
9+
#endif
10+
11+
const char* ssid = STASSID;
12+
const char* password = STAPSK;
813
const char* host = "OTA-LEDS";
914

1015
int led_pin = 13;

Diff for: libraries/DNSServer/examples/CaptivePortalAdvanced/CaptivePortalAdvanced.ino

+7-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,13 @@
1818
*/
1919

2020
/* Set these to your desired softAP credentials. They are not configurable at runtime */
21-
const char *softAP_ssid = "ESP_ap";
22-
const char *softAP_password = "12345678";
21+
#ifndef APSSID
22+
#define APSSID "ESP_ap"
23+
#define APPSK "12345678"
24+
#endif
25+
26+
const char *softAP_ssid = APSSID;
27+
const char *softAP_password = APPSK;
2328

2429
/* hostname for mDNS. Should work at least on windows. Try http://esp8266.local */
2530
const char *myHostname = "esp8266";

Diff for: libraries/ESP8266AVRISP/examples/Arduino_Wifi_AVRISP/Arduino_Wifi_AVRISP.ino

+7-2
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,14 @@
33
#include <ESP8266mDNS.h>
44
#include <ESP8266AVRISP.h>
55

6+
#ifndef STASSID
7+
#define STASSID "your-ssid"
8+
#define STAPSK "your-password"
9+
#endif
10+
611
const char* host = "esp8266-avrisp";
7-
const char* ssid = "**********";
8-
const char* pass = "**********";
12+
const char* ssid = STASSID;
13+
const char* pass = STAPSK;
914
const uint16_t port = 328;
1015
const uint8_t reset_pin = 5;
1116

Diff for: libraries/ESP8266HTTPClient/examples/DigestAuthorization/DigestAuthorization.ino

+7-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,13 @@
1111

1212
#include <ESP8266HTTPClient.h>
1313

14-
const char* ssid = "SSID";
15-
const char* ssidPassword = "PASSWORD";
14+
#ifndef STASSID
15+
#define STASSID "your-ssid"
16+
#define STAPSK "your-password"
17+
#endif
18+
19+
const char* ssid = STASSID;
20+
const char* ssidPassword = STAPSK;
1621

1722
const char *username = "admin";
1823
const char *password = "admin";

0 commit comments

Comments
 (0)