Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions examples/common/lora_interface/LoRaInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,13 @@ bool LoRaInterface::start() {
// begin(freq MHz, bw kHz, sf, cr, syncWord, power dBm, preamble symbols, LNA gain 0=AGC)
int state = chip->begin(frequency, bandwidth, spreading, coding,
RADIOLIB_SX127X_SYNC_WORD, power, 20, 0);
// SX127x hardware default leaves RxPayloadCrcOn=0 and RadioLib's
// SX127x::begin() does not touch it. Upstream RNode firmware enables
// CRC unconditionally (sx127x::enableCrc, RNode_Firmware.ino:531), so
// real RNodes silently drop frames without a CRC. Enable it here to
// interoperate. SX126x branches below inherit CRC-on from
// SX126x::begin() (setCRC(2)), so no explicit call is needed there.
if (state == RADIOLIB_ERR_NONE) state = chip->setCRC(true);

#elif defined(BOARD_RAK4631)
// nRF52: SPI pins must be configured before SPI.begin()
Expand Down
12 changes: 10 additions & 2 deletions src/Destination.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,16 @@ Packet Destination::announce(const Bytes& app_data, bool path_response, const In
else {
Bytes destination_hash = _object->_hash;
//p random_hash = Identity::get_random_hash()[0:5] << int(time.time()).to_bytes(5, "big")
// CBA TODO add in time to random hash
Bytes random_hash = Cryptography::random(Type::Identity::RANDOM_HASH_LENGTH/8);
// CBA Append 5-byte big-endian timestamp to random_hash
uint64_t now = (uint64_t)OS::time();
uint8_t time_bytes[5] = {
(uint8_t)((now >> 32) & 0xFF),
(uint8_t)((now >> 24) & 0xFF),
(uint8_t)((now >> 16) & 0xFF),
(uint8_t)((now >> 8) & 0xFF),
(uint8_t)( now & 0xFF)
};
Bytes random_hash = Cryptography::random(5) + Bytes(time_bytes, 5);

Bytes new_app_data(app_data);
if (new_app_data.empty() && !_object->_default_app_data.empty()) {
Expand Down
Loading