1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-08-18 17:42:23 +03:00

WiFi Mesh Update 2.1 (#5157)

* - Add assert in HelloMesh.ino for invalid transmission status.
- Make uint64ToString and stringToUint64 methods into stand-alone type conversion functions.
- Add getters and setters for requestHandler and responseHandler.
- Polish HelloMesh.ino code by adding networkIndex as networkFilter loop variable and switching networkFilter definition position.
- Add initial WiFi.disconnect() in HelloMesh.ino setup() function to ensure smooth WiFi operation.
- Add latestTransmissionSuccessful() convenience method.
- Change default WiFi mode to WIFI_STA and improve handling of WiFi mode (fixes issue #5071).
- Add checks to methods that change AP properties to avoid unnecessary AP restarts.
- Add getter for ESP8266WiFiMesh SSID and getters and setters for ESP8266WiFiMesh settings related to hidden SSID usage, max station connections allowed per AP and WiFi timeouts.
- Make waitForClientTransmission method use more accurate timekeeping.
- Improve type usage.
- Improve comments.
- Update README.md, keywords.txt and library.properties.

* Make getter and setter order consistent throughout code.

* - Fix active AP getting turned off when calling begin().
- Fix crash bug due to WiFiServer duplication when using the ESP8266WiFiMesh copy constructor with the AP controller as argument, under certain circumstances.

* - Move non performance-sensitive Strings to flash memory to save RAM.

- Add comments explaining F(), FPSTR() and PROGMEM.

- Fix README.md formatting.

* Remove the uint64ToString and stringToUint64 methods from the ESP8266WiFiMesh class since they are now stand-alone functions in the TypeConversionFunctions files.

* Change the minimum valid argument value of the setMaxAPStations method to 0, since this value is also supported by the ESP8266.

* Fix compiler warning.
This commit is contained in:
aerlon
2018-09-24 21:11:09 +02:00
committed by Develo
parent d8a7a34caf
commit 88bd26bd74
9 changed files with 458 additions and 175 deletions

View File

@@ -23,8 +23,8 @@
* THE SOFTWARE.
*/
#include "TypeConversionFunctions.h"
#include "ESP8266WiFiMesh.h"
#include <assert.h>
void ESP8266WiFiMesh::verboseModePrint(const String &stringToPrint, bool newline)
{
@@ -37,52 +37,6 @@ void ESP8266WiFiMesh::verboseModePrint(const String &stringToPrint, bool newline
}
}
/**
* Note that using a base higher than 16 increases likelihood of randomly generating SSID strings containing controversial words.
*
* @param number The number to convert to a string with radix "base".
* @param base The radix to convert "number" into. Must be between 2 and 36.
* @returns A string of "number" encoded in radix "base".
*/
String ESP8266WiFiMesh::uint64ToString(uint64_t number, byte base)
{
assert(2 <= base && base <= 36);
String result = "";
while(number > 0)
{
result = String((uint32_t)(number % base), base) + result;
number /= base;
}
return (result == "" ? "0" : result);
}
/**
* Note that using a base higher than 16 increases likelihood of randomly generating SSID strings containing controversial words.
*
* @param string The string to convert to uint64_t. String must use radix "base".
* @param base The radix of "string". Must be between 2 and 36.
* @returns A uint64_t of the string, using radix "base" during decoding.
*/
uint64_t ESP8266WiFiMesh::stringToUint64(const String &string, byte base)
{
assert(2 <= base && base <= 36);
uint64_t result = 0;
char currentCharacter[1];
for(uint32_t i = 0; i < string.length(); i++)
{
result *= base;
currentCharacter[0] = string.charAt(i);
result += strtoul(currentCharacter, NULL, base);
}
return result;
}
/**
* Calculate the current lwIP version number and store the numbers in the _lwipVersion array.
* lwIP version can be changed in the "Tools" menu of Arduino IDE.