mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-12-23 21:01:25 +01:00
eliminate wrong ringread due to peek (eliminated peek as well) - new version
This commit is contained in:
parent
966b9594ef
commit
f56e3bec9e
@ -1 +1 @@
|
|||||||
#define GITHUB_SHA "PORTX-HAL-20220807-1"
|
#define GITHUB_SHA "PORTX-HAL-20220808"
|
||||||
|
@ -268,7 +268,7 @@ void WifiESP::loop() {
|
|||||||
WiThrottle::loop(outboundRing);
|
WiThrottle::loop(outboundRing);
|
||||||
|
|
||||||
// something to write out?
|
// something to write out?
|
||||||
clientId=outboundRing->peek();
|
clientId=outboundRing->read();
|
||||||
if (clientId >= 0) {
|
if (clientId >= 0) {
|
||||||
if ((unsigned int)clientId > clients.size()) {
|
if ((unsigned int)clientId > clients.size()) {
|
||||||
// something is wrong with the ringbuffer position
|
// something is wrong with the ringbuffer position
|
||||||
@ -280,20 +280,20 @@ void WifiESP::loop() {
|
|||||||
for(int i=0;i<count;i++) {
|
for(int i=0;i<count;i++) {
|
||||||
int c = outboundRing->read();
|
int c = outboundRing->read();
|
||||||
if (c < 0) {
|
if (c < 0) {
|
||||||
DIAG(F("Ringread fail at %d"),i);
|
DIAG(F("Ringread fail in discarding data for client %d at pos %d"),clientId, i);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
outboundRing->info();
|
outboundRing->info();
|
||||||
|
} else {
|
||||||
|
DIAG(F("No clientId where expected: Ring beyond rescue"));
|
||||||
}
|
}
|
||||||
DIAG(F("Ring beyond rescue"));
|
|
||||||
} else {
|
} else {
|
||||||
// We have data to send in outboundRing
|
// We have data to send in outboundRing
|
||||||
// and we have a valid clientId.
|
// and we have a valid clientId.
|
||||||
// First read it out to buffer
|
// First read it out to buffer
|
||||||
// and then look if it can be sent because
|
// and then look if it can be sent because
|
||||||
// we can not leave it in the ring for ever
|
// we can not leave it in the ring for ever
|
||||||
outboundRing->read(); // read over peek()
|
|
||||||
int count=outboundRing->count();
|
int count=outboundRing->count();
|
||||||
{
|
{
|
||||||
char buffer[count+1];
|
char buffer[count+1];
|
||||||
|
Loading…
Reference in New Issue
Block a user