Add repeater protocol and device firmware features

This commit is contained in:
Lars Nolden
2026-09-21 12:30:50 +02:00
parent 73d3ddf00c
commit a11a4b3b89
41 changed files with 7791 additions and 228 deletions
+23
View File
@@ -0,0 +1,23 @@
#pragma once
#include <stdint.h>
#define DUTY_LEDGER_BUCKET_US 60000000ULL
#define DUTY_LEDGER_WINDOW_US 3600000000ULL
#define DUTY_LEDGER_BUCKETS 61
typedef struct {
uint64_t minute_key; // uptime minute + 1; zero means unused
uint64_t airtime_us;
} duty_ledger_bucket_t;
typedef struct {
duty_ledger_bucket_t buckets[DUTY_LEDGER_BUCKETS];
} duty_ledger_t;
// Minute buckets conservatively include the whole oldest overlapping minute.
// The result can over-count by less than one minute, but never drops airtime
// that may still be inside the rolling-hour window.
uint64_t duty_ledger_used(const duty_ledger_t *ledger, int64_t now_us);
void duty_ledger_record(duty_ledger_t *ledger, int64_t now_us,
uint32_t airtime_us);