-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Add Linkind dimmer support #14004
Add Linkind dimmer support #14004
Conversation
What is the reason for adding the device in |
I thought I needed to add the device in tasmota_template.h because the PWM dimmer module does not exist for ESP32. Maybe the right thing is to add the PWM Dimmer module as an ESP32 template? |
Why adding a template in general? Is there a specific function used which is not possible to call with a usual configuration Template provided? |
#endif // ESP8266 | ||
#ifdef USE_LINKIND | ||
if (LINKIND == TasmotaGlobal.module_type) TasmotaGlobal.use_pwm_dimmer = true; | ||
#endif // USE_LINKIND | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This won't work as module_types will be duplicated between esp8266 and esp32. I strongly suggest NOT to use the module_type for ESP32 specific code.
Your overall implemntation is much too invasive. There must be a better way to implement this specific hardware.
A possible solution is the way I implemented the Sonoff SPM hardware; it only uses one file and acts based on it's template name. The most preferred way is/was select functionality based on GPIO selection but for a POC using the template name is a much cleaner approach as it doesn't need small changes to many files.
The only real extra code that is necessary to support the Linkind dimmer is the few lines of code in the light module that write the dimmer level through I2C instead of through analogWrite. There also needs to be a way to indicate that this device should use the PWM Module logic to respond to the buttons. Please let me know how you would like me to implement this so it fits in with your vision. |
Will have a look how to implement this and come back here. |
This PR has been automatically marked as stale because it hasn't any activity in last few weeks. It will be closed if no further activity occurs. Thank you for your contributions. |
Theo was going to look in to how to implement this. The code for the actual Linkind dimmer support is simply using I2C in the light module instead of setting the PWM value. In addition, there's the template. The issue that needs to be worked out is how to enable the PWM Dimmer code. |
Will revisit ASAP |
I've been trying to implement this by using two new GPIO_OPTIONS. During this I expect this LINKID device is not using ALL USE_PWM_DIMMER code so in addition to it's I2C code is does NOT use all PWM_DIMMER code. Am I correct. If so we need to assume the LINKID device is a new device with some overlap of USE_PWM_DIMMER but definitly NOT full USE_PWM_DIMMER plus I2C code. Pls enlighten me. |
The device has 2 buttons, a red led and a green led (located in the same place), and a secondary chip that manages the physical dimming and received the dimming value over I2C. So it is useful to use essentially the PWM Dimmer functionality for managing the buttons, the dimming, and the brightness of the green LED. I suspect there may be 2 changes represented by this PR. The first change is enabling PWM Dimmer for ESP32 (could be useful to upgrade existing PWM Dimmer devices to Hardware PWM with a C3 for example). The second change is for the Linkind Dimmer device specifically, enabling the I2C write in place of the analogWrite. |
Add support for Linkind dimmer as GPIO ``Option A6`` (#14004)
Merged my way. For use on ESP32 Linkind load following template:
|
Description:
This PR adds support for Linkind (https://www.amazon.com/dp/B08DRF58T1) ESP32-based dimmer that uses I2C to communicate with the dimmer hardware.
Please check the changes to the build and template files and let me know if anything was not done the way you want them implemented.
Related issue (if applicable): fixes #
Checklist:
NOTE: The code change must pass CI tests. Your PR cannot be merged unless tests pass