Also it’s pretty bad that the library does an interrupt-processing in this function
Which is not marked as ICACHE_RAM_ATTR
. All interrupt-processing code must be in IRAM for the ESP8266. See How to fix "ISR not in IRAM" - #2 by maxgerhardt
The library is 8 years old and was probably written with an Arduino Uno in mind rather than an ESP8266.