Skip to content

Commit bf43c6a

Browse files
committed
feat: on tgt reached stop sending ack if host responds with ack received: XK
1 parent a3e873c commit bf43c6a

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

examples/firmware_01/firmware_01.ino

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ uint8_t msg_size;
3131
uint8_t ack_required=0;
3232
int ack_counter=0;
3333
bool ack_check=false;
34+
uint8_t ack_code=0;
3435

3536
unsigned long tmotor=0;
3637
unsigned long tsend=0;
@@ -176,6 +177,14 @@ void loop(){
176177
packeter.unpacketC3F(code, x, y, theta);
177178
alvik.resetPose(x, y, theta);
178179
break;
180+
case 'X':
181+
packeter.unpacketC1B(code, ack_code);
182+
Serial.print("Ack received ");
183+
Serial.println(ack_code);
184+
if (ack_code == 'K') {
185+
ack_check = false;
186+
}
187+
break;
179188
}
180189
}
181190

@@ -270,7 +279,7 @@ void loop(){
270279
//ack_counter--;
271280
Serial.println("M");
272281
}
273-
ack_check=false;
282+
// ack_check=false;
274283
}
275284

276285

0 commit comments

Comments
 (0)