From 8041cfea539e1ac4215957e7c670ea692aa88f59 Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Sun, 11 Mar 2018 00:39:55 -0500 Subject: [PATCH] Tweak light brightness --- src/engine.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/engine.cpp b/src/engine.cpp index 2ce2d640..2cb94374 100644 --- a/src/engine.cpp +++ b/src/engine.cpp @@ -35,7 +35,9 @@ static float smoothValue; float Light::getBrightness() { - return sqrtf(fmaxf(0.f, value)); + // LEDs are diodes, so don't allow reverse current. + // For some reason, instead of the RMS, the sqrt of RMS looks better + return powf(fmaxf(0.f, value), 0.25f); } void Light::setBrightnessSmooth(float brightness, float frames) { @@ -92,14 +94,14 @@ static void engineStep() { // Step ports for (Input &input : module->inputs) { if (input.active) { - float value = input.value / 10.f; + float value = input.value / 5.f; input.plugLights[0].setBrightnessSmooth(value); input.plugLights[1].setBrightnessSmooth(-value); } } for (Output &output : module->outputs) { if (output.active) { - float value = output.value / 10.f; + float value = output.value / 5.f; output.plugLights[0].setBrightnessSmooth(value); output.plugLights[1].setBrightnessSmooth(-value); }