50 lines
1.7 KiB
C
50 lines
1.7 KiB
C
#pragma once
|
|
|
|
#include <stdint.h>
|
|
#include <stdbool.h>
|
|
|
|
typedef struct {
|
|
uint32_t rx_candidates; // sync matches handed to us by the radio
|
|
uint32_t rx_valid; // CRC-valid C1 frames
|
|
uint32_t rx_crc_fail;
|
|
uint32_t rx_not_c1; // sync matched but not C-mode (e.g. T1)
|
|
uint32_t rx_len_invalid;
|
|
uint32_t rx_bytes;
|
|
uint32_t tx_attempts;
|
|
uint32_t tx_success;
|
|
uint32_t tx_timeout;
|
|
uint64_t tx_airtime_us; // cumulative, for duty-cycle accounting
|
|
uint32_t tx_failures;
|
|
uint32_t tx_suppressed_dup;
|
|
uint32_t tx_suppressed_duty; // blocked by the duty-cycle guard
|
|
uint32_t tx_suppressed_whitelist;
|
|
uint32_t radio_reinit;
|
|
uint32_t fem_reinit;
|
|
uint32_t recoveries;
|
|
} repeater_stats_t;
|
|
|
|
typedef struct {
|
|
uint32_t repeat_delay_ms; // 20..200
|
|
uint32_t duty_budget_ppm; // rolling-hour TX airtime cap, 0 = disabled
|
|
uint32_t beacon_period_ms; // periodic synthetic test frame, 0 = off
|
|
int8_t tx_power_dbm; // configured SX1262 level, not radiated power
|
|
bool repeat_enabled;
|
|
bool verbose;
|
|
uint32_t whitelist[8]; // A-field ID (4 bytes LE as uint32), 0 = empty slot
|
|
int whitelist_len;
|
|
} repeater_cfg_t;
|
|
|
|
extern repeater_cfg_t g_cfg;
|
|
extern repeater_stats_t g_stats;
|
|
|
|
void repeater_start(void);
|
|
void repeater_request_radio_reset(void);
|
|
void repeater_request_test_tx(void);
|
|
void repeater_request_probe(void);
|
|
void repeater_set_test_lfield(uint8_t l);
|
|
void repeater_request_test_burst(void);
|
|
void repeater_inject_fault(int what); // 1 = standby, 2 = sleep
|
|
void repeater_print_status(void);
|
|
void repeater_print_stats(void);
|
|
void repeater_print_radio_status(void);
|