LCOV - code coverage report
Current view: top level - SITL - SIM_ToshibaLED.cpp (source / functions) Hit Total Coverage
Test: lcov.info Lines: 15 16 93.8 %
Date: 2026-09-09 11:02:08 Functions: 1 1 100.0 %

          Line data    Source code
       1             : #include "SIM_ToshibaLED.h"
       2             : 
       3             : #if AP_SIM_TOSHIBALED_ENABLED
       4             : 
       5             : #include <stdio.h>
       6             : 
       7   178759942 : void SITL::ToshibaLED::update(const class Aircraft &aircraft)
       8             : {
       9   357499392 :     if (last_print_pwm0 == get_register(ToshibaLEDDevReg::PWM0) &&
      10   357179182 :         last_print_pwm1 == get_register(ToshibaLEDDevReg::PWM1) &&
      11   535939124 :         last_print_pwm2 == get_register(ToshibaLEDDevReg::PWM2) &&
      12   178438440 :         last_print_enable == get_register(ToshibaLEDDevReg::ENABLE)) {
      13   178436431 :         return;
      14             :     }
      15             : 
      16      323511 :     last_print_pwm0 = get_register(ToshibaLEDDevReg::PWM0);
      17      323511 :     last_print_pwm1 = get_register(ToshibaLEDDevReg::PWM1);
      18      323511 :     last_print_pwm2 = get_register(ToshibaLEDDevReg::PWM2);
      19      323511 :     last_print_enable = get_register(ToshibaLEDDevReg::ENABLE);
      20             :     // GCS_SEND_TEXT(MAV_SEVERITY_INFO, "SIM_ToshibaLED: PWM0=%u PWM1=%u PWM2=%u ENABLE=%u", last_print_pwm0, last_print_pwm1, last_print_pwm2, last_print_enable);
      21             : 
      22      323511 :     if (get_register(ToshibaLEDDevReg::ENABLE)) {
      23             :         // here we convert from 0-15 BGR (the PWM values from the i2c bus)
      24             :         // to 0-255 RGB (what SIM_RGBLED wants):
      25      323511 :         rgbled.set_colours(
      26      323511 :             get_register(ToshibaLEDDevReg::PWM2) * 17,
      27      323511 :             get_register(ToshibaLEDDevReg::PWM1) * 17,
      28      323511 :             get_register(ToshibaLEDDevReg::PWM0) * 17
      29             :             );
      30             :     } else {
      31           0 :         rgbled.set_colours(0, 0, 0);
      32             :     }
      33             : }
      34             : 
      35             : #endif

Generated by: LCOV version 1.14