Skip to content

Commit a48f398

Browse files
committed
fix(openthread): CR/LF fix
1 parent 637402f commit a48f398

File tree

3 files changed

+24
-32
lines changed

3 files changed

+24
-32
lines changed

libraries/OpenThread/examples/Native/SimpleThreadNetwork/LeaderNode/LeaderNode.ino

Lines changed: 15 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@ void loop() {
3939
Serial.println("OpenThread Network Information:");
4040

4141
// Basic network information
42-
Serial.printf("Role: %s\n", threadLeaderNode.otGetStringDeviceRole());
43-
Serial.printf("RLOC16: 0x%04x\n", threadLeaderNode.getRloc16());
44-
Serial.printf("Network Name: %s\n", threadLeaderNode.getNetworkName().c_str());
45-
Serial.printf("Channel: %d\n", threadLeaderNode.getChannel());
46-
Serial.printf("PAN ID: 0x%04x\n", threadLeaderNode.getPanId());
42+
Serial.printf("Role: %s\r\n", threadLeaderNode.otGetStringDeviceRole());
43+
Serial.printf("RLOC16: 0x%04x\r\n", threadLeaderNode.getRloc16());
44+
Serial.printf("Network Name: %s\r\n", threadLeaderNode.getNetworkName().c_str());
45+
Serial.printf("Channel: %d\r\n", threadLeaderNode.getChannel());
46+
Serial.printf("PAN ID: 0x%04x\r\n", threadLeaderNode.getPanId());
4747

4848
// Extended PAN ID
4949
const uint8_t *extPanId = threadLeaderNode.getExtendedPanId();
@@ -67,51 +67,42 @@ void loop() {
6767

6868
// Mesh Local EID
6969
IPAddress meshLocalEid = threadLeaderNode.getMeshLocalEid();
70-
Serial.printf("Mesh Local EID: %s\n", meshLocalEid.toString().c_str());
70+
Serial.printf("Mesh Local EID: %s\r\n", meshLocalEid.toString().c_str());
7171

7272
// Leader RLOC
7373
IPAddress leaderRloc = threadLeaderNode.getLeaderRloc();
74-
Serial.printf("Leader RLOC: %s\n", leaderRloc.toString().c_str());
74+
Serial.printf("Leader RLOC: %s\r\n", leaderRloc.toString().c_str());
7575

7676
// Node RLOC
7777
IPAddress nodeRloc = threadLeaderNode.getRloc();
78-
Serial.printf("Node RLOC: %s\n", nodeRloc.toString().c_str());
78+
Serial.printf("Node RLOC: %s\r\n", nodeRloc.toString().c_str());
7979

8080
// Demonstrate address listing with two different methods:
8181
// Method 1: Unicast addresses using counting API (individual access)
82-
Serial.println("\n--- Unicast Addresses (Using Count + Index API) ---");
82+
Serial.println("\r\n--- Unicast Addresses (Using Count + Index API) ---");
8383
size_t unicastCount = threadLeaderNode.getUnicastAddressCount();
8484
for (size_t i = 0; i < unicastCount; i++) {
8585
IPAddress addr = threadLeaderNode.getUnicastAddress(i);
86-
Serial.printf(" [%zu]: %s\n", i, addr.toString().c_str());
86+
Serial.printf(" [%zu]: %s\r\n", i, addr.toString().c_str());
8787
}
8888

8989
// Method 2: Multicast addresses using std::vector (bulk access)
90-
Serial.println("\n--- Multicast Addresses (Using std::vector API) ---");
90+
Serial.println("\r\n--- Multicast Addresses (Using std::vector API) ---");
9191
std::vector<IPAddress> allMulticast = threadLeaderNode.getAllMulticastAddresses();
9292
for (size_t i = 0; i < allMulticast.size(); i++) {
93-
Serial.printf(" [%zu]: %s\n", i, allMulticast[i].toString().c_str());
93+
Serial.printf(" [%zu]: %s\r\n", i, allMulticast[i].toString().c_str());
9494
}
95-
96-
// Cache management information
97-
Serial.println("\n--- Address Access Methods ---");
98-
Serial.println("Two ways to access addresses:");
99-
Serial.println("1. Count + Index: getUnicastAddressCount() + getUnicastAddress(index)");
100-
Serial.println("2. Vector: getAllUnicastAddresses() or getAllMulticastAddresses()");
101-
Serial.println("Cache is automatically populated when empty");
102-
103-
Serial.println("==============================================\n");
104-
95+
10596
// Check for role change and clear cache if needed (only when active)
10697
if (currentRole != lastKnownRole) {
107-
Serial.printf("Role changed from %s to %s - clearing address cache\n",
98+
Serial.printf("Role changed from %s to %s - clearing address cache\r\n",
10899
(lastKnownRole < 5) ? otRoleString[lastKnownRole] : "Unknown",
109100
threadLeaderNode.otGetStringDeviceRole());
110101
threadLeaderNode.clearAllAddressCache();
111102
lastKnownRole = currentRole;
112103
}
113104
} else {
114-
Serial.printf("Thread Node Status: %s - Waiting for network connection...\n",
105+
Serial.printf("Thread Node Status: %s - Waiting for thread network start...\r\n",
115106
threadLeaderNode.otGetStringDeviceRole());
116107

117108
// Update role tracking even when detached/disabled, but don't clear cache

libraries/OpenThread/examples/Native/SimpleThreadNetwork/RouterNode/RouterNode.ino

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@ void loop() {
3333
// Get and display the current active dataset
3434
const DataSet &activeDataset = threadChildNode.getCurrentDataSet();
3535

36-
Serial.printf("Role: %s\n", threadChildNode.otGetStringDeviceRole());
37-
Serial.printf("RLOC16: 0x%04x\n", threadChildNode.getRloc16());
36+
Serial.printf("Role: %s\r\n", threadChildNode.otGetStringDeviceRole());
37+
Serial.printf("RLOC16: 0x%04x\r\n", threadChildNode.getRloc16());
3838

3939
// Dataset information
40-
Serial.printf("Network Name: %s\n", activeDataset.getNetworkName());
41-
Serial.printf("Channel: %d\n", activeDataset.getChannel());
42-
Serial.printf("PAN ID: 0x%04x\n", activeDataset.getPanId());
40+
Serial.printf("Network Name: %s\r\n", activeDataset.getNetworkName());
41+
Serial.printf("Channel: %d\r\n", activeDataset.getChannel());
42+
Serial.printf("PAN ID: 0x%04x\r\n", activeDataset.getPanId());
4343

4444
// Extended PAN ID from dataset
4545
const uint8_t *extPanId = activeDataset.getExtendedPanId();
@@ -63,16 +63,16 @@ void loop() {
6363

6464
// Additional runtime information
6565
IPAddress meshLocalEid = threadChildNode.getMeshLocalEid();
66-
Serial.printf("Mesh Local EID: %s\n", meshLocalEid.toString().c_str());
66+
Serial.printf("Mesh Local EID: %s\r\n", meshLocalEid.toString().c_str());
6767

6868
IPAddress nodeRloc = threadChildNode.getRloc();
69-
Serial.printf("Node RLOC: %s\n", nodeRloc.toString().c_str());
69+
Serial.printf("Node RLOC: %s\r\n", nodeRloc.toString().c_str());
7070

7171
Serial.println();
7272

7373
} else {
7474
Serial.println("==============================================");
75-
Serial.printf("Thread Node Status: %s - Waiting for network connection...\n",
75+
Serial.printf("Thread Node Status: %s - Waiting for thread network start...\r\n",
7676
threadChildNode.otGetStringDeviceRole());
7777

7878
Serial.println();

libraries/OpenThread/src/OThread.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,7 @@ void OpenThread::begin(bool OThreadAutoStart) {
240240
log_i("AUTO start OpenThread done");
241241
}
242242
}
243+
delay(500); // Give some time for the OpenThread tasks to initialize
243244
otStarted = true;
244245
}
245246

0 commit comments

Comments
 (0)