Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd901327

Browse files
committed
Tweaking
1 parent28eaec7 commitd901327

File tree

1 file changed

+20
-26
lines changed

1 file changed

+20
-26
lines changed

‎MeshBase.cpp

Lines changed: 20 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
#defineTO_BROADCAST(x) (0xBB00000000LL + x)
1313
#defineTO_ADDRESS(x) (0xAA00000000LL + x)
1414

15-
#definePEER_DISCOVERY_TIME3000
15+
#definePEER_DISCOVERY_TIME4000
1616
#definePEER_CHECK_TIME4000
17-
#definePEER_TIMEOUT2
17+
#definePEER_TIMEOUT3
1818

1919
MeshBase::MeshBase(uint8_t ce,uint8_t cs)
2020
: radio(ce, cs)
@@ -89,16 +89,6 @@ void MeshBase::Message::AddPart(const void* payload, uint8_t len, uint8_t part_n
8989
{
9090
uint8_t start_pos = part_num * MAX_PAYLOAD_SIZE;
9191
uint8_t end_pos = len + (part_num * MAX_PAYLOAD_SIZE);
92-
Serial.print(" R AddPart() : Adding part. start_pos=");
93-
Serial.print(start_pos);
94-
Serial.print(" end_pos=");
95-
Serial.print(end_pos);
96-
Serial.print(" len=");
97-
Serial.print(len);
98-
Serial.print(" part_num=");
99-
Serial.print(part_num);
100-
Serial.print(" more_parts=");
101-
Serial.println(more_parts);
10292
if (data ==NULL)
10393
data =malloc(end_pos);
10494
if (end_pos > data_used)
@@ -119,17 +109,16 @@ bool MeshBase::Message::IsDone() const
119109
// in the stream, and split_part to total number of blocks in the stream.
120110
// So if split_more is false, and we have the right number of blocks_recieved
121111
// we are good to go.
122-
Serial.print(" R IsDone() : split_more=");
123-
Serial.print(header.split_more);
124-
Serial.print(" split_part=");
125-
Serial.print(header.split_part);
126-
Serial.print(" blocks_recieved=");
127-
Serial.print(blocks_recieved);
128-
if (!header.split_more && blocks_recieved > header.split_part)
129-
{
130-
Serial.println(" - True **");
112+
if (!header.split_more && blocks_recieved > header.split_part) {
113+
if (blocks_recieved >1) {
114+
Serial.print(" R IsDone() : id=");
115+
Serial.print(header.msg_id);
116+
Serial.println(" - True **");
117+
}
131118
returntrue;
132119
}
120+
Serial.print(" R IsDone() : id=");
121+
Serial.print(header.msg_id);
133122
Serial.println(" - False");
134123
returnfalse;
135124
}
@@ -237,16 +226,21 @@ void MeshBase::SendMessage(uint32_t to, uint8_t type, const void* data, uint8_t
237226
result = radio.write(buff, wire_size);
238227
}else {
239228
result = radio.write(buff, wire_size);
240-
}
241-
radio.startListening();
242-
if (!is_broadcast)
243-
{
229+
if (result ==false) {
230+
// Issue transmitting packet, retry?
231+
radio.startListening();
232+
delay(100);
233+
radio.stopListening();
234+
result = radio.write(buff, wire_size);
235+
}
244236
Serial.print(" T Sending pkt split_part=");
245237
Serial.print(msg->split_part);
238+
Serial.print(" id=");
239+
Serial.print(msg->msg_id);
246240
Serial.print(" result=");
247241
Serial.println(result);
248242
}
249-
delay(100);
243+
radio.startListening();
250244
}
251245
}
252246

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp