8000 fix(battery) : Fix for the conflict between the battery_voltage_divider and AIN0, and modification to allow changing the oversampling value by yoshikik1991 · Pull Request #2964 · zmkfirmware/zmk · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix(battery) : Fix for the conflict between the battery_voltage_divider and AIN0, and modification to allow changing the oversampling value #2964

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

yoshikik1991
Copy link

Description:

Fixed an issue where improper ADC channel configuration caused a conflict between battery_voltage_divider and AIN0 and modified the oversampling value to be configurable via the device tree.
This pull request addresses these issues and improves the battery_voltage_divider .

Specific issues resolved:

  • Resolved the conflict occurring when AIN0 was used as an analog input while battery_voltage_divider was assigned to a different ADC channel. (Specifically, battery level was not displayed, and console logs indicated that AIN0 values were overwriting the expected behavior.)
  • Enabled setting the oversampling value to 0, resolving the issue where analog reading would stop after a certain period. More details here.

Testing details:

Tests were conducted using a board based on nRFMicro(V1.4) (AIN2 used for battery voltage monitoring) and an analog stick (Input:AIN0, AIN1), along with a keyboard featuring standard kscan. Confirmed that the conflict was resolved and that the issue causing analog reading to stop when oversampling was set to 0 was fixed.
The ZMK Config used for testing can be found here

PR check-list

  • Branch has a clean commit history
  • Additional tests are included, if changing behaviors/core code that is testable.
  • Proper Copyright + License headers added to applicable files (Generally, we stick to "The ZMK Contributors" for copyrights to help avoid churn when files get edited)
  • Pre-commit used to check formatting of files, commit messages, etc.
  • Includes any necessary documentation changes.

…age_divider.c

- Add 'oversampling' property to bvd_config and use it in adc_sequence.
- Read oversampling value from device tree, defaulting to 4 if not set.
@yoshikik1991 yoshikik1991 requested a review from a team as a code owner June 13, 2025 16:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant
0