410 {
411 const fl::u32 requested_mW =
413 if (requested_mW <= max_power_mW) {
414 return target_brightness;
415 }
416 if (controllable_mW == 0 || max_power_mW <= fixed_mW) {
417
418
419
420
421 return 0;
422 }
423
424
425
426
427
428
429
430
431
432
433
434
435 const fl::u32 headroom_mW = max_power_mW - fixed_mW;
438 if (allowed_scaled > target_scaled) {
439 allowed_scaled = target_scaled;
440 }
441 const fl::u32 recommended_scaled = static_cast<fl::u32>(allowed_scaled);
443
444
445
446
447
448
449
450
451
452 while (recommended > 0 &&
454 max_power_mW) {
455 --recommended;
456 }
457 return recommended;
458}
fl::u32 scale_power_for_brightness(fl::u32 total_mW, fl::u8 brightness) FL_NO_EXCEPT
Applies the configured power-scaling response to a total power value.
fl::u32 power_ratio_of_255(fl::u32 num, fl::u32 den) FL_NO_EXCEPT
min(255, floor(255 * num / den)) for den > 0, computed in 32-bit arithmetic.
static fl::u8 map_power_value(fl::u8 brightness) FL_NO_EXCEPT
static fl::u8 unmap_power_value(fl::u8 scaled_brightness) FL_NO_EXCEPT