@@ -78,10 +78,8 @@ std::optional<std::int32_t> PeripheralController::Light::getRawLightBrightness(i
7878 if (rawMaxBrightness != MAX_BRIGHTNESS) {
7979 brightness = brightness * ratio;
8080 }
81- if (DEBUG_LIGHT_DETAILS) {
82- ALOGD (" getRawLightBrightness rawLightId %d brightness 0x%x ratio %.2f" , rawLightId,
83- brightness, ratio);
84- }
81+ ALOGD_IF (DEBUG_LIGHT_DETAILS, " getRawLightBrightness rawLightId %d brightness 0x%x ratio %.2f" ,
82+ rawLightId, brightness, ratio);
8583 return brightness;
8684}
8785
@@ -97,10 +95,8 @@ void PeripheralController::Light::setRawLightBrightness(int32_t rawLightId, int3
9795 if (rawMaxBrightness != MAX_BRIGHTNESS) {
9896 brightness = ceil (brightness / ratio);
9997 }
100- if (DEBUG_LIGHT_DETAILS) {
101- ALOGD (" setRawLightBrightness rawLightId %d brightness 0x%x ratio %.2f" , rawLightId,
102- brightness, ratio);
103- }
98+ ALOGD_IF (DEBUG_LIGHT_DETAILS, " setRawLightBrightness rawLightId %d brightness 0x%x ratio %.2f" ,
99+ rawLightId, brightness, ratio);
104100 context.setLightBrightness (rawLightId, brightness);
105101}
106102
@@ -453,10 +449,9 @@ void PeripheralController::configureLights() {
453449 if (rawInfo->flags .test (InputLightClass::GLOBAL)) {
454450 rawGlobalId = rawId;
455451 }
456- if (DEBUG_LIGHT_DETAILS) {
457- ALOGD (" Light rawId %d name %s max %d flags %s \n " , rawInfo->id , rawInfo->name .c_str (),
458- rawInfo->maxBrightness .value_or (MAX_BRIGHTNESS), rawInfo->flags .string ().c_str ());
459- }
452+ ALOGD_IF (DEBUG_LIGHT_DETAILS, " Light rawId %d name %s max %d flags %s\n " , rawInfo->id ,
453+ rawInfo->name .c_str (), rawInfo->maxBrightness .value_or (MAX_BRIGHTNESS),
454+ rawInfo->flags .string ().c_str ());
460455 }
461456
462457 // Construct a player ID light
@@ -473,10 +468,8 @@ void PeripheralController::configureLights() {
473468 }
474469 // Construct a RGB light for composed RGB light
475470 if (hasRedLed && hasGreenLed && hasBlueLed) {
476- if (DEBUG_LIGHT_DETAILS) {
477- ALOGD (" Rgb light ids [%d, %d, %d] \n " , rawRgbIds.at (LightColor::RED),
478- rawRgbIds.at (LightColor::GREEN), rawRgbIds.at (LightColor::BLUE));
479- }
471+ ALOGD_IF (DEBUG_LIGHT_DETAILS, " Rgb light ids [%d, %d, %d]\n " , rawRgbIds.at (LightColor::RED),
472+ rawRgbIds.at (LightColor::GREEN), rawRgbIds.at (LightColor::BLUE));
480473 bool isKeyboardBacklight = keyboardBacklightIds.find (rawRgbIds.at (LightColor::RED)) !=
481474 keyboardBacklightIds.end () &&
482475 keyboardBacklightIds.find (rawRgbIds.at (LightColor::GREEN)) !=
@@ -518,19 +511,17 @@ void PeripheralController::configureLights() {
518511 // If the node is multi-color led, construct a MULTI_COLOR light
519512 if (rawInfo.flags .test (InputLightClass::MULTI_INDEX) &&
520513 rawInfo.flags .test (InputLightClass::MULTI_INTENSITY)) {
521- if (DEBUG_LIGHT_DETAILS) {
522- ALOGD (" Multicolor light Id %d name %s \n " , rawInfo.id , rawInfo.name .c_str ());
523- }
514+ ALOGD_IF (DEBUG_LIGHT_DETAILS, " Multicolor light Id %d name %s\n " , rawInfo.id ,
515+ rawInfo.name .c_str ());
524516 std::unique_ptr<Light> light =
525517 std::make_unique<MultiColorLight>(getDeviceContext (), rawInfo.name , ++mNextId ,
526518 type, rawInfo.id );
527519 mLights .insert_or_assign (light->id , std::move (light));
528520 continue ;
529521 }
530522 // Construct a Mono LED light
531- if (DEBUG_LIGHT_DETAILS) {
532- ALOGD (" Mono light Id %d name %s \n " , rawInfo.id , rawInfo.name .c_str ());
533- }
523+ ALOGD_IF (DEBUG_LIGHT_DETAILS, " Mono light Id %d name %s\n " , rawInfo.id ,
524+ rawInfo.name .c_str ());
534525 std::unique_ptr<Light> light = std::make_unique<MonoLight>(getDeviceContext (), rawInfo.name ,
535526 ++mNextId , type, rawInfo.id );
536527
@@ -552,10 +543,8 @@ bool PeripheralController::setLightColor(int32_t lightId, int32_t color) {
552543 return false ;
553544 }
554545 auto & light = it->second ;
555- if (DEBUG_LIGHT_DETAILS) {
556- ALOGD (" setLightColor lightId %d type %s color 0x%x" , lightId,
557- ftl::enum_string (light->type ).c_str (), color);
558- }
546+ ALOGD_IF (DEBUG_LIGHT_DETAILS, " setLightColor lightId %d type %s color 0x%x" , lightId,
547+ ftl::enum_string (light->type ).c_str (), color);
559548 return light->setLightColor (color);
560549}
561550
@@ -566,10 +555,8 @@ std::optional<int32_t> PeripheralController::getLightColor(int32_t lightId) {
566555 }
567556 auto & light = it->second ;
568557 std::optional<int32_t > color = light->getLightColor ();
569- if (DEBUG_LIGHT_DETAILS) {
570- ALOGD (" getLightColor lightId %d type %s color 0x%x" , lightId,
571- ftl::enum_string (light->type ).c_str (), color.value_or (0 ));
572- }
558+ ALOGD_IF (DEBUG_LIGHT_DETAILS, " getLightColor lightId %d type %s color 0x%x" , lightId,
559+ ftl::enum_string (light->type ).c_str (), color.value_or (0 ));
573560 return color;
574561}
575562
0 commit comments