|
@@ -185,7 +185,7 @@ static bool _light_percent_to_raw(light_context_t *ctx, double inpercent, uint64
|
185
|
185
|
else
|
186
|
186
|
target_value_d = max_value_d * (light_percent_clamp(inpercent) / 100.0);
|
187
|
187
|
uint64_t target_value = LIGHT_CLAMP((uint64_t)target_value_d, 0, max_value);
|
188
|
|
- *outraw = target_value;
|
|
188
|
+ *outraw = round(target_value);
|
189
|
189
|
|
190
|
190
|
return true;
|
191
|
191
|
}
|
|
@@ -880,7 +880,7 @@ bool light_cmd_add_brightness(light_context_t *ctx)
|
880
|
880
|
return false;
|
881
|
881
|
}
|
882
|
882
|
|
883
|
|
- uint64_t value = 0;
|
|
883
|
+ uint64_t value = 0, new_value = 0;
|
884
|
884
|
if(!target->get_value(target, &value))
|
885
|
885
|
{
|
886
|
886
|
LIGHT_ERR("failed to read from target");
|
|
@@ -909,11 +909,15 @@ bool light_cmd_add_brightness(light_context_t *ctx)
|
909
|
909
|
return false;
|
910
|
910
|
}
|
911
|
911
|
percent += ctx->run_params.float_value;
|
912
|
|
- if(!_light_percent_to_raw(ctx, percent, &value))
|
|
912
|
+ if(!_light_percent_to_raw(ctx, percent, &new_value))
|
913
|
913
|
{
|
914
|
914
|
LIGHT_ERR("failed to convert value from percent to raw for device target");
|
915
|
915
|
return false;
|
916
|
|
- }
|
|
916
|
+ }
|
|
917
|
+ if(new_value <= value)
|
|
918
|
+ value += 1;
|
|
919
|
+ else
|
|
920
|
+ value = new_value;
|
917
|
921
|
break;
|
918
|
922
|
}
|
919
|
923
|
|
|
@@ -976,7 +980,7 @@ bool light_cmd_sub_brightness(light_context_t *ctx)
|
976
|
980
|
{
|
977
|
981
|
LIGHT_ERR("failed to convert value from percent to raw for device target");
|
978
|
982
|
return false;
|
979
|
|
- }
|
|
983
|
+ }
|
980
|
984
|
break;
|
981
|
985
|
}
|
982
|
986
|
|