Merge pull request #1107 from NiLuJe/master

Revamp the waveform mode selection logic