Skip to content

Commit cc145c7

Browse files
ci(pre-commit): Apply automatic fixes
1 parent 9873583 commit cc145c7

File tree

4 files changed

+72
-73
lines changed

4 files changed

+72
-73
lines changed

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

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -32,19 +32,19 @@ void setup() {
3232
void loop() {
3333
// Get current device role
3434
ot_device_role_t currentRole = threadLeaderNode.otGetDeviceRole();
35-
35+
3636
// Only print network information when not detached
3737
if (currentRole != OT_ROLE_DETACHED && currentRole != OT_ROLE_DISABLED) {
3838
Serial.println("==============================================");
3939
Serial.println("OpenThread Network Information:");
40-
40+
4141
// Basic network information
4242
Serial.printf("Role: %s\r\n", threadLeaderNode.otGetStringDeviceRole());
4343
Serial.printf("RLOC16: 0x%04x\r\n", threadLeaderNode.getRloc16());
4444
Serial.printf("Network Name: %s\r\n", threadLeaderNode.getNetworkName().c_str());
4545
Serial.printf("Channel: %d\r\n", threadLeaderNode.getChannel());
4646
Serial.printf("PAN ID: 0x%04x\r\n", threadLeaderNode.getPanId());
47-
47+
4848
// Extended PAN ID
4949
const uint8_t *extPanId = threadLeaderNode.getExtendedPanId();
5050
if (extPanId) {
@@ -54,7 +54,7 @@ void loop() {
5454
}
5555
Serial.println();
5656
}
57-
57+
5858
// Network Key
5959
const uint8_t *networkKey = threadLeaderNode.getNetworkKey();
6060
if (networkKey) {
@@ -64,19 +64,19 @@ void loop() {
6464
}
6565
Serial.println();
6666
}
67-
67+
6868
// Mesh Local EID
6969
IPAddress meshLocalEid = threadLeaderNode.getMeshLocalEid();
7070
Serial.printf("Mesh Local EID: %s\r\n", meshLocalEid.toString().c_str());
71-
71+
7272
// Leader RLOC
7373
IPAddress leaderRloc = threadLeaderNode.getLeaderRloc();
7474
Serial.printf("Leader RLOC: %s\r\n", leaderRloc.toString().c_str());
75-
75+
7676
// Node RLOC
7777
IPAddress nodeRloc = threadLeaderNode.getRloc();
7878
Serial.printf("Node RLOC: %s\r\n", nodeRloc.toString().c_str());
79-
79+
8080
// Demonstrate address listing with two different methods:
8181
// Method 1: Unicast addresses using counting API (individual access)
8282
Serial.println("\r\n--- Unicast Addresses (Using Count + Index API) ---");
@@ -85,29 +85,29 @@ void loop() {
8585
IPAddress addr = threadLeaderNode.getUnicastAddress(i);
8686
Serial.printf(" [%zu]: %s\r\n", i, addr.toString().c_str());
8787
}
88-
88+
8989
// Method 2: Multicast addresses using std::vector (bulk access)
9090
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++) {
9393
Serial.printf(" [%zu]: %s\r\n", i, allMulticast[i].toString().c_str());
9494
}
95-
95+
9696
// Check for role change and clear cache if needed (only when active)
9797
if (currentRole != lastKnownRole) {
98-
Serial.printf("Role changed from %s to %s - clearing address cache\r\n",
99-
(lastKnownRole < 5) ? otRoleString[lastKnownRole] : "Unknown",
100-
threadLeaderNode.otGetStringDeviceRole());
98+
Serial.printf(
99+
"Role changed from %s to %s - clearing address cache\r\n", (lastKnownRole < 5) ? otRoleString[lastKnownRole] : "Unknown",
100+
threadLeaderNode.otGetStringDeviceRole()
101+
);
101102
threadLeaderNode.clearAllAddressCache();
102103
lastKnownRole = currentRole;
103104
}
104105
} else {
105-
Serial.printf("Thread Node Status: %s - Waiting for thread network start...\r\n",
106-
threadLeaderNode.otGetStringDeviceRole());
107-
106+
Serial.printf("Thread Node Status: %s - Waiting for thread network start...\r\n", threadLeaderNode.otGetStringDeviceRole());
107+
108108
// Update role tracking even when detached/disabled, but don't clear cache
109109
lastKnownRole = currentRole;
110110
}
111-
111+
112112
delay(5000);
113113
}

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

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,23 +24,23 @@ void setup() {
2424
void loop() {
2525
// Get current device role
2626
ot_device_role_t currentRole = threadChildNode.otGetDeviceRole();
27-
27+
2828
// Only print detailed network information when node is active
2929
if (currentRole != OT_ROLE_DETACHED && currentRole != OT_ROLE_DISABLED) {
3030
Serial.println("==============================================");
3131
Serial.println("OpenThread Network Information (Active Dataset):");
32-
32+
3333
// Get and display the current active dataset
3434
const DataSet &activeDataset = threadChildNode.getCurrentDataSet();
35-
35+
3636
Serial.printf("Role: %s\r\n", threadChildNode.otGetStringDeviceRole());
3737
Serial.printf("RLOC16: 0x%04x\r\n", threadChildNode.getRloc16());
38-
38+
3939
// Dataset information
4040
Serial.printf("Network Name: %s\r\n", activeDataset.getNetworkName());
4141
Serial.printf("Channel: %d\r\n", activeDataset.getChannel());
4242
Serial.printf("PAN ID: 0x%04x\r\n", activeDataset.getPanId());
43-
43+
4444
// Extended PAN ID from dataset
4545
const uint8_t *extPanId = activeDataset.getExtendedPanId();
4646
if (extPanId) {
@@ -50,7 +50,7 @@ void loop() {
5050
}
5151
Serial.println();
5252
}
53-
53+
5454
// Network Key from dataset
5555
const uint8_t *networkKey = activeDataset.getNetworkKey();
5656
if (networkKey) {
@@ -60,26 +60,25 @@ void loop() {
6060
}
6161
Serial.println();
6262
}
63-
63+
6464
// Additional runtime information
6565
IPAddress meshLocalEid = threadChildNode.getMeshLocalEid();
6666
Serial.printf("Mesh Local EID: %s\r\n", meshLocalEid.toString().c_str());
67-
67+
6868
IPAddress nodeRloc = threadChildNode.getRloc();
6969
Serial.printf("Node RLOC: %s\r\n", nodeRloc.toString().c_str());
70-
70+
7171
IPAddress leaderRloc = threadChildNode.getLeaderRloc();
7272
Serial.printf("Leader RLOC: %s\r\n", leaderRloc.toString().c_str());
7373

7474
Serial.println();
75-
76-
} else {
75+
76+
} else {
7777
Serial.println("==============================================");
78-
Serial.printf("Thread Node Status: %s - Waiting for thread network start...\r\n",
79-
threadChildNode.otGetStringDeviceRole());
80-
78+
Serial.printf("Thread Node Status: %s - Waiting for thread network start...\r\n", threadChildNode.otGetStringDeviceRole());
79+
8180
Serial.println();
8281
}
83-
82+
8483
delay(5000);
8584
}

0 commit comments

Comments
 (0)