LCOV - code coverage report
Current view: top level - App/Src - appHeartbeat.cpp (source / functions) Coverage Total Hit
Test: filtered_coverage.info Lines: 83.3 % 18 15
Test Date: 2026-03-21 17:55:27 Functions: 66.7 % 3 2

            Line data    Source code
       1              : 
       2              : // Application include
       3              : #include "appHeartbeat.hpp"
       4              : 
       5              : namespace FreeRTOS_Cpp
       6              : {
       7              : 
       8              :     // Constructor initializes the private member handles
       9            3 :     AppHeartbeat::AppHeartbeat(IRTOS* rtos, IHardware* hw, void* sysEvents, void* wdgEvents)
      10            3 :         : _rtos(rtos), _hw(hw), _sysEvents(sysEvents), _wdgEvents(wdgEvents) 
      11              :     {
      12              : 
      13            3 :     }
      14              : 
      15            3 :     void AppHeartbeat::update() {
      16              :         // Logic uses the interface, not the raw RTOS/HAL calls
      17            3 :         uint32_t uxBits = _rtos->getEventBits(_sysEvents);
      18              : 
      19            3 :         if ((uxBits & EVENT_BIT_INIT_SUCCESS) != 0U) {
      20            1 :             _hw->toggleLed(HW_ID_STATUS_LED);
      21            1 :             _rtos->delay(DELAY_OPERATIONAL_MS);
      22            2 :         } else if ((uxBits & EVENT_BIT_INIT_FAILED) != 0U) {
      23            1 :             _hw->toggleLed(HW_ID_STATUS_LED);
      24            1 :             _rtos->delay(DELAY_INIT_MS);
      25              :         } else {
      26            1 :             _hw->toggleLed(HW_ID_STATUS_LED);
      27            1 :             _rtos->delay(DELAY_FAULT_MS);
      28              :         }
      29              :         
      30            3 :         _rtos->setEventBits(_wdgEvents, WATCHDOG_BIT_HEARTBEAT);
      31            3 :     }
      32              : 
      33            0 :     void AppHeartbeat::HeartBeatTask(void *pvParameters)
      34              :     {
      35            0 :         AppHeartbeat* self = static_cast<AppHeartbeat*>(pvParameters);
      36              :         for (;;)
      37              :         {
      38            0 :             self->update();
      39              :         }
      40              :     }
      41              : 
      42              : }
        

Generated by: LCOV version 2.0-1