diff --git a/src/cmnds/cmd_newLEDDriver.c b/src/cmnds/cmd_newLEDDriver.c index a677915cc..f5330c2bc 100644 --- a/src/cmnds/cmd_newLEDDriver.c +++ b/src/cmnds/cmd_newLEDDriver.c @@ -126,8 +126,8 @@ void apply_smart_light() { finalRGBCW[i] = baseColors[i] * g_brightness; } } - CHANNEL_Set(firstChannelIndex, value_cold_or_warm, CHANNEL_SET_FLAG_SKIP_MQTT); - CHANNEL_Set(firstChannelIndex+1, value_brightness, CHANNEL_SET_FLAG_SKIP_MQTT); + CHANNEL_Set(firstChannelIndex, value_cold_or_warm, CHANNEL_SET_FLAG_SKIP_MQTT | CHANNEL_SET_FLAG_SILENT); + CHANNEL_Set(firstChannelIndex+1, value_brightness, CHANNEL_SET_FLAG_SKIP_MQTT | CHANNEL_SET_FLAG_SILENT); } else { for(i = 0; i < 5; i++) { float raw, final; @@ -169,12 +169,12 @@ void apply_smart_light() { // We don't have RGB channels // so, do simple mapping if(i == 4) { - CHANNEL_Set(firstChannelIndex+0, final * g_cfg_colorScaleToChannel, CHANNEL_SET_FLAG_SKIP_MQTT); + CHANNEL_Set(firstChannelIndex+0, final * g_cfg_colorScaleToChannel, CHANNEL_SET_FLAG_SKIP_MQTT | CHANNEL_SET_FLAG_SILENT); } else if(i == 5) { - CHANNEL_Set(firstChannelIndex+1, final * g_cfg_colorScaleToChannel, CHANNEL_SET_FLAG_SKIP_MQTT); + CHANNEL_Set(firstChannelIndex+1, final * g_cfg_colorScaleToChannel, CHANNEL_SET_FLAG_SKIP_MQTT | CHANNEL_SET_FLAG_SILENT); } } else { - CHANNEL_Set(channelToUse, final * g_cfg_colorScaleToChannel, CHANNEL_SET_FLAG_SKIP_MQTT); + CHANNEL_Set(channelToUse, final * g_cfg_colorScaleToChannel, CHANNEL_SET_FLAG_SKIP_MQTT | CHANNEL_SET_FLAG_SILENT); } } } @@ -378,6 +378,28 @@ static int dimmer(const void *context, const char *cmd, const char *args, int cm //} //return 0; } +void LED_SetFinalRGB(byte r, byte g, byte b) { + g_lightMode = Light_RGB; + + baseColors[0] = r; + baseColors[1] = g; + baseColors[2] = b; + + RGBtoHSV(baseColors[0]/255.0f, baseColors[1]/255.0f, baseColors[2]/255.0f, &g_hsv_h, &g_hsv_s, &g_hsv_v); + + apply_smart_light(); + + // TODO + if(0) { + sendColorChange(); + if(CFG_HasFlag(OBK_FLAG_MQTT_BROADCASTLEDPARAMSTOGETHER)) { + LED_SendDimmerChange(); + } + if(CFG_HasFlag(OBK_FLAG_MQTT_BROADCASTLEDFINALCOLOR)) { + sendFinalColor(); + } + } +} int LED_SetBaseColor(const void *context, const char *cmd, const char *args, int bAll){ // support both '#' prefix and not const char *c = args; diff --git a/src/cmnds/cmd_public.h b/src/cmnds/cmd_public.h index 661d1b82c..52d7962de 100644 --- a/src/cmnds/cmd_public.h +++ b/src/cmnds/cmd_public.h @@ -91,6 +91,7 @@ void LED_SetTemperature(int tmpInteger, bool bApply); float LED_GetTemperature0to1Range(); void LED_SetDimmer(int iVal); int LED_SetBaseColor(const void *context, const char *cmd, const char *args, int bAll); +void LED_SetFinalRGB(byte r, byte g, byte b); void LED_SetEnableAll(int bEnable); int LED_GetEnableAll(); void LED_GetBaseColorString(char * s); diff --git a/src/httpserver/http_tcp_server.c b/src/httpserver/http_tcp_server.c index b88117302..e55c81b89 100644 --- a/src/httpserver/http_tcp_server.c +++ b/src/httpserver/http_tcp_server.c @@ -96,7 +96,7 @@ static void tcp_client_thread( beken_thread_arg_t arg ) //addLog( "TCP received string %s\n",buf ); // returns length to be sent if any - ADDLOG_DEBUG(LOG_FEATURE_HTTP, "TCP will process packet of len %i\n", request.receivedLen ); + // ADDLOG_DEBUG(LOG_FEATURE_HTTP, "TCP will process packet of len %i\n", request.receivedLen ); int lenret = HTTP_ProcessPacket(&request); if (lenret > 0){ ADDLOG_DEBUG(LOG_FEATURE_HTTP, "TCP sending reply len %i\n",lenret );