Starting with versions:
- 8.2 of NMEA2WIFI
- 2.3 of NMEA3WIFI
- 6.2 of NMEA4WIFI
- 2.0 of the N2K0183
- P1>P5 (P1 routed to P5)
- P2>P5 (P2 routed to P5)
- ...
- EXT>P5 (EXT routed to P5)
The P5 output serial buffer had a size of 128 bytes (128 characters). Nmea0183 sentences can have a maximum of 81 characters but, for the sake of explanation, we consider that the sentences have a length of 40 characters. If a burst of 4 sentences arrive almost at the same time to be sent out by P5, the 1st 3 will be written to buffer, occupying 120 chars and leaving only 8 chars for the next 4th sentence. When this sentence arrives, the multiplexer was halted in a wait state until 32 characters were sent out, so that a space of 40 chars becomes available for the sentence. We see that when the serial output buffer lacks space to output the sentence, the multiplexer is halted until space becomes available. Consequently, if more data continues to arrive at the multiplexer inputs during this wait state, the incoming data won't be read immediately. Instead, it accumulates in the input buffers, eventually leading to overflow. As the input buffers operate as ring buffers, overflow results in data corruption.
In order to alleviate this problem we no longer wait for space to be available. When the sentence arrives and there is no space available in the output serial buffer we drop the sentence. This is better than data corruption and possibly multiplexer crashes. These are the new buffer sizes:
- For the NMEA2WIFI multiplexer: 256 bytes for the P1 and P2 serial input buffers and 128 bytes for the P3 serial output buffer
- For the NMEA3WIFI multiplexer: 256 bytes for the P1 and P2 serial input buffers and 256 bytes for the P3 serial output buffer
- For the NMEA4WIFI multiplexer: 256 bytes for the P1, P2, P3 and P4 serial input buffers and 256 bytes for the P5 serial output buffer
- For the N2K0183 multiplexer: 256 bytes for the P1 and PX serial input buffers and 1024 bytes for the P2 serial output buffer
Regards, Luis