Skip to content
This repository has been archived by the owner on Aug 22, 2021. It is now read-only.

my92xx conversion #50

Merged
merged 6 commits into from
May 6, 2019
Merged

Conversation

darkfiberiru
Copy link
Contributor

@darkfiberiru darkfiberiru commented Jan 12, 2019

Conversion to My92xx the 3.0 version of My9291 including support for my9291 and my9231 chips

This will allow use of bulb on lohas bulbs and more.
In it's current state the led driver chip type and count must be set during compile time(default in config.eample.h is aiThinker compatible) but are exposed and instantiated from the factory config. Once the web interface/mqtt is configured to change these cfg settings they just need to be set and then the device reset to change light bulb compatibility.

Additional work possible/needed

  • Test code ( working on getting this loaded on to lohas bulb at the moment. I don't have any aithinker or compatible bulbs to test with)
  • Expose cfg options over mqtt/web/etc....(This should be all that's needed to make single firmware work on many different bulbs instead of compiling special firmware)
  • Deal with potential of different ordering of color channels(Standard order will work with many lights including lohas(rgbw) lohas is acutally rgbww see below
  • Deal with whites that are multitemperature(two channels are used for two white led types of different temperature) Still backwards compatible at single color temperature if light is rgbww such as lohas

@darkfiberiru
Copy link
Contributor Author

darkfiberiru commented Jan 12, 2019

Thanks to @freqlabs for help on this. Specifically figuring out how to instantiate Ailight library in a way we can pass arguments to it.

@darkfiberiru
Copy link
Contributor Author

This covers or at least is the start of work needed to fix issue #44

@stelgenhof
Copy link
Owner

@darkfiberiru This is great! I was planning on to do this (Moving to the MY92XX library) but did not get around to it. I have the AiThinker lightbulbs so can test it with these.

I will do some testing probably early next week (busy with some other projects ATM).

Cheers! Sacha

@darkfiberiru darkfiberiru changed the title My92 xx conversion my92xx conversion Jan 12, 2019
@darkfiberiru
Copy link
Contributor Author

darkfiberiru commented Jan 12, 2019

In case any wants to test lohas bulbs the following values need set in config.h

#define MY92XX_TYPE MY92XX_MODEL_MY9231
#define MY92XX_COUNT 2

@darkfiberiru
Copy link
Contributor Author

For some reason I can only get lohas bulb to flash when 3.3v is disconnected from the serial connector and ONLY tx/rx/gnd are connected while the bulb is in a LIVE socket. This is potentially dangerous so be careful this issue with lohas bulbs is also listed here arendst/Tasmota#1821.

This is just a note for anyone wanting to test lohas bulbs

@darkfiberiru
Copy link
Contributor Author

With my latest update to actually run update command on my92xx this pull request successfully works on the lohas bulbs(10w br30 e26 in my case but multiple lohas bulbs variants I've opened use same board TYD1R board)

@darkfiberiru darkfiberiru mentioned this pull request Jan 12, 2019
@darkfiberiru
Copy link
Contributor Author

darkfiberiru commented Jan 12, 2019

Also included activation of second white channel in last commit(oops) but this shouldn't be a problem for any rgbw bulbs as my92xx ignores any channels that don't exist. RGBWW gives a more mid range white temperature(two types of white leds 2000/6500 in my case) and brighter white light(more led's).

@darkfiberiru
Copy link
Contributor Author

Last comment before I got to bed. Everything is working as far as I can tell except occasionally I seem to be able to confuse bulb if I'm wildy changing color and brightness setings and get it stuck so web interface is no longer responsive to color changes until I restart bulb from web gui or power cycle bulb. Not sure if this is issue with update or existing issue

@stelgenhof
Copy link
Owner

@darkfiberiru Thanks for the work so far! As for the unresponsiveness, it is something I've noticed recently also. Not related to your PR. Not sure why this happens. The only thing is that I've upgraded the ESP8266 framework on my PC and ever since it started.

Seen this before, when the framework has been updated, some issue have been introduced.

Guess, I need to do some debugging/testing... :)

@lnxbil
Copy link

lnxbil commented Feb 3, 2019

Hey! This is great work! I tried to get it to work in arendst/Tasmota#1821 and forget about it. Just found the bulbs in my storage and thought that I should give them another try.

@darkfiberiru
Copy link
Contributor Author

@lnxbil Great to hear. I have one running and two left to program once I clean up my bench. Once programmed OTA flashing works great.

@stelgenhof Have you had any time to try this and make sure I didn't break older bulbs?

@stelgenhof
Copy link
Owner

@darkfiberiru Sorry not yet! I am hesitant to pull your PR as I first would like to assess the issue of the UI not being responsive (actually the device is resetting it self). Pulling in your PR would cloud the debugging of that :) (Your PR looks pretty good BTW).

Cheers! Sacha

@DavinKD
Copy link

DavinKD commented Feb 12, 2019

Just got my 2 Lohas bulbs I had in storage working using OTA flashing. I'm curious as to how others deal with the 2 white channels on this bulb. They both seem to be "cold".

@stelgenhof stelgenhof self-requested a review February 13, 2019 03:00
@stelgenhof
Copy link
Owner

@darkfiberiru

After doing some testing regarding the unresponsiveness of the firmware/UI, I have made some changes to the platformio.ini configuration. Basically locked down the versions of the ESP8266 framework and a few dependent libraries.

Please adjust the following in your platformio.ini file:
platform = espressif8266@1.5.0

lib_deps:
ArduinoJson@5.13.4
AsyncMqttClient@0.8.2

My tests showed some good results. Can you please have try with these settings as well? (Checkout the latest repository changes). If this seems to be working, then we have a solid base.

(Note: if this works, you may need to adjust this PR accordingly).

Cheers! Sacha

@darkfiberiru
Copy link
Contributor Author

Will try to get done this weekend

@stelgenhof
Copy link
Owner

@darkfiberiru Did a few minor updates today and a long run test, however can't seem to replicate the unresponsiveness issue now. I'll test with a few other light bulbs as well. (Not LOHAS ones though).

@darkfiberiru
Copy link
Contributor Author

@stelgenhof PR adjusted for clean merge my testing is going well.

Will also be investigating flashing lohas bulbs with https://github.com/ct-Open-Source/tuya-convert so I don't need to open them. @DavinKD Has successfully used that to flash tasmota on the lohas bulbs

@DavinKD
Copy link

DavinKD commented Feb 23, 2019

Keep in mind that the Lohas bulbs use different color channel order than the AILights. I don't believe the new template functionality can help with that, so I had to build a custom bin with changes.

@darkfiberiru
Copy link
Contributor Author

@DavinKD What channel order did you have to use on the tasmota firmware?The lohas bulbs I've worked with so far are RGBWW as expected(one more white then Ailight from my understanding.

@darkfiberiru
Copy link
Contributor Author

@stelgenhof Responsiveness issues seems resolved for me.

@stelgenhof
Copy link
Owner

@darkfiberiru Good to hear! I am still doing some other tests to try understand what the exact cause is. Likely related to the underlying ESP8266 library. I recall 2.4.0 had some issues.

@DavinKD
Copy link

DavinKD commented Feb 24, 2019

Here's the changes I made for my Lohas bulbs. Not being very familiar with the code yet, I may not have done it in the most appropriate way, but it worked for me. My bulbs are the br30 variety.

https://smile.amazon.com/gp/product/B07544GPWR/ref=oh_aui_search_asin_title?ie=UTF8&psc=1

Sonoff.ino
**FROM
else if (AILIGHT == my_module_type) { // RGBW led
light_type = LT_RGBW;
}

**TO
else if (AILIGHT == my_module_type) { // RGBW led
light_type = LT_RGBWC;
}

xdrv_04_light.ino
**FROM
uint8_t duty[2][6] = {{ duty_r, duty_g, duty_b, duty_w, 0, 0 }, // Definition for RGBW channels
{ duty_w, duty_c, 0, duty_g, duty_r, duty_b }}; // Definition for RGBWC channels

**TO
uint8_t duty[2][6] = {{ duty_r, duty_g, duty_b, duty_w, 0, 0 }, // Definition for RGBW channels
{ duty_r, duty_g, duty_b, duty_w, duty_c, 0 }}; // Definition for RGBWC channels

This bulb does have 2 white channels, but what I configured for warm is just a tiny less cold version of cold. No idea why they have 2 banks of cold leds instead of 1 cold, 1 warm. Maybe they just wanted a really bright cold white when both are turned on. The color temp difference I see could just be natural variations of the same leds.

@darkfiberiru
Copy link
Contributor Author

@stelgenhof Are we good to merge now?

@stelgenhof
Copy link
Owner

@darkfiberiru I'd like to merge, however I prefer to make a stable release first of the current code, and then merge your PR.

In case of any issues/bugs, debugging is hard when new code contains many changes. Especially with firmwares as debugging can be cumbersome (i.e. issues might be hard to replicate).

Hope that makes sense :)

Cheers! Sacha

@darkfiberiru
Copy link
Contributor Author

Definitely makes sense. Just wanted to make sure I didn't have any more needed todos.

@stelgenhof
Copy link
Owner

Thanks! I may do a release end of this week / early next week, hopefully.

@stelgenhof
Copy link
Owner

@darkfiberiru Today I have released v0.6.0 of the firmware. Is there anything you'd like to change/add to this PR? If not, then I'll merge it in the develop branch.

Cheers! Sacha

src/main.h Show resolved Hide resolved
@stelgenhof stelgenhof merged commit f6ca67b into stelgenhof:develop May 6, 2019
@darkfiberiru darkfiberiru deleted the MY92XX_CONVERSION branch August 3, 2019 02:21
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

4 participants