Mercurial > louis > mq > lightsd
changeset 403:1e272965942c
blublublu so confused
author | Louis Opter <kalessin@kalessin.fr> |
---|---|
date | Mon, 28 Dec 2015 02:30:53 -0800 |
parents | ab88f09a35e6 |
children | f5bd88afa0df |
files | add_power_transition.patch |
diffstat | 1 files changed, 34 insertions(+), 29 deletions(-) [+] |
line wrap: on
line diff
--- a/add_power_transition.patch Mon Dec 28 10:40:29 2015 +0100 +++ b/add_power_transition.patch Mon Dec 28 02:30:53 2015 -0800 @@ -20,7 +20,7 @@ ADD_SUBDIRECTORY(compat) ADD_SUBDIRECTORY(core) -+ADD_SUBDIRECTORY(effects) ++#ADD_SUBDIRECTORY(effects) ADD_SUBDIRECTORY(lifx) # 2.8.11 is the first version with TARGET_INCLUDE_DIRECTORIES: @@ -41,19 +41,10 @@ client.c console.c daemon.c -+ effect.c ++# effect.c jsmn.c jsonrpc.c listen.c -@@ -30,7 +30,7 @@ - ) - - TARGET_LINK_LIBRARIES( -- lightsd lifx ${EVENT2_CORE_LIBRARY} ${TIME_MONOTONIC_LIBRARY} -+ lightsd effects lifx ${EVENT2_CORE_LIBRARY} ${TIME_MONOTONIC_LIBRARY} - ) - - INSTALL(TARGETS lightsd RUNTIME DESTINATION bin) diff --git a/core/effect.c b/core/effect.c new file mode 100644 --- /dev/null @@ -472,7 +463,7 @@ #include "timer.h" #include "listen.h" #include "daemon.h" -+#include "effect.h" ++//#include "effect.h" #include "lightsd.h" struct lgtd_opts lgtd_opts = { @@ -480,7 +471,7 @@ lgtd_listen_close_all(); lgtd_command_pipe_close_all(); lgtd_client_close_all(); -+ lgtd_effect_stop_all(); ++ //lgtd_effect_stop_all(); lgtd_lifx_broadcast_close(); lgtd_lifx_gateway_close_all(); lgtd_timer_stop_all(); @@ -491,11 +482,11 @@ #include <event2/util.h> #include "lifx/wire_proto.h" -+#include "effects/power_transition.h" ++//#include "effects/power_transition.h" #include "time_monotonic.h" #include "lifx/bulb.h" #include "lifx/tagging.h" -@@ -59,22 +60,55 @@ +@@ -59,22 +60,59 @@ } void @@ -535,13 +526,16 @@ - struct lgtd_lifx_packet_power_state pkt = { .power = LGTD_LIFX_POWER_ON }; - SEND_RESULT( - client, lgtd_router_send(targets, LGTD_LIFX_SET_POWER_STATE, &pkt) -- ); + bool ok; -+ if (transition) { -+ } else { -+ struct lgtd_lifx_packet_power pkt = { .power = LGTD_LIFX_POWER_ON }; ++// if (transition) { ++// } else { ++ struct lgtd_lifx_packet_power pkt = { .power = 16384 }; + ok = lgtd_router_send(targets, LGTD_LIFX_SET_POWER, &pkt); -+ } ++ lgtd_info( ++ "sending POWER_STATE = %hu, (%f)", ++ pkt.power, pkt.power * 100. / UINT16_MAX + ); ++// } + + SEND_RESULT(client, ok); } @@ -557,7 +551,7 @@ struct lgtd_router_device_list *devices = NULL; devices = lgtd_router_targets_to_devices(targets); -@@ -85,6 +119,10 @@ +@@ -85,6 +123,10 @@ return; } @@ -568,7 +562,7 @@ struct lgtd_router_device *device; SLIST_FOREACH(device, devices, link) { struct lgtd_lifx_bulb *bulb = device->device; -@@ -101,14 +139,27 @@ +@@ -101,14 +143,27 @@ void lgtd_proto_power_off(struct lgtd_client *client, @@ -588,14 +582,14 @@ + } + + bool ok; -+ if (transition) { -+ ok = !!lgtd_effect_power_transition_off( -+ targets, LGTD_EFFECT_POWER_TRANSITION_OFF, transition -+ ); -+ } else { ++// if (transition) { ++// ok = !!lgtd_effect_power_transition_off( ++// targets, LGTD_EFFECT_POWER_TRANSITION_OFF, transition ++// ); ++// } else { + struct lgtd_lifx_packet_power pkt = { .power = LGTD_LIFX_POWER_OFF }; + ok = lgtd_router_send(targets, LGTD_LIFX_SET_POWER, &pkt); -+ } ++// } + + SEND_RESULT(client, ok); } @@ -916,7 +910,18 @@ .name = "SET_WAVEFORM_OPTIONAL", .type = LGTD_LIFX_SET_WAVEFORM_OPTIONAL }, -@@ -960,6 +965,14 @@ +@@ -954,12 +959,25 @@ + { + assert(pkt); + ++ lgtd_info( ++ "received POWER_STATE = %hu, (%f)", ++ pkt->power, pkt->power * 100. / UINT16_MAX ++ ); ++ + if (pkt->power != LGTD_LIFX_POWER_ON) { + pkt->power = LGTD_LIFX_POWER_OFF; + } } void