Haptic and solenoid cleanup (#9700)

* solenoid: remove two functions that do nothing.

These functions modify the argument, and so they do nothing.

Note: versions of these functions exist in mtdjr's user folder,
however to core solenoid support and mtdjr user-specific solenoid
support are exclusive (only one can be used at a time).

So removing these confusing functions does no harm.

* solenoid: bugfix: don't allow dwell time to go 1ms below minimum time.

The previous code allowed dwell time to go 1ms below the configured minimum.
This change corrects it.

* solenoid: bugfix: when incrementing above maximum dwell time, jump back to minimum, not to 1

The previous code used to jump back to 1, which might be way under the configured minimum setting.

* solenoid: bugfix: on startup actually use the eeprom-stored dwell-time

This is because the dwell time is stored in two variables.

* solenoid: bugfix: on haptic_reset, actually use the newly set default dwell time.

This is needed because dwell time is configured in two variables.

* solenoid: on HPT_RST set buzz to a default value

* solenoid: buzz: reworked to make more configurable. Previous behaviour maintained.

* solenoid: documentation: clarify meaning of dwell time

* solenoid: add feature SOLENOID_DWELL_STEP_SIZE

* solenoid: documentation: added note about the precision of the solenoid time settings

* haptic: Correctly call haptic_reset when eeprom is corrupt.

* haptic: improve what happens if haptic is enabled without erasing eeprom

* haptic: improve what happens if solenoid is enabled without erasing eeprom

* drivers/haptic: fix compilation issue, when haptic is enabled, but solenoid isn't
This commit is contained in:
Purdea Andrei 2020-10-17 23:31:22 +03:00 committed by James Young
parent 2e1232c6bd
commit c904520f72
No known key found for this signature in database
GPG key ID: 8E1085BF6FCFBD74
5 changed files with 83 additions and 32 deletions

View file

@ -13,6 +13,10 @@
# include "eeprom_driver.h"
#endif
#if defined(HAPTIC_ENABLE)
# include "haptic.h"
#endif
/** \brief eeconfig enable
*
* FIXME: needs doc
@ -65,6 +69,15 @@ void eeconfig_init_quantum(void) {
eeprom_update_byte(EECONFIG_HANDEDNESS, 0);
#endif
#if defined(HAPTIC_ENABLE)
haptic_reset();
#else
// this is used in case haptic is disabled, but we still want sane defaults
// in the haptic configuration eeprom. All zero will trigger a haptic_reset
// when a haptic-enabled firmware is loaded onto the keyboard.
eeprom_update_dword(EECONFIG_HAPTIC, 0);
#endif
eeconfig_init_kb();
}