mirror of
https://github.com/meshtastic/firmware.git
synced 2026-01-31 22:21:51 +00:00
Compare commits
9 Commits
adaptive-t
...
v2.7.11.ee
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b28d095096 | ||
|
|
17afdb9ccf | ||
|
|
d5164b4fbf | ||
|
|
ad44940732 | ||
|
|
8b466b1db3 | ||
|
|
f9937967fa | ||
|
|
4fd568f384 | ||
|
|
b08e4efb78 | ||
|
|
ee6857511a |
52
boards/r1-neo.json
Normal file
52
boards/r1-neo.json
Normal file
@@ -0,0 +1,52 @@
|
||||
{
|
||||
"build": {
|
||||
"arduino": {
|
||||
"ldscript": "nrf52840_s140_v6.ld"
|
||||
},
|
||||
"core": "nRF5",
|
||||
"cpu": "cortex-m4",
|
||||
"extra_flags": "-DARDUINO_NRF52840_FEATHER -DNRF52840_XXAA",
|
||||
"f_cpu": "64000000L",
|
||||
"hwids": [
|
||||
["0x239A", "0x8029"],
|
||||
["0x239A", "0x0029"],
|
||||
["0x239A", "0x002A"],
|
||||
["0x239A", "0x802A"]
|
||||
],
|
||||
"usb_product": "Muzi R1 Neo",
|
||||
"mcu": "nrf52840",
|
||||
"variant": "r1-neo",
|
||||
"bsp": {
|
||||
"name": "adafruit"
|
||||
},
|
||||
"softdevice": {
|
||||
"sd_flags": "-DS140",
|
||||
"sd_name": "s140",
|
||||
"sd_version": "6.1.1",
|
||||
"sd_fwid": "0x00B6"
|
||||
},
|
||||
"bootloader": {
|
||||
"settings_addr": "0xFF000"
|
||||
}
|
||||
},
|
||||
"connectivity": ["bluetooth"],
|
||||
"debug": {
|
||||
"jlink_device": "nRF52840_xxAA",
|
||||
"svd_path": "nrf52840.svd",
|
||||
"openocd_target": "nrf52840-mdk-rs"
|
||||
},
|
||||
"frameworks": ["arduino", "freertos"],
|
||||
"name": "WisCore RAK4631 Board",
|
||||
"upload": {
|
||||
"maximum_ram_size": 248832,
|
||||
"maximum_size": 815104,
|
||||
"speed": 115200,
|
||||
"protocol": "nrfutil",
|
||||
"protocols": ["jlink", "nrfjprog", "nrfutil", "stlink"],
|
||||
"use_1200bps_touch": true,
|
||||
"require_upload_port": true,
|
||||
"wait_for_upload_port": true
|
||||
},
|
||||
"url": "https://muzi.works/",
|
||||
"vendor": "Muzi Works"
|
||||
}
|
||||
Submodule protobufs updated: 082bb7cfeb...5fa4c44d91
@@ -25,8 +25,8 @@ ScanI2C::FoundDevice ScanI2C::firstScreen() const
|
||||
|
||||
ScanI2C::FoundDevice ScanI2C::firstRTC() const
|
||||
{
|
||||
ScanI2C::DeviceType types[] = {RTC_RV3028, RTC_PCF8563};
|
||||
return firstOfOrNONE(2, types);
|
||||
ScanI2C::DeviceType types[] = {RTC_RV3028, RTC_PCF8563, RTC_RX8130CE};
|
||||
return firstOfOrNONE(3, types);
|
||||
}
|
||||
|
||||
ScanI2C::FoundDevice ScanI2C::firstKeyboard() const
|
||||
|
||||
@@ -14,6 +14,7 @@ class ScanI2C
|
||||
SCREEN_ST7567,
|
||||
RTC_RV3028,
|
||||
RTC_PCF8563,
|
||||
RTC_RX8130CE,
|
||||
CARDKB,
|
||||
TDECKKB,
|
||||
BBQ10KB,
|
||||
|
||||
@@ -197,6 +197,9 @@ void ScanI2CTwoWire::scanPort(I2CPort port, uint8_t *address, uint8_t asize)
|
||||
#ifdef PCF8563_RTC
|
||||
SCAN_SIMPLE_CASE(PCF8563_RTC, RTC_PCF8563, "PCF8563", (uint8_t)addr.address)
|
||||
#endif
|
||||
#ifdef RX8130CE_RTC
|
||||
SCAN_SIMPLE_CASE(RX8130CE_RTC, RTC_RX8130CE, "RX8130CE", (uint8_t)addr.address)
|
||||
#endif
|
||||
|
||||
case CARDKB_ADDR:
|
||||
// Do we have the RAK14006 instead?
|
||||
|
||||
@@ -109,6 +109,35 @@ RTCSetResult readFromRTC()
|
||||
}
|
||||
return RTCSetResultSuccess;
|
||||
}
|
||||
#elif defined(RX8130CE_RTC)
|
||||
if (rtc_found.address == RX8130CE_RTC) {
|
||||
uint32_t now = millis();
|
||||
ArtronShop_RX8130CE rtc(&Wire);
|
||||
tm t;
|
||||
if (rtc.getTime(&t)) {
|
||||
tv.tv_sec = gm_mktime(&t);
|
||||
tv.tv_usec = 0;
|
||||
|
||||
uint32_t printableEpoch = tv.tv_sec; // Print lib only supports 32 bit but time_t can be 64 bit on some platforms
|
||||
LOG_DEBUG("Read RTC time from RX8130CE getDateTime as %02d-%02d-%02d %02d:%02d:%02d (%ld)", t.tm_year + 1900,
|
||||
t.tm_mon + 1, t.tm_mday, t.tm_hour, t.tm_min, t.tm_sec, printableEpoch);
|
||||
#ifdef BUILD_EPOCH
|
||||
if (tv.tv_sec < BUILD_EPOCH) {
|
||||
if (Throttle::isWithinTimespanMs(lastTimeValidationWarning, TIME_VALIDATION_WARNING_INTERVAL_MS) == false) {
|
||||
LOG_WARN("Ignore time (%ld) before build epoch (%ld)!", printableEpoch, BUILD_EPOCH);
|
||||
lastTimeValidationWarning = millis();
|
||||
}
|
||||
return RTCSetResultInvalidTime;
|
||||
}
|
||||
#endif
|
||||
if (currentQuality == RTCQualityNone) {
|
||||
timeStartMsec = now;
|
||||
zeroOffsetSecs = tv.tv_sec;
|
||||
currentQuality = RTCQualityDevice;
|
||||
}
|
||||
return RTCSetResultSuccess;
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (!gettimeofday(&tv, NULL)) {
|
||||
uint32_t now = millis();
|
||||
@@ -214,6 +243,17 @@ RTCSetResult perhapsSetRTC(RTCQuality q, const struct timeval *tv, bool forceUpd
|
||||
LOG_DEBUG("PCF8563_RTC setDateTime %02d-%02d-%02d %02d:%02d:%02d (%ld)", t->tm_year + 1900, t->tm_mon + 1, t->tm_mday,
|
||||
t->tm_hour, t->tm_min, t->tm_sec, printableEpoch);
|
||||
}
|
||||
#elif defined(RX8130CE_RTC)
|
||||
if (rtc_found.address == RX8130CE_RTC) {
|
||||
ArtronShop_RX8130CE rtc(&Wire);
|
||||
tm *t = gmtime(&tv->tv_sec);
|
||||
if (rtc.setTime(*t)) {
|
||||
LOG_DEBUG("RX8130CE setDateTime %02d-%02d-%02d %02d:%02d:%02d (%ld)", t->tm_year + 1900, t->tm_mon + 1,
|
||||
t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec, printableEpoch);
|
||||
} else {
|
||||
LOG_WARN("Failed to set time for RX8130CE");
|
||||
}
|
||||
}
|
||||
#elif defined(ARCH_ESP32)
|
||||
settimeofday(tv, NULL);
|
||||
#endif
|
||||
|
||||
@@ -4,6 +4,10 @@
|
||||
#include "sys/time.h"
|
||||
#include <Arduino.h>
|
||||
|
||||
#ifdef RX8130CE_RTC
|
||||
#include <ArtronShop_RX8130CE.h>
|
||||
#endif
|
||||
|
||||
enum RTCQuality {
|
||||
|
||||
/// We haven't had our RTC set yet
|
||||
|
||||
@@ -279,7 +279,7 @@ int32_t ButtonThread::runOnce()
|
||||
if (!userButton.isIdle() || waitingForLongPress) {
|
||||
return 50;
|
||||
}
|
||||
return INT32_MAX;
|
||||
return 100; // FIXME: Why can't we rely on interrupts and use INT32_MAX here?
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -297,6 +297,12 @@ void printInfo()
|
||||
#ifndef PIO_UNIT_TESTING
|
||||
void setup()
|
||||
{
|
||||
#if defined(R1_NEO)
|
||||
pinMode(DCDC_EN_HOLD, OUTPUT);
|
||||
digitalWrite(DCDC_EN_HOLD, HIGH);
|
||||
pinMode(NRF_ON, OUTPUT);
|
||||
digitalWrite(NRF_ON, HIGH);
|
||||
#endif
|
||||
|
||||
#if defined(PIN_POWER_EN)
|
||||
pinMode(PIN_POWER_EN, OUTPUT);
|
||||
|
||||
@@ -303,16 +303,4 @@ template <typename T> bool LR11x0Interface<T>::sleep()
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <typename T> bool LR11x0Interface<T>::setRadioCodingRate(uint8_t cr)
|
||||
{
|
||||
int state = lora.setCodingRate(cr);
|
||||
if (state != RADIOLIB_ERR_NONE) {
|
||||
LOG_WARN("Failed to set coding rate to 4/%d, error %d", cr, state);
|
||||
return false;
|
||||
}
|
||||
LOG_DEBUG("Set coding rate to 4/%d", cr);
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -65,8 +65,5 @@ template <class T> class LR11x0Interface : public RadioLibInterface
|
||||
virtual void addReceiveMetadata(meshtastic_MeshPacket *mp) override;
|
||||
|
||||
virtual void setStandby() override;
|
||||
|
||||
/// Efficient method to set coding rate without full reconfiguration
|
||||
virtual bool setRadioCodingRate(uint8_t cr) override;
|
||||
};
|
||||
#endif
|
||||
@@ -221,14 +221,6 @@ bool NextHopRouter::stopRetransmission(GlobalPacketId key)
|
||||
auto old = findPendingPacket(key);
|
||||
if (old) {
|
||||
auto p = old->packet;
|
||||
|
||||
// Restore original coding rate since retransmissions are no longer needed
|
||||
if (iface) {
|
||||
if (iface->restoreOriginalCodingRate()) {
|
||||
LOG_DEBUG("Restored default CR after successful ACK for packet 0x%x", p->id);
|
||||
}
|
||||
}
|
||||
|
||||
/* Only when we already transmitted a packet via LoRa, we will cancel the packet in the Tx queue
|
||||
to avoid canceling a transmission if it was ACKed super fast via MQTT */
|
||||
if (old->numRetransmissions < NUM_RELIABLE_RETX - 1) {
|
||||
@@ -288,11 +280,6 @@ int32_t NextHopRouter::doRetransmissions()
|
||||
// FIXME, handle 51 day rolloever here!!!
|
||||
if (p.nextTxMsec <= now) {
|
||||
if (p.numRetransmissions == 0) {
|
||||
// Final failure - restore original coding rate before giving up
|
||||
if (iface) {
|
||||
iface->restoreOriginalCodingRate();
|
||||
}
|
||||
|
||||
if (isFromUs(p.packet)) {
|
||||
LOG_DEBUG("Reliable send failed, returning a nak for fr=0x%x,to=0x%x,id=0x%x", p.packet->from, p.packet->to,
|
||||
p.packet->id);
|
||||
@@ -305,23 +292,6 @@ int32_t NextHopRouter::doRetransmissions()
|
||||
LOG_DEBUG("Sending retransmission fr=0x%x,to=0x%x,id=0x%x, tries left=%d", p.packet->from, p.packet->to,
|
||||
p.packet->id, p.numRetransmissions);
|
||||
|
||||
// Calculate retry count (NUM_RELIABLE_RETX-1 = 2 initially, counts down)
|
||||
uint8_t retryCount = (NUM_RELIABLE_RETX - 1) - p.numRetransmissions;
|
||||
|
||||
LOG_DEBUG("Retransmit packet id=0x%x, numRetransmissions=%d, retryCount=%d", p.packet->id, p.numRetransmissions,
|
||||
retryCount);
|
||||
|
||||
// Apply adaptive coding rate for better reliability on retries
|
||||
bool adaptiveCrApplied = false;
|
||||
if (iface) {
|
||||
adaptiveCrApplied = iface->setAdaptiveCodingRate(retryCount);
|
||||
if (adaptiveCrApplied) {
|
||||
LOG_INFO("Applied adaptive coding rate for retry %d", retryCount);
|
||||
} else {
|
||||
LOG_DEBUG("No adaptive coding rate change needed for retry %d", retryCount);
|
||||
}
|
||||
}
|
||||
|
||||
if (!isBroadcast(p.packet->to)) {
|
||||
if (p.numRetransmissions == 1) {
|
||||
// Last retransmission, reset next_hop (fallback to FloodingRouter)
|
||||
@@ -342,7 +312,7 @@ int32_t NextHopRouter::doRetransmissions()
|
||||
FloodingRouter::send(packetPool.allocCopy(*p.packet));
|
||||
}
|
||||
|
||||
// Queue again for next retry
|
||||
// Queue again
|
||||
--p.numRetransmissions;
|
||||
setNextTx(&p);
|
||||
}
|
||||
|
||||
@@ -337,17 +337,4 @@ bool RF95Interface::sleep()
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool RF95Interface::setRadioCodingRate(uint8_t cr)
|
||||
{
|
||||
// Direct hardware call for efficient coding rate change
|
||||
int state = lora->setCodingRate(cr);
|
||||
if (state != RADIOLIB_ERR_NONE) {
|
||||
LOG_WARN("Failed to set coding rate to 4/%d, error %d", cr, state);
|
||||
return false;
|
||||
}
|
||||
LOG_DEBUG("Set coding rate to 4/%d", cr);
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -65,9 +65,6 @@ class RF95Interface : public RadioLibInterface
|
||||
*/
|
||||
virtual void configHardwareForSend() override;
|
||||
|
||||
/// Efficient method to set coding rate without full reconfiguration
|
||||
virtual bool setRadioCodingRate(uint8_t cr) override;
|
||||
|
||||
private:
|
||||
/** Some boards require GPIO control of tx vs rx paths */
|
||||
void setTransmitEnable(bool txon);
|
||||
|
||||
@@ -529,7 +529,7 @@ void RadioInterface::applyModemConfig()
|
||||
cr = 5;
|
||||
sf = 10;
|
||||
break;
|
||||
default: // Config_LoRaConfig_ModemPreset_LONG_FAST is default
|
||||
default: // Config_LoRaConfig_ModemPreset_LONG_FAST is default. Gracefully use this is preset is something illegal.
|
||||
bw = (myRegion->wideLora) ? 812.5 : 250;
|
||||
cr = 5;
|
||||
sf = 11;
|
||||
@@ -563,7 +563,6 @@ void RadioInterface::applyModemConfig()
|
||||
if (bw == 1600)
|
||||
bw = 1625.0;
|
||||
}
|
||||
originalCr = cr;
|
||||
|
||||
if ((myRegion->freqEnd - myRegion->freqStart) < bw / 1000) {
|
||||
static const char *err_string = "Regional frequency range is smaller than bandwidth. Fall back to default preset";
|
||||
@@ -637,10 +636,6 @@ void RadioInterface::applyModemConfig()
|
||||
LOG_INFO("channel_num: %d", channel_num + 1);
|
||||
LOG_INFO("frequency: %f", getFreq());
|
||||
LOG_INFO("Slot time: %u msec", slotTimeMsec);
|
||||
|
||||
// Save the original coding rate for potential adaptive retransmissions
|
||||
originalCr = cr;
|
||||
LOG_DEBUG("Default coding rate: 4/%d", originalCr);
|
||||
}
|
||||
|
||||
/** Slottime is the time to detect a transmission has started, consisting of:
|
||||
@@ -729,65 +724,3 @@ size_t RadioInterface::beginSending(meshtastic_MeshPacket *p)
|
||||
sendingPacket = p;
|
||||
return p->encrypted.size + sizeof(PacketHeader);
|
||||
}
|
||||
|
||||
bool RadioInterface::setAdaptiveCodingRate(uint8_t retryCount)
|
||||
{
|
||||
// Save original coding rate if this is the first retry
|
||||
if (retryCount == 0) {
|
||||
originalCr = cr;
|
||||
}
|
||||
|
||||
// Progressive coding rate adaptation for better reliability
|
||||
// Calculate the target coding rate based on retry count
|
||||
uint8_t newCr;
|
||||
|
||||
if (originalCr == 5) {
|
||||
// Special progression for default CR 5: 5 -> 7 -> 8 -> 8 (skip 6)
|
||||
switch (retryCount) {
|
||||
case 0:
|
||||
newCr = 7;
|
||||
break; // Skip 6, go to 7
|
||||
case 1:
|
||||
newCr = 8;
|
||||
break; // Maximum robustness
|
||||
case 2:
|
||||
newCr = 8;
|
||||
break; // Stay at maximum
|
||||
default:
|
||||
newCr = 8;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
// Standard progression for other coding rates
|
||||
newCr = originalCr + retryCount + 1;
|
||||
// Clamp to maximum coding rate of 8
|
||||
if (newCr > 8) {
|
||||
newCr = 8;
|
||||
}
|
||||
}
|
||||
|
||||
// Apply the calculated coding rate for this retry
|
||||
LOG_INFO("Adaptive coding rate: retry %d, changing CR from 4/%d to 4/%d", retryCount, cr, newCr);
|
||||
cr = newCr;
|
||||
// Use the more efficient direct coding rate change method if available
|
||||
return setRadioCodingRate(cr);
|
||||
}
|
||||
|
||||
bool RadioInterface::restoreOriginalCodingRate()
|
||||
{
|
||||
if (cr != originalCr) {
|
||||
LOG_INFO("Restoring original coding rate from 4/%d to 4/%d", cr, originalCr);
|
||||
cr = originalCr;
|
||||
// Use the more efficient direct coding rate change method if available
|
||||
return setRadioCodingRate(cr);
|
||||
}
|
||||
|
||||
return false; // No change made
|
||||
}
|
||||
|
||||
bool RadioInterface::setRadioCodingRate(uint8_t cr)
|
||||
{
|
||||
// Default implementation falls back to full reconfigure
|
||||
// Subclasses should override this for more efficient direct coding rate changes
|
||||
return reconfigure();
|
||||
}
|
||||
|
||||
@@ -83,7 +83,6 @@ class RadioInterface
|
||||
float bw = 125;
|
||||
uint8_t sf = 9;
|
||||
uint8_t cr = 5;
|
||||
uint8_t originalCr = cr; // Store original coding rate for restoration after adaptive retransmissions
|
||||
|
||||
const uint8_t NUM_SYM_CAD = 2; // Number of symbols used for CAD, 2 is the default since RadioLib 6.3.0 as per AN1200.48
|
||||
const uint8_t NUM_SYM_CAD_24GHZ = 4; // Number of symbols used for CAD in 2.4 GHz, 4 is recommended in AN1200.22 of SX1280
|
||||
@@ -157,14 +156,6 @@ class RadioInterface
|
||||
/** Attempt to find a packet in the TxQueue. Returns true if the packet was found. */
|
||||
virtual bool findInTxQueue(NodeNum from, PacketId id) { return false; }
|
||||
|
||||
/**
|
||||
* Get the frequency we saved.
|
||||
*/
|
||||
virtual float getFreq();
|
||||
|
||||
// Whether we use the default frequency slot given our LoRa config (region and modem preset)
|
||||
static bool uses_default_frequency_slot;
|
||||
|
||||
// methods from radiohead
|
||||
|
||||
/// Initialise the Driver transport hardware and software.
|
||||
@@ -212,39 +203,24 @@ class RadioInterface
|
||||
* @return num msecs for the packet
|
||||
*/
|
||||
uint32_t getPacketTime(const meshtastic_MeshPacket *p);
|
||||
uint32_t getPacketTime(uint32_t totalPacketLen);
|
||||
|
||||
uint32_t getPacketTime(uint32_t payloadSize);
|
||||
|
||||
/**
|
||||
* Adaptive coding rate for retransmissions
|
||||
* Set a more robust coding rate for better reliability on retries
|
||||
* @param retryCount How many retries this is (0 = first retry, 1 = second retry, etc.)
|
||||
* @return true if coding rate was changed and radio was reconfigured
|
||||
*/
|
||||
virtual bool setAdaptiveCodingRate(uint8_t retryCount);
|
||||
|
||||
/**
|
||||
* Restore the original coding rate after adaptive transmission
|
||||
* @return true if coding rate was restored and radio was reconfigured
|
||||
*/
|
||||
virtual bool restoreOriginalCodingRate();
|
||||
|
||||
/**
|
||||
* Set the radio coding rate directly (more efficient than full reconfigure)
|
||||
* @param cr Coding rate (5-8, representing 4/5 to 4/8)
|
||||
* @return true if coding rate was set successfully
|
||||
*/
|
||||
virtual bool setRadioCodingRate(uint8_t cr);
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Get the channel we saved.
|
||||
*/
|
||||
uint32_t getChannelNum();
|
||||
|
||||
/**
|
||||
* Get the frequency we saved.
|
||||
*/
|
||||
virtual float getFreq();
|
||||
|
||||
/// Some boards (1st gen Pinetab Lora module) have broken IRQ wires, so we need to poll via i2c registers
|
||||
virtual bool isIRQPending() { return false; }
|
||||
|
||||
// Whether we use the default frequency slot given our LoRa config (region and modem preset)
|
||||
static bool uses_default_frequency_slot;
|
||||
|
||||
protected:
|
||||
int8_t power = 17; // Set by applyModemConfig()
|
||||
|
||||
|
||||
@@ -552,11 +552,4 @@ bool RadioLibInterface::startSend(meshtastic_MeshPacket *txp)
|
||||
|
||||
return res == RADIOLIB_ERR_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
bool RadioLibInterface::setRadioCodingRate(uint8_t cr)
|
||||
{
|
||||
// Default implementation just calls reconfigure()
|
||||
// Subclasses should override this for more efficient direct coding rate changes
|
||||
return reconfigure();
|
||||
}
|
||||
@@ -204,15 +204,6 @@ class RadioLibInterface : public RadioInterface, protected concurrency::Notified
|
||||
*/
|
||||
virtual void addReceiveMetadata(meshtastic_MeshPacket *mp) = 0;
|
||||
|
||||
/**
|
||||
* Set the coding rate on the radio hardware directly
|
||||
* Base implementation just calls reconfigure(), but subclasses should override
|
||||
* for more efficient direct coding rate changes
|
||||
* @param cr The coding rate to set (5-8 for 4/5 to 4/8)
|
||||
* @return true if successful
|
||||
*/
|
||||
virtual bool setRadioCodingRate(uint8_t cr);
|
||||
|
||||
/**
|
||||
* Subclasses must override, implement and then call into this base class implementation
|
||||
*/
|
||||
|
||||
@@ -371,16 +371,4 @@ template <typename T> void SX126xInterface<T>::setTransmitEnable(bool txon)
|
||||
#endif
|
||||
}
|
||||
|
||||
template <typename T> bool SX126xInterface<T>::setRadioCodingRate(uint8_t cr)
|
||||
{
|
||||
// Direct hardware call for efficient coding rate change
|
||||
int state = lora.setCodingRate(cr);
|
||||
if (state != RADIOLIB_ERR_NONE) {
|
||||
LOG_WARN("Failed to set coding rate to 4/%d, error %d", cr, state);
|
||||
return false;
|
||||
}
|
||||
LOG_DEBUG("Set coding rate to 4/%d", cr);
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -72,9 +72,6 @@ template <class T> class SX126xInterface : public RadioLibInterface
|
||||
|
||||
virtual void setStandby() override;
|
||||
|
||||
/// Efficient method to set coding rate without full reconfiguration
|
||||
virtual bool setRadioCodingRate(uint8_t cr) override;
|
||||
|
||||
private:
|
||||
/** Some boards require GPIO control of tx vs rx paths */
|
||||
void setTransmitEnable(bool txon);
|
||||
|
||||
@@ -322,17 +322,4 @@ template <typename T> bool SX128xInterface<T>::sleep()
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <typename T> bool SX128xInterface<T>::setRadioCodingRate(uint8_t cr)
|
||||
{
|
||||
// Direct hardware call for efficient coding rate change
|
||||
int state = lora.setCodingRate(cr);
|
||||
if (state != RADIOLIB_ERR_NONE) {
|
||||
LOG_WARN("Failed to set coding rate to 4/%d, error %d", cr, state);
|
||||
return false;
|
||||
}
|
||||
LOG_DEBUG("Set coding rate to 4/%d", cr);
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -67,7 +67,4 @@ template <class T> class SX128xInterface : public RadioLibInterface
|
||||
virtual void addReceiveMetadata(meshtastic_MeshPacket *mp) override;
|
||||
|
||||
virtual void setStandby() override;
|
||||
|
||||
/// Efficient method to set coding rate without full reconfiguration
|
||||
virtual bool setRadioCodingRate(uint8_t cr) override;
|
||||
};
|
||||
|
||||
@@ -253,8 +253,8 @@ typedef enum _meshtastic_HardwareModel {
|
||||
meshtastic_HardwareModel_SEEED_WIO_TRACKER_L1 = 99,
|
||||
/* Seeed Tracker L1 EINK driver */
|
||||
meshtastic_HardwareModel_SEEED_WIO_TRACKER_L1_EINK = 100,
|
||||
/* Reserved ID for future and past use */
|
||||
meshtastic_HardwareModel_QWANTZ_TINY_ARMS = 101,
|
||||
/* Muzi Works R1 Neo */
|
||||
meshtastic_HardwareModel_MUZI_R1_NEO = 101,
|
||||
/* Lilygo T-Deck Pro */
|
||||
meshtastic_HardwareModel_T_DECK_PRO = 102,
|
||||
/* Lilygo TLora Pager */
|
||||
|
||||
@@ -335,7 +335,8 @@ bool NRF52Bluetooth::onPairingPasskey(uint16_t conn_handle, uint8_t const passke
|
||||
meshtastic::BluetoothStatus newStatus(textkey);
|
||||
bluetoothStatus->updateStatus(&newStatus);
|
||||
|
||||
#if !defined(MESHTASTIC_EXCLUDE_SCREEN) // Todo: migrate this display code back into Screen class, and observe bluetoothStatus
|
||||
#if HAS_SCREEN && \
|
||||
!defined(MESHTASTIC_EXCLUDE_SCREEN) // Todo: migrate this display code back into Screen class, and observe bluetoothStatus
|
||||
if (screen) {
|
||||
screen->startAlert([](OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y) -> void {
|
||||
char btPIN[16] = "888888";
|
||||
|
||||
@@ -98,6 +98,8 @@
|
||||
#define HW_VENDOR meshtastic_HardwareModel_SEEED_WIO_TRACKER_L1_EINK
|
||||
#elif defined(SEEED_WIO_TRACKER_L1)
|
||||
#define HW_VENDOR meshtastic_HardwareModel_SEEED_WIO_TRACKER_L1
|
||||
#elif defined(R1_NEO)
|
||||
#define HW_VENDOR meshtastic_HardwareModel_MUZI_R1_NEO
|
||||
#elif defined(HELTEC_MESH_SOLAR)
|
||||
#define HW_VENDOR meshtastic_HardwareModel_HELTEC_MESH_SOLAR
|
||||
#else
|
||||
|
||||
@@ -34,6 +34,8 @@
|
||||
#define OCV_ARRAY 4200, 3876, 3826, 3763, 3713, 3660, 3573, 3485, 3422, 3359, 3300
|
||||
#elif defined(SEEED_SOLAR_NODE)
|
||||
#define OCV_ARRAY 4200, 3986, 3922, 3812, 3734, 3645, 3527, 3420, 3281, 3087, 2786
|
||||
#elif defined(R1_NEO)
|
||||
#define OCV_ARRAY 4330, 4292, 4254, 4216, 4178, 4140, 4102, 4064, 4026, 3988, 3950
|
||||
#else // LiIon
|
||||
#define OCV_ARRAY 4190, 4050, 3990, 3890, 3800, 3720, 3630, 3530, 3420, 3300, 3100
|
||||
#endif
|
||||
|
||||
19
variants/nrf52840/r1-neo/platformio.ini
Normal file
19
variants/nrf52840/r1-neo/platformio.ini
Normal file
@@ -0,0 +1,19 @@
|
||||
; The R1 Neo board
|
||||
[env:r1-neo]
|
||||
extends = nrf52840_base
|
||||
board = r1-neo
|
||||
board_check = true
|
||||
build_flags = ${nrf52840_base.build_flags}
|
||||
-Ivariants/nrf52840/r1-neo
|
||||
-D R1_NEO
|
||||
-DGPS_POWER_TOGGLE ; comment this line to disable triple press function on the user button to turn off gps entirely.
|
||||
-DRADIOLIB_EXCLUDE_SX128X=1
|
||||
-DRADIOLIB_EXCLUDE_SX127X=1
|
||||
-DRADIOLIB_EXCLUDE_LR11X0=1
|
||||
build_src_filter = ${nrf52_base.build_src_filter} +<../variants/nrf52840/r1-neo> +<mesh/api/> +<mqtt/>
|
||||
lib_deps =
|
||||
${nrf52840_base.lib_deps}
|
||||
${networking_base.lib_deps}
|
||||
https://github.com/RAKWireless/RAK13800-W5100S/archive/1.0.2.zip
|
||||
rakwireless/RAKwireless NCP5623 RGB LED library@^1.0.2
|
||||
artronshop/ArtronShop_RX8130CE@1.0.0
|
||||
45
variants/nrf52840/r1-neo/variant.cpp
Normal file
45
variants/nrf52840/r1-neo/variant.cpp
Normal file
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
Copyright (c) 2014-2015 Arduino LLC. All right reserved.
|
||||
Copyright (c) 2016 Sandeep Mistry All right reserved.
|
||||
Copyright (c) 2018, Adafruit Industries (adafruit.com)
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
See the GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "variant.h"
|
||||
#include "nrf.h"
|
||||
#include "wiring_constants.h"
|
||||
#include "wiring_digital.h"
|
||||
|
||||
const uint32_t g_ADigitalPinMap[] = {
|
||||
// P0
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
|
||||
|
||||
// P1
|
||||
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47};
|
||||
|
||||
void initVariant()
|
||||
{
|
||||
// LED1 & LED2
|
||||
pinMode(PIN_LED1, OUTPUT);
|
||||
ledOff(PIN_LED1);
|
||||
|
||||
pinMode(PIN_LED2, OUTPUT);
|
||||
ledOff(PIN_LED2);
|
||||
|
||||
// 3V3 Power Rail
|
||||
// pinMode(PIN_3V3_EN, OUTPUT);
|
||||
// digitalWrite(PIN_3V3_EN, HIGH);
|
||||
}
|
||||
149
variants/nrf52840/r1-neo/variant.h
Normal file
149
variants/nrf52840/r1-neo/variant.h
Normal file
@@ -0,0 +1,149 @@
|
||||
/*
|
||||
Copyright (c) 2014-2015 Arduino LLC. All right reserved.
|
||||
Copyright (c) 2016 Sandeep Mistry All right reserved.
|
||||
Copyright (c) 2018, Adafruit Industries (adafruit.com)
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
See the GNU Lesser General Public License for more details.
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef _VARIANT_R1NEO_
|
||||
#define _VARIANT_R1NEO_
|
||||
|
||||
#define RAK4630
|
||||
|
||||
/** Master clock frequency */
|
||||
#define VARIANT_MCK (64000000ul)
|
||||
|
||||
#define USE_LFXO // Board uses 32khz crystal for LF
|
||||
// define USE_LFRC // Board uses RC for LF
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* Headers
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
#include "WVariant.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif // __cplusplus
|
||||
|
||||
// Number of pins defined in PinDescription array
|
||||
#define PINS_COUNT (48)
|
||||
#define NUM_DIGITAL_PINS (48)
|
||||
#define NUM_ANALOG_INPUTS (1)
|
||||
#define NUM_ANALOG_OUTPUTS (0)
|
||||
|
||||
// LEDs
|
||||
#define PIN_LED1 (32 + 4) // P1.04 Controls Green LED
|
||||
#define PIN_LED2 (28) // P0.28 Controls Blue LED
|
||||
|
||||
#define LED_BUILTIN PIN_LED1
|
||||
#define LED_CONN PIN_LED2
|
||||
|
||||
#define LED_GREEN PIN_LED1
|
||||
#define LED_BLUE PIN_LED2
|
||||
|
||||
#define LED_STATE_ON 1 // State when LED is litted
|
||||
|
||||
// Button
|
||||
#define PIN_BUTTON1 (26)
|
||||
#define BUTTON_ACTIVE_LOW 0
|
||||
#define BUTTON_ACTIVE_PULLUP 0
|
||||
#define BUTTON_SENSE_TYPE INPUT_SENSE_HIGH
|
||||
|
||||
#define ADC_RESOLUTION 14
|
||||
|
||||
// Serial for GPS
|
||||
#define PIN_SERIAL1_RX (25)
|
||||
#define PIN_SERIAL1_TX (24)
|
||||
|
||||
// Connected to Jlink CDC
|
||||
#define PIN_SERIAL2_RX (8)
|
||||
#define PIN_SERIAL2_TX (6)
|
||||
|
||||
/*
|
||||
* SPI Interfaces
|
||||
*/
|
||||
#define SPI_INTERFACES_COUNT 1
|
||||
|
||||
#define PIN_SPI_MISO (45)
|
||||
#define PIN_SPI_MOSI (44)
|
||||
#define PIN_SPI_SCK (43)
|
||||
|
||||
static const uint8_t SS = 42;
|
||||
static const uint8_t MOSI = PIN_SPI_MOSI;
|
||||
static const uint8_t MISO = PIN_SPI_MISO;
|
||||
static const uint8_t SCK = PIN_SPI_SCK;
|
||||
|
||||
// R1 Neo Extras
|
||||
#define DCDC_EN_HOLD (13) // P0.13 Keeps DCDC alive after user button is pressed
|
||||
#define NRF_ON (29) // P0.29 Tells IO controller device is on
|
||||
|
||||
// RAKRGB
|
||||
#define HAS_NCP5623
|
||||
|
||||
#define HAS_SCREEN 0
|
||||
|
||||
/*
|
||||
* Wire Interfaces
|
||||
*/
|
||||
#define WIRE_INTERFACES_COUNT 1
|
||||
|
||||
#define PIN_WIRE_SDA (19) // P0.19 RTC_SDA
|
||||
#define PIN_WIRE_SCL (20) // P0.20 RTC_SCL
|
||||
|
||||
#define PIN_BUZZER (0 + 3) // P0.03
|
||||
|
||||
#define USE_SX1262
|
||||
#define SX126X_CS (42)
|
||||
#define SX126X_DIO1 (47)
|
||||
#define SX126X_BUSY (46)
|
||||
#define SX126X_RESET (38)
|
||||
#define SX126X_POWER_EN (37)
|
||||
|
||||
// DIO2 controlls an antenna switch and the TCXO voltage is controlled by DIO3
|
||||
#define SX126X_DIO2_AS_RF_SWITCH
|
||||
#define SX126X_DIO3_TCXO_VOLTAGE 1.8
|
||||
|
||||
// Testing USB detection
|
||||
#define NRF_APM
|
||||
|
||||
#define PIN_GPS_EN (32 + 1) // P1.01
|
||||
#define PIN_GPS_PPS (2) // P0.02 Pulse per second input from the GPS
|
||||
|
||||
#define GPS_RX_PIN PIN_SERIAL1_RX
|
||||
#define GPS_TX_PIN PIN_SERIAL1_TX
|
||||
|
||||
// Battery
|
||||
#define BATTERY_PIN (0 + 31) // P0.31 ADC_VBAT
|
||||
// and has 12 bit resolution
|
||||
#define BATTERY_SENSE_RESOLUTION_BITS 12
|
||||
#define BATTERY_SENSE_RESOLUTION 4096.0
|
||||
#undef AREF_VOLTAGE
|
||||
#define AREF_VOLTAGE 3.0
|
||||
#define VBAT_AR_INTERNAL AR_INTERNAL_3_0
|
||||
#define ADC_MULTIPLIER 1.73
|
||||
|
||||
#define HAS_RTC 1
|
||||
|
||||
#define RX8130CE_RTC 0x32
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* Arduino objects - C++ only
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user