Files
DD3-LoRa-Bridge-MultiSender/include/lora_transport.h
acidburns 8e6c64a18e Reduce sender power draw (RX windows + CPU/WiFi/ADC/pins)
- Add LoRa idle/sleep/receive-window helpers and use short RX windows for ACK/time sync

- Schedule sender time-sync windows (fast/slow) and track RX vs sleep time in debug

- Lower sender power (80 MHz CPU, WiFi/BT off, reduced ADC sampling, unused pins pulldown)

- Make SERIAL_DEBUG_MODE a build flag, add prod envs with debug off, and document changes
2026-02-02 21:44:04 +01:00

26 lines
580 B
C++

#pragma once
#include <Arduino.h>
#include "config.h"
constexpr size_t LORA_MAX_PAYLOAD = 230;
struct LoraPacket {
uint8_t protocol_version;
DeviceRole role;
uint16_t device_id_short;
PayloadType payload_type;
uint8_t payload[LORA_MAX_PAYLOAD];
size_t payload_len;
int16_t rssi_dbm;
float snr_db;
};
void lora_init();
bool lora_send(const LoraPacket &pkt);
bool lora_receive(LoraPacket &pkt, uint32_t timeout_ms);
void lora_idle();
void lora_sleep();
bool lora_receive_window(LoraPacket &pkt, uint32_t timeout_ms);
uint32_t lora_airtime_ms(size_t packet_len);