Merge branch 'master' into raspi-portduino

This commit is contained in:
Ben Meadors
2023-11-15 19:39:19 -06:00
committed by GitHub
15 changed files with 434 additions and 20 deletions

View File

@@ -188,6 +188,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef HAS_TELEMETRY
#define HAS_TELEMETRY 0
#endif
#ifndef HAS_SENSOR
#define HAS_SENSOR 0
#endif
#ifndef HAS_RADIO
#define HAS_RADIO 0
#endif

View File

@@ -390,7 +390,7 @@ class Screen : public concurrency::OSThread
SH1106Wire dispdev;
#elif defined(USE_SSD1306)
SSD1306Wire dispdev;
#elif defined(ST7735_CS) || defined(ILI9341_DRIVER) || defined(ST7789_CS)
#elif defined(ST7735_CS) || defined(ILI9341_DRIVER) || defined(ST7789_CS) || defined(RAK14014)
TFTDisplay dispdev;
#elif defined(USE_EINK)
EInkDisplay dispdev;

View File

@@ -105,6 +105,10 @@ class LGFX : public lgfx::LGFX_Device
static LGFX tft;
#elif defined(RAK14014)
#include <TFT_eSPI.h>
TFT_eSPI tft = TFT_eSPI();
#elif defined(ST7789_CS)
#include <LovyanGFX.hpp> // Graphics and font library for ST7735 driver chip
@@ -327,7 +331,7 @@ static TFT_eSPI tft = TFT_eSPI(); // Invoke library, pins defined in User_Setup.
#endif
#if defined(ST7735_CS) || defined(ST7789_CS) || defined(ILI9341_DRIVER)
#if defined(ST7735_CS) || defined(ST7789_CS) || defined(ILI9341_DRIVER) || defined(RAK14014)
#include "SPILock.h"
#include "TFTDisplay.h"
#include <SPI.h>
@@ -393,7 +397,9 @@ void TFTDisplay::sendCommand(uint8_t com)
#ifdef VTFT_CTRL
digitalWrite(VTFT_CTRL, LOW);
#endif
#ifndef M5STACK
#ifdef RAK14014
#elif !defined(M5STACK)
tft.setBrightness(128);
#endif
break;
@@ -419,7 +425,8 @@ void TFTDisplay::sendCommand(uint8_t com)
#ifdef VTFT_CTRL
digitalWrite(VTFT_CTRL, HIGH);
#endif
#ifndef M5STACK
#ifdef RAK14014
#elif !defined(M5STACK)
tft.setBrightness(0);
#endif
break;
@@ -441,7 +448,8 @@ void TFTDisplay::flipScreenVertically()
bool TFTDisplay::hasTouch(void)
{
#ifndef M5STACK
#ifdef RAK14014
#elif !defined(M5STACK)
return tft.touch() != nullptr;
#else
return false;
@@ -450,7 +458,8 @@ bool TFTDisplay::hasTouch(void)
bool TFTDisplay::getTouch(int16_t *x, int16_t *y)
{
#ifndef M5STACK
#ifdef RAK14014
#elif !defined(M5STACK)
return tft.getTouch(x, y);
#else
return false;
@@ -471,6 +480,9 @@ bool TFTDisplay::connect()
#ifdef TFT_BL
digitalWrite(TFT_BL, TFT_BACKLIGHT_ON);
pinMode(TFT_BL, OUTPUT);
// pinMode(PIN_3V3_EN, OUTPUT);
// digitalWrite(PIN_3V3_EN, HIGH);
LOG_INFO("Power to TFT Backlight\n");
#endif
#ifdef ST7735_BACKLIGHT_EN_V03
@@ -484,8 +496,13 @@ bool TFTDisplay::connect()
#endif
tft.init();
#if defined(M5STACK)
tft.setRotation(0);
#elif defined(RAK14014)
tft.setRotation(1);
tft.setSwapBytes(true);
// tft.fillScreen(TFT_BLACK);
#elif defined(T_DECK) || defined(PICOMPUTER_S3)
tft.setRotation(1); // T-Deck has the TFT in landscape
#elif defined(T_WATCH_S3)
@@ -494,6 +511,7 @@ bool TFTDisplay::connect()
tft.setRotation(3); // Orient horizontal and wide underneath the silkscreen name label
#endif
tft.fillScreen(TFT_BLACK);
return true;
}

View File

@@ -37,9 +37,6 @@ bool RF95Interface::init()
{
RadioLibInterface::init();
if (power == 0)
power = POWER_DEFAULT;
if (power > MAX_POWER) // This chip has lower power limits than some
power = MAX_POWER;

View File

@@ -448,7 +448,9 @@ void RadioInterface::applyModemConfig()
power = myRegion->powerLimit;
if (power == 0)
power = 17; // Default to default power if we don't have a valid power
power = 17; // Default to this power level if we don't have a valid regional power limit (powerLimit of myRegion defaults
// to 0, currently no region has an actual power limit of 0 [dBm] so we can assume regions which have this
// variable set to 0 don't have a valid power limit)
// Set final tx_power back onto config
loraConfig.tx_power = (int8_t)power; // cppcheck-suppress assignmentAddressToInteger
@@ -546,4 +548,4 @@ size_t RadioInterface::beginSending(meshtastic_MeshPacket *p)
sendingPacket = p;
return p->encrypted.size + sizeof(PacketHeader);
}
}

View File

@@ -20,9 +20,6 @@ bool STM32WLE5JCInterface::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;

View File

@@ -43,6 +43,7 @@ template <typename T> bool SX126xInterface<T>::init()
bool useRegulatorLDO = false; // Seems to depend on the connection to pin 9/DCC_SW - if an inductor DCDC?
RadioLibInterface::init();
if (power > SX126X_MAX_POWER) // Clamp power to maximum defined level
power = SX126X_MAX_POWER;

View File

@@ -42,9 +42,6 @@ template <typename T> bool SX128xInterface<T>::init()
RadioLibInterface::init();
if (power == 0)
power = SX128X_MAX_POWER;
if (power > SX128X_MAX_POWER) // This chip has lower power limits than some
power = SX128X_MAX_POWER;

View File

@@ -28,6 +28,12 @@ int32_t DetectionSensorModule::runOnce()
return disable();
if (firstTime) {
#ifdef DETECTION_SENSOR_EN
pinMode(DETECTION_SENSOR_EN, OUTPUT);
digitalWrite(DETECTION_SENSOR_EN, HIGH);
#endif
// This is the first time the OSThread library has called this function, so do some setup
firstTime = false;
if (moduleConfig.detection_sensor.monitor_pin > 0) {