diff options
author | David Lamparter <equinox@diac24.net> | 2013-09-12 21:40:13 +0000 |
---|---|---|
committer | root <root@beaglebone.local.sublab.org> | 2013-09-12 21:40:27 +0000 |
commit | c8301c93099316060a6029b6da4a187e50a19c15 (patch) | |
tree | 54c821c135a2fa67f0b9cac5040beb578b49c243 /cethcan | |
parent | 66424c42f8ac346a43c110f1f0c35a65597cfb4d (diff) |
rpc: use less simple RGB for PARs
Diffstat (limited to 'cethcan')
-rw-r--r-- | cethcan/rpc.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/cethcan/rpc.c b/cethcan/rpc.c index ef0414f..fa11ecc 100644 --- a/cethcan/rpc.c +++ b/cethcan/rpc.c @@ -35,9 +35,11 @@ static int rpc_light_set(void *apparg, json_t *json_params, json_t **result) unsigned r, g, b; json_t *val = json_array_get(json_params, 1); - if (json_is_integer(val)) - r = g = b = json_integer_value(val); - else if (json_is_array(val)) { + if (json_is_integer(val)) { + r = json_integer_value(val); + g = (r * 180) / 255; + b = (r * 144) / 255; + } else if (json_is_array(val)) { if (json_unpack(val, "[iii]", &r, &g, &b)) { emsg = "failed to parse value array"; goto out_err; |