version 2.33.0

piMinSleep() method
This commit is contained in:
2021-11-16 14:43:57 +03:00
parent 48c885e12a
commit a2a205cfd2
12 changed files with 28 additions and 26 deletions

View File

@@ -434,7 +434,7 @@ bool PISerial::read(void * data, int size, double timeout_ms) {
while (all < size && tm_.elapsed_m() < timeout_ms) {
ret = readDevice(&((uchar * )data)[all], size - all);
if (ret > 0) all += ret;
else piMSleep(PIP_MIN_MSLEEP);
else piMinSleep();
}
setOption(BlockingRead, br);
received(data, all);
@@ -473,13 +473,13 @@ PIString PISerial::read(int size, double timeout_ms) {
if (size <= 0) {
while (tm_.elapsed_m() < timeout_ms) {
ret = readDevice(td, 1024);
if (ret <= 0) piMSleep(PIP_MIN_MSLEEP);
if (ret <= 0) piMinSleep();
else str << PIString((char*)td, ret);
}
} else {
while (all < size && tm_.elapsed_m() < timeout_ms) {
ret = readDevice(td, size - all);
if (ret <= 0) piMSleep(PIP_MIN_MSLEEP);
if (ret <= 0) piMinSleep();
else {
str << PIString((char*)td, ret);
all += ret;
@@ -493,7 +493,7 @@ PIString PISerial::read(int size, double timeout_ms) {
str << PIString((char*)td, all);
while (all < size) {
ret = readDevice(td, size - all);
if (ret <= 0) piMSleep(PIP_MIN_MSLEEP);
if (ret <= 0) piMinSleep();
else {
str << PIString((char*)td, ret);
all += ret;
@@ -525,13 +525,13 @@ PIByteArray PISerial::readData(int size, double timeout_ms) {
if (size <= 0) {
while (tm_.elapsed_m() < timeout_ms) {
ret = readDevice(td, 1024);
if (ret <= 0) piMSleep(PIP_MIN_MSLEEP);
if (ret <= 0) piMinSleep();
else str.append(td, ret);
}
} else {
while (all < size && tm_.elapsed_m() < timeout_ms) {
ret = readDevice(td, size - all);
if (ret <= 0) piMSleep(PIP_MIN_MSLEEP);
if (ret <= 0) piMinSleep();
else {
str.append(td, ret);
all += ret;
@@ -545,7 +545,7 @@ PIByteArray PISerial::readData(int size, double timeout_ms) {
str.append(td, all);
while (all < size) {
ret = readDevice(td, size - all);
if (ret <= 0) piMSleep(PIP_MIN_MSLEEP);
if (ret <= 0) piMinSleep();
else {
str.append(td, ret);
all += ret;