Skip to content
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

Bug: Unwanted change resistance in x9c component #5483

Merged
merged 4 commits into from
Dec 21, 2023

Conversation

fizista
Copy link
Contributor

@fizista fizista commented Oct 5, 2023

What does this implement/fix?

There is an unwanted change in the resistance value.

Just call set_level(20) several times. The resistance will change.

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Other

Related issue or feature (if applicable): fixes n/a

Pull request in esphome-docs with documentation (if applicable): n/a

Test Environment

  • ESP32
  • ESP32 IDF
  • ESP8266
  • RP2040

Example entry for config.yaml:

switch:
  - platform: template
    id: test_repeat
    name: "X9C Const value 20"
    restore_mode: ALWAYS_OFF
    optimistic: True
    on_turn_on:
      - output.set_level: 
          id: x9c_pot
          level: 20
    on_turn_off:
      - output.set_level: 
          id: x9c_pot
          level: 20

output:
  - platform: x9c
    id: x9c_pot
    cs_pin: GPIO15
    inc_pin: GPIO4
    ud_pin: GPIO2
    initial_value: 0.01
    inverted: True

Checklist:

  • The code change is tested and works locally.
  • Tests have been added to verify that the new code works (under tests/ folder).

If user exposed functionality or configuration variables are added/changed:

@probot-esphome
Copy link

probot-esphome bot commented Oct 5, 2023

Hey there @EtienneMD, mind taking a look at this pull request as it has been labeled with an integration (x9c) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)

@EtienneMD
Copy link
Contributor

I see what you are saying, chip should not be selected with INC pin in High state. It never is thought as the pin is selected high prior to CS pin being lowered. Any advantage in leaving it high all the time when not in use?

@fizista
Copy link
Contributor Author

fizista commented Oct 16, 2023

You're right. The high state on INC is not needed.

esphome/components/x9c/x9c.cpp Outdated Show resolved Hide resolved
@jesserockz jesserockz enabled auto-merge (squash) December 21, 2023 06:50
@jesserockz jesserockz merged commit d73ad39 into esphome:dev Dec 21, 2023
48 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Dec 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants