SlashDevin / NeoSWSerial

Efficient alternative to SoftwareSerial with attachInterrupt for RX chars, simultaneous RX & TX
169 stars 42 forks source link

sei() not called as it should have been several times #58

Closed eclab closed 7 months ago

eclab commented 7 months ago

cli() (aka "noInterrupts()") is called multiple times in the NeoSWSerial code, but only once is sei() (aka "interrupts()") called to reenable the interrupts. This appears to be a significant error in a number of places.

Now I'm not sure if this is necessary, for example, in the ignore() function where only cli() is called. However in the write() function, a missing sei() is definitely messing with accuracy of written code, particularly after patching with the long-standing pull-request to properly handle writes from multiple serial ports (https://github.com/SlashDevin/NeoSWSerial/pull/48).

eclab commented 7 months ago

I think it's got SREG being set each time, so I'm closing this.