moved datalink_recieve to bottom of main loop to improve speed when using address cache
This commit is contained in:
@@ -239,22 +239,17 @@ int main(
|
|||||||
/* increment timer - exit if timed out */
|
/* increment timer - exit if timed out */
|
||||||
current_seconds = time(NULL);
|
current_seconds = time(NULL);
|
||||||
|
|
||||||
/* returns 0 bytes on timeout */
|
|
||||||
pdu_len = datalink_receive(&src, &Rx_Buf[0], MAX_MPDU, timeout);
|
|
||||||
|
|
||||||
/* process */
|
|
||||||
if (pdu_len) {
|
|
||||||
npdu_handler(&src, &Rx_Buf[0], pdu_len);
|
|
||||||
}
|
|
||||||
/* at least one second has passed */
|
/* at least one second has passed */
|
||||||
if (current_seconds != last_seconds)
|
if (current_seconds != last_seconds)
|
||||||
tsm_timer_milliseconds(((current_seconds - last_seconds) * 1000));
|
tsm_timer_milliseconds(((current_seconds - last_seconds) * 1000));
|
||||||
if (Error_Detected)
|
if (Error_Detected)
|
||||||
break;
|
break;
|
||||||
/* wait until the device is bound, or timeout and quit */
|
/* wait until the device is bound, or timeout and quit */
|
||||||
|
if(!found){
|
||||||
found =
|
found =
|
||||||
address_bind_request(Target_Device_Object_Instance, &max_apdu,
|
address_bind_request(Target_Device_Object_Instance, &max_apdu,
|
||||||
&Target_Address);
|
&Target_Address);
|
||||||
|
}
|
||||||
if (found) {
|
if (found) {
|
||||||
if (invoke_id == 0) {
|
if (invoke_id == 0) {
|
||||||
invoke_id =
|
invoke_id =
|
||||||
@@ -279,6 +274,15 @@ int main(
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* returns 0 bytes on timeout */
|
||||||
|
pdu_len = datalink_receive(&src, &Rx_Buf[0], MAX_MPDU, timeout);
|
||||||
|
|
||||||
|
/* process */
|
||||||
|
if (pdu_len) {
|
||||||
|
npdu_handler(&src, &Rx_Buf[0], pdu_len);
|
||||||
|
}
|
||||||
|
|
||||||
/* keep track of time for next check */
|
/* keep track of time for next check */
|
||||||
last_seconds = current_seconds;
|
last_seconds = current_seconds;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user