dmadison / Sim-Racing-Arduino

A library to connect sim racing peripherals to Arduino development boards
GNU Lesser General Public License v3.0
65 stars 7 forks source link

Send pedal position on change #3

Closed dmadison closed 2 years ago

dmadison commented 2 years ago

These changes make it so that pedal data in the PedalsJoystick example is only sent whenever the pedals actually move. The goal is to avoid spamming games with pedal input and grabbing focus away from other input devices like wheels or mice. The latter of which makes it really difficult to actually set up the pedals in certain games. This can be overridden with an option in the example to restore its previous behavior.

Because of an underlying change to the AnalogInput class, all classes that use an ADC input will only report changes if the ADC input is within the calibration range (to avoid saying "data changed" when it's outside of the range we are reporting). The Handbrake class is the one most noticeably affected.

Pedal serial calibration now includes deadzone options for the start and end of the travel range. The former should reduce issues with pedals being always "on", the latter should reduce issues with being unable to get the pedal to 100%. Both are set at low values by default (1% and 2.5%, respectively). These only affect serial (conversational) calibration. Applied calibration is unmodified.

This also slightly adjusts the calibration of the Logitech pedals' brake, which was registering a constant low input during more thorough testing.