tg
tg copied to clipboard
Fix issue preventing BPH below 14400 from working
Periods (two beats) longer than 500 ms were rejected as too long. This effectively limits the low end of BPH to 14400. Any slower and the correct period length is greater than 500 ms, e.g. 12000 BPH is a 600 ms period.
Change the limit to be 20% slower than the nominal value for the BPH. If the BPH is set, then use that, when BPH is guessed, use MIN_BPH.
When MIN_BPH of 1200, this increases the max period to 720 ms when guessing. It could be longer if one were able to set a slower than MIN_BPH period length.
I also confirm that this works fine at 10800 bph!
tg.h: #define MIN_BPH 10800
#define PRESET_BPH { 10800, 12000, 14400, 17280, 18000, 19800, 21600, 25200, 28800, 36000, 43200, 72000, 0 };
Note that it's not absolutely necessary to add new rates to the list. Any value can be manually entered in bph box, as long as it is in MIN-MAX BPH range. If it is not in list, it will not be guessed in guess mode.
The beat guessing logic has issues when there are rates at whole multiples of other rates in the list. E.g., adding 9000 to the list which is exactly half of 18000. It will be likely to guess the slower rate for a faster movement, e.g. guess 9000 for a 18000 bph movement.
In a 18000 bph movement, there are also ticks at proper time for 9000 and since it will see every other tick, there will be less beat error. Also, either the tick sound vs the tock sound will be louder. Using half the correct bph will just use the louder sounds, and so it appears to be better.
So adding all possible slow bph values to list has a drawback: It will interfere with auto-detection of more common higher bph values that are exactly double (or triple, etc.) the slower value.