mirror of
https://github.com/meshtastic/firmware.git
synced 2026-01-01 15:40:49 +00:00
Merge branch 'master' into neighborinfo
This commit is contained in:
@@ -21,6 +21,7 @@ bool FloodingRouter::shouldFilterReceived(const meshtastic_MeshPacket *p)
|
||||
{
|
||||
if (wasSeenRecently(p)) { // Note: this will also add a recent packet record
|
||||
printPacket("Ignoring incoming msg, because we've already seen it", p);
|
||||
Router::cancelSending(p->from, p->id); // cancel rebroadcast of this message *if* there was already one
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -62,4 +63,4 @@ void FloodingRouter::sniffReceived(const meshtastic_MeshPacket *p, const meshtas
|
||||
}
|
||||
// handle the packet as normal
|
||||
Router::sniffReceived(p, c);
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,9 @@ template class SX126xInterface<SX1262>;
|
||||
template class SX126xInterface<SX1268>;
|
||||
template class SX126xInterface<LLCC68>;
|
||||
template class SX128xInterface<SX1280>;
|
||||
#ifdef ARCH_STM32WL
|
||||
template class SX126xInterface<STM32WLx>;
|
||||
#endif
|
||||
|
||||
#if HAS_ETHERNET
|
||||
#include "api/ethServerAPI.h"
|
||||
|
||||
@@ -27,6 +27,19 @@ class LockingArduinoHal : public ArduinoHal
|
||||
void spiEndTransaction() override;
|
||||
};
|
||||
|
||||
#if defined(USE_STM32WLx)
|
||||
/**
|
||||
* A wrapper for the RadioLib STM32WLx_Module class, that doesn't connect any pins as they are virtual
|
||||
*/
|
||||
class STM32WLx_ModuleWrapper : public STM32WLx_Module
|
||||
{
|
||||
public:
|
||||
STM32WLx_ModuleWrapper(LockingArduinoHal *hal, RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst,
|
||||
RADIOLIB_PIN_TYPE busy)
|
||||
: STM32WLx_Module(){};
|
||||
};
|
||||
#endif
|
||||
|
||||
class RadioLibInterface : public RadioInterface, protected concurrency::NotifiedWorkerThread
|
||||
{
|
||||
/// Used as our notification from the ISR
|
||||
@@ -56,7 +69,11 @@ class RadioLibInterface : public RadioInterface, protected concurrency::Notified
|
||||
|
||||
float currentLimit = 100; // 100mA OCP - Should be acceptable for RFM95/SX127x chipset.
|
||||
|
||||
#if !defined(USE_STM32WLx)
|
||||
Module module; // The HW interface to the radio
|
||||
#else
|
||||
STM32WLx_ModuleWrapper module;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* provides lowest common denominator RadioLib API
|
||||
|
||||
45
src/mesh/STM32WLE5JCInterface.cpp
Normal file
45
src/mesh/STM32WLE5JCInterface.cpp
Normal file
@@ -0,0 +1,45 @@
|
||||
#include "STM32WLE5JCInterface.h"
|
||||
#include "configuration.h"
|
||||
#include "error.h"
|
||||
|
||||
#ifndef STM32WLx_MAX_POWER
|
||||
#define STM32WLx_MAX_POWER 22
|
||||
#endif
|
||||
|
||||
#ifdef ARCH_STM32WL
|
||||
|
||||
STM32WLE5JCInterface::STM32WLE5JCInterface(LockingArduinoHal *hal, RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq,
|
||||
RADIOLIB_PIN_TYPE rst, RADIOLIB_PIN_TYPE busy)
|
||||
: SX126xInterface(hal, cs, irq, rst, busy)
|
||||
{
|
||||
}
|
||||
|
||||
bool STM32WLE5JCInterface::init()
|
||||
{
|
||||
RadioLibInterface::init();
|
||||
|
||||
lora.setRfSwitchTable(rfswitch_pins, rfswitch_table);
|
||||
|
||||
if (power == 0)
|
||||
power = STM32WLx_MAX_POWER;
|
||||
|
||||
if (power > STM32WLx_MAX_POWER) // This chip has lower power limits than some
|
||||
power = STM32WLx_MAX_POWER;
|
||||
|
||||
limitPower();
|
||||
|
||||
int res = lora.begin(getFreq(), bw, sf, cr, syncWord, power, preambleLength, tcxoVoltage);
|
||||
|
||||
LOG_INFO("STM32WLx init result %d\n", res);
|
||||
|
||||
LOG_INFO("Frequency set to %f\n", getFreq());
|
||||
LOG_INFO("Bandwidth set to %f\n", bw);
|
||||
LOG_INFO("Power output set to %d\n", power);
|
||||
|
||||
if (res == RADIOLIB_ERR_NONE)
|
||||
startReceive(); // start receiving
|
||||
|
||||
return res == RADIOLIB_ERR_NONE;
|
||||
}
|
||||
|
||||
#endif // ARCH_STM32WL
|
||||
31
src/mesh/STM32WLE5JCInterface.h
Normal file
31
src/mesh/STM32WLE5JCInterface.h
Normal file
@@ -0,0 +1,31 @@
|
||||
#pragma once
|
||||
|
||||
#include "SX126xInterface.h"
|
||||
|
||||
#ifdef ARCH_STM32WL
|
||||
|
||||
/**
|
||||
* Our adapter for STM32WLE5JC radios
|
||||
*/
|
||||
class STM32WLE5JCInterface : public SX126xInterface<STM32WLx>
|
||||
{
|
||||
public:
|
||||
STM32WLE5JCInterface(LockingArduinoHal *hal, RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq, RADIOLIB_PIN_TYPE rst,
|
||||
RADIOLIB_PIN_TYPE busy);
|
||||
|
||||
virtual bool init() override;
|
||||
};
|
||||
|
||||
// https://github.com/Seeed-Studio/LoRaWan-E5-Node/blob/main/Middlewares/Third_Party/SubGHz_Phy/stm32_radio_driver/radio_driver.c
|
||||
static const float tcxoVoltage = 1.7;
|
||||
|
||||
/* https://wiki.seeedstudio.com/LoRa-E5_STM32WLE5JC_Module/
|
||||
* Wio-E5 module ONLY transmits through RFO_HP
|
||||
* Receive: PA4=1, PA5=0
|
||||
* Transmit(high output power, SMPS mode): PA4=0, PA5=1 */
|
||||
static const RADIOLIB_PIN_TYPE rfswitch_pins[3] = {PA4, PA5, RADIOLIB_NC};
|
||||
|
||||
static const Module::RfSwitchMode_t rfswitch_table[4] = {
|
||||
{STM32WLx::MODE_IDLE, {LOW, LOW}}, {STM32WLx::MODE_RX, {HIGH, LOW}}, {STM32WLx::MODE_TX_HP, {LOW, HIGH}}, END_OF_MODE_TABLE};
|
||||
|
||||
#endif // ARCH_STM32WL
|
||||
Reference in New Issue
Block a user