From ed0b2444f979ad187d72ecf45ccd2a55a484d5cf Mon Sep 17 00:00:00 2001 From: Maurice Makaay Date: Fri, 5 Mar 2021 13:17:37 +0100 Subject: [PATCH] Implemented temperature band 313 - 333 --- .yeelight_bs2.h.swp | Bin 0 -> 20480 bytes yeelight_bs2.h | 51 ++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 47 insertions(+), 4 deletions(-) create mode 100644 .yeelight_bs2.h.swp diff --git a/.yeelight_bs2.h.swp b/.yeelight_bs2.h.swp new file mode 100644 index 0000000000000000000000000000000000000000..6a2a3169d32e39a63221aac046e60f61f96fd7c9 GIT binary patch literal 20480 zcmeI3dyHIF8Njc!3YCYZMJ1Z(q1AS_?9R@E(g$owmu}mQ+ugdmROFHI?(Ci2ftk6( zy?1t9%OeKycZBnl`93V#R@jWHPfLlg}OMleIZu-#Pcr+?m;( ztyTWe+)aL+x#xYpbI$jj@4M5P%;C|4YDYS2@%LKG8a;RT-9J0N!5UGP<+*Mk$*cX% z+rFP$tq}Qxvvyz)I(~iLtvZ86w^l08MUMkZj#DYm%?E`UKQ|bENY9@@(@Bv;0*M5A zNuUvw26mij<#XB0rj6&S4eKxMRXWK_B#=lTkw7AWL;{Hf5(y*{NF?jiS{Q^!!)HE{zeECw1QH1(5=bPFNFb3wB7sB#i3Ab}Boas@ zkVxQvL<07#Wu3`bUlb>w_x}o`0MKZZx)5x4<%!&W#G&VcWpWm)&Y&2SUA za1~q$XTce83Oq+AAA^1Hw=*p3ukbWH1rNfla24cX4LotWW!(V<7=r__AI^cZ;a9J= ztQX)exCO>x1FVN<*D+rBG<+0pgQGAGYv7U7EbD!6DP-Xk_|d7B^$a`=H^DyG39o~% zzsj<{3J=3Wa1Y!8*TWnff=%$JS6bE|;TSvz--0i~?XUy|xB@PR(_k&!MPTK#P=qb; z3j#0SgD2rW_%K`xQ!ojq!_x$7z5$6Tg<`qAXjQ7fH?=5!Y4otmD_f?EmfImcJ7dES3$bVAk3HDB4D zqblyAVg@V*b@7 z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2Ku4rF-$ruv%yFFQ#BqP5)Ych`L zL3duqFIwq3zUMNvd9#WeXm0K_)=`m9vgGuM|k>>7w!EC-alHlOT zH;m_bI0iq3Z^IYhHdufw z;WD@sreQb89M(eemq;LyKq7%e0*M3?2_zCoB#=m;mjqUSFS2@x*lW(@&B=;yXOcH3 zDvTm7=Zh)*Cvm-aF3= 371) { float start = 371; @@ -156,6 +157,7 @@ class YeelightBedsideLampV2LightOutput : public Component, public LightOutput master1_->turn_on(); return; } + // Temperature band 334 - 370 else if (temperature >= 334) { float red_volt = (1.0f - brightness) * 2.86f; @@ -178,10 +180,51 @@ class YeelightBedsideLampV2LightOutput : public Component, public LightOutput master2_->turn_on(); master1_->turn_on(); return; - } else if (temperature >= 313) { - } else if (temperature >= 251) { - } else if (temperature >= 223) { - } else if (temperature >= HOME_ASSISTANT_MIRED_MIN) { + } + // Temperature band 313 - 333 + // + // TODO maybe check if we can git rid of a little bug in the original firmware. + // The light becomes noticably brighter when moving from temperature 334 to + // temperature 333. There's a little jump in the lighting output here. + // Possibly this is a switch from warm to cold lighting as imposed by the + // LED circuitry, making this unavoidable. However, it would be interesting + // to see if we can smoothen this out. For now, I'll keep the GPIO output + // for this bug-by-bug-compatible. + else if (temperature >= 313) + { + float red_volt = 2.89f - brightness * (2.89f - 0.32f); + float red = red_volt / volt_scaler; + + float green_volt = 2.96f - brightness * (2.96f - 1.03f); + float green = green_volt / volt_scaler; + + float blue = 1.0f; + + float white_volt = 0.42f + brightness * (2.43f - 0.42f); + float white = white_volt / volt_scaler; + + ESP_LOGD("temperature_mode", "LED voltages : RGBW %f, %f, %f, %f", red_volt, green_volt, 3.3f, white_volt); + ESP_LOGD("temperature_mode", "LED state : RGBW %f, %f, %f, %f", red, green, blue, white); + + red_->set_level(red); + green_->set_level(green); + blue_->set_level(blue); + white_->set_level(white); + master2_->turn_on(); + master1_->turn_on(); + return; + } + // Temperature band 251 - 312 + else if (temperature >= 251) + { + } + // Temperature band 223 - 250 + else if (temperature >= 223) + { + } + // Temperature band 153 - 222 + else if (temperature >= HOME_ASSISTANT_MIRED_MIN) + { } red_->set_level(0.5);