Skip to content

Commit 3132325

Browse files
committed
- Replace Crypto files with CryptoInterface which uses BearSSL as a cryptographic backend.
- Move cryptographic functions from JsonTranslator to CryptoInterface. - Make AP activation separate from FloodingMesh::begin(). - Fix English bug. - Improve comments.
1 parent afc88f2 commit 3132325

15 files changed

+353
-1363
lines changed

libraries/ESP8266WiFiMesh/examples/HelloEspnow/HelloEspnow.ino

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -242,14 +242,14 @@ void setup() {
242242

243243
int32_t timeOfLastScan = -10000;
244244
void loop() {
245-
// The performEspnowMaintainance() method performs all the background operations for the EspnowMeshBackend.
245+
// The performEspnowMaintenance() method performs all the background operations for the EspnowMeshBackend.
246246
// It is recommended to place it in the beginning of the loop(), unless there is a need to put it elsewhere.
247247
// Among other things, the method cleans up old Espnow log entries (freeing up RAM) and sends the responses you provide to Espnow requests.
248248
// Note that depending on the amount of responses to send and their length, this method can take tens or even hundreds of milliseconds to complete.
249-
// More intense transmission activity and less frequent calls to performEspnowMaintainance will likely cause the method to take longer to complete, so plan accordingly.
249+
// More intense transmission activity and less frequent calls to performEspnowMaintenance will likely cause the method to take longer to complete, so plan accordingly.
250250

251-
//Should not be used inside responseHandler, requestHandler, networkFilter or broadcastFilter callbacks since performEspnowMaintainance() can alter the ESP-NOW state.
252-
EspnowMeshBackend::performEspnowMaintainance();
251+
//Should not be used inside responseHandler, requestHandler, networkFilter or broadcastFilter callbacks since performEspnowMaintenance() can alter the ESP-NOW state.
252+
EspnowMeshBackend::performEspnowMaintenance();
253253

254254
if (millis() - timeOfLastScan > 10000) { // Give other nodes some time to connect between data transfers.
255255
Serial.println("\nPerforming unencrypted ESP-NOW transmissions.");
@@ -260,8 +260,8 @@ void loop() {
260260

261261
timeOfLastScan = millis();
262262

263-
// Wait for response. espnowDelay continuously calls performEspnowMaintainance() so we will respond to ESP-NOW request while waiting.
264-
// Should not be used inside responseHandler, requestHandler, networkFilter or broadcastFilter callbacks since performEspnowMaintainance() can alter the ESP-NOW state.
263+
// Wait for response. espnowDelay continuously calls performEspnowMaintenance() so we will respond to ESP-NOW request while waiting.
264+
// Should not be used inside responseHandler, requestHandler, networkFilter or broadcastFilter callbacks since performEspnowMaintenance() can alter the ESP-NOW state.
265265
espnowDelay(100);
266266

267267
// One way to check how attemptTransmission worked out

libraries/ESP8266WiFiMesh/examples/HelloMesh/HelloMesh.ino

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
/**
2+
This example makes every node broadcast their AP MAC to the rest of the network during the first 28 seconds, as long as the node thinks it has the highest AP MAC in the network.
3+
Once 28 seconds have passed, the node that has the highest AP MAC will start broadcasting benchmark messages, which will allow you to see how many messages are lost at the other nodes.
4+
If you have an onboard LED on your ESP8266 it is recommended that you change the useLED variable below to true.
5+
That way you will get instant confirmation of the mesh communication without checking the Serial Monitor.
6+
*/
7+
18
#include <ESP8266WiFi.h>
29
#include <TypeConversionFunctions.h>
310
#include <assert.h>
@@ -63,7 +70,7 @@ bool meshMessageHandler(String &message, FloodingMesh &meshInstance) {
6370

6471
if (useLED && !theOne) {
6572
bool ledState = message.charAt(1) == '1';
66-
digitalWrite(LED_BUILTIN, ledState); // Turn LED on/off (LED is active low)
73+
digitalWrite(LED_BUILTIN, ledState); // Turn LED on/off (LED_BUILTIN is active low)
6774
}
6875

6976
return true;
@@ -128,13 +135,14 @@ void setup() {
128135
Serial.println(F("Setting up mesh node..."));
129136

130137
floodingMesh.begin();
138+
floodingMesh.activateAP();
131139

132140
uint8_t apMacArray[6] {0};
133141
theOneMac = macToString(WiFi.softAPmacAddress(apMacArray));
134142

135143
if (useLED) {
136144
pinMode(LED_BUILTIN, OUTPUT); // Initialize the LED_BUILTIN pin as an output
137-
digitalWrite(LED_BUILTIN, LOW); // Turn LED on (LED is active low)
145+
digitalWrite(LED_BUILTIN, LOW); // Turn LED on (LED_BUILTIN is active low)
138146
}
139147

140148
floodingMeshDelay(5000); // Give some time for user to start the nodes
@@ -146,12 +154,12 @@ void loop() {
146154
static uint32_t benchmarkCount = 0;
147155
static uint32_t loopStart = millis();
148156

149-
// The floodingMeshDelay() method performs all the background operations for the FloodingMesh (via FloodingMesh::performMeshMaintainance()).
157+
// The floodingMeshDelay() method performs all the background operations for the FloodingMesh (via FloodingMesh::performMeshMaintenance()).
150158
// It is recommended to place one of these methods in the beginning of the loop(), unless there is a need to put them elsewhere.
151159
// Among other things, the method cleans up old ESP-NOW log entries (freeing up RAM) and forwards received mesh messages.
152160
// Note that depending on the amount of messages to forward and their length, this method can take tens or even hundreds of milliseconds to complete.
153-
// More intense transmission activity and less frequent calls to performMeshMaintainance will likely cause the method to take longer to complete, so plan accordingly.
154-
// The maintainance methods should not be used inside the meshMessageHandler callback, since they can alter the mesh node state. The framework will alert you during runtime if you make this mistake.
161+
// More intense transmission activity and less frequent calls to performMeshMaintenance will likely cause the method to take longer to complete, so plan accordingly.
162+
// The maintenance methods should not be used inside the meshMessageHandler callback, since they can alter the mesh node state. The framework will alert you during runtime if you make this mistake.
155163
floodingMeshDelay(1);
156164

157165
// If you wish to transmit only to a single node, try using one of the following methods (requires the node to be within range and know the MAC of the recipient):

0 commit comments

Comments
 (0)