chrisys / train-departure-display

A replica, near real-time, miniature UK railway station train departure sign based upon a Raspberry Pi Zero and 256x64 SPI OLED display
245 stars 76 forks source link

Added function to parse platform data and filter incorrect data #104

Closed CalamityJames closed 1 year ago

CalamityJames commented 1 year ago

Another one from me, sorry!

Being in a part of the world with weird platforms (Waterloo East has A-D so as to avoid confusion with Waterloo), I noticed the filter was stripping out anything non-numeric.

I'm not sure if OpenLDBWS supports platforms such as 1A etc, but I have also added support for that into the regex function I've created.

Valid entries are:

(yes I know there isn't anywhere with over 24 platforms, but a 2 digit regex is more succinct!)

Pretty sure there aren't any stations with letters over E, but the code should be straightforward enough to adjust if needs be in the future!

CalamityJames commented 1 year ago

Should have included a regex101 showing the validation working!

https://regex101.com/r/pcsSct/3

chrisys commented 1 year ago

Another one from me, sorry!

No apology necessary - this is great! I'll merge this and update the version/changelog stuff. I once had an automation for that but not sure what happened to it, will look into it!