Skip to content

File TelemSchedule.h

File List > Firmware > Libraries > PowerMonitor > TelemSchedule.h

Go to the documentation of this file

#pragma once
#include <stdint.h>

namespace OpenSkyhawk {
namespace Pdu {

class TelemSchedule {
public:
    static constexpr uint8_t  PAGES           = 3;     
    static constexpr uint32_t TELEM_PERIOD_MS = 1000;  
    static constexpr uint32_t EDGE_MIN_MS     = 100;   

    void start(uint32_t nowMs);

    int8_t next(uint32_t nowMs, const uint8_t flags[PAGES], bool& periodic);

    void sent(uint8_t slot, uint8_t flags, uint32_t nowMs);

private:
    uint32_t _lastPeriodic = 0;
    uint8_t  _rr = 0;
    uint32_t _lastSent[PAGES]  = {};
    uint8_t  _lastFlags[PAGES] = {};
};

} // namespace Pdu
} // namespace OpenSkyhawk