Compare commits

..

34 Commits

Author SHA1 Message Date
Thomas Göttgens
8f620d9dea Merge branch 'master' into portexpander-keyboard 2025-07-13 18:14:46 +02:00
Thomas Göttgens
5ef66dd543 Merge branch 'master' into portexpander-keyboard 2025-06-05 14:29:17 +02:00
Thomas Göttgens
fb1fd6d581 Merge branch 'master' into portexpander-keyboard 2025-03-31 11:38:06 +02:00
Thomas Göttgens
1b616e653a Merge branch 'master' into portexpander-keyboard 2025-03-02 12:00:22 +01:00
Thomas Göttgens
b94ab03653 Merge branch 'master' into portexpander-keyboard 2025-02-19 13:22:20 +01:00
Thomas Göttgens
9f9cb881be Merge branch 'master' into portexpander-keyboard 2025-01-18 14:11:43 +01:00
Thomas Göttgens
53bea8206a Merge branch 'master' into portexpander-keyboard 2024-12-29 22:34:48 +01:00
Thomas Göttgens
aba2bff892 Merge branch 'master' into portexpander-keyboard 2024-11-24 15:54:20 +01:00
Thomas Göttgens
82f9cdef65 Merge branch 'master' into portexpander-keyboard 2024-11-11 16:10:29 +01:00
Thomas Göttgens
17948fbc5d Merge branch 'master' into portexpander-keyboard 2024-11-02 16:44:36 +01:00
Thomas Göttgens
9fc8a936fd Merge branch 'master' into portexpander-keyboard 2024-10-26 15:32:13 +02:00
Thomas Göttgens
6239171fb2 sheesh 2024-10-26 15:17:12 +02:00
Thomas Göttgens
413a579bff Merge branch 'master' into portexpander-keyboard 2024-10-26 12:25:05 +02:00
Thomas Göttgens
a6ea4c56ac fix STM32 builds 2024-10-25 15:41:22 +02:00
Thomas Göttgens
379ad9b919 Merge branch 'master' into portexpander-keyboard 2024-10-25 13:06:15 +02:00
Thomas Göttgens
cfc3facc4a Merge branch 'master' into portexpander-keyboard 2024-10-23 21:27:26 +02:00
Thomas Göttgens
8f862694b1 strange days... 2024-10-16 13:35:05 +02:00
Thomas Göttgens
4b5cb7c4ec don't check this in dude 2024-10-16 13:28:52 +02:00
Thomas Göttgens
d5712714e6 dafuq? 2024-10-16 13:25:06 +02:00
Thomas Göttgens
7b062293f8 Merge branch 'portexpander-keyboard' of https://github.com/meshtastic/firmware into portexpander-keyboard 2024-10-16 13:19:11 +02:00
Thomas Göttgens
b22046a0f1 Merge branch 'master' into portexpander-keyboard 2024-10-16 12:40:41 +02:00
Thomas Göttgens
12bd04c02a Merge branch 'master' into portexpander-keyboard 2024-10-08 14:14:14 +02:00
Thomas Göttgens
0a09d9ae20 Merge branch 'master' into portexpander-keyboard 2024-09-29 12:27:00 +02:00
Thomas Göttgens
e78cd1273a Merge branch 'master' into portexpander-keyboard 2024-09-04 14:48:39 +02:00
Thomas Göttgens
d36c02f271 Merge branch 'portexpander-keyboard' of https://github.com/meshtastic/firmware into portexpander-keyboard
# Conflicts:
#	src/input/cardKbI2cImpl.cpp
2024-08-23 11:14:46 +02:00
Thomas Göttgens
96bcc781ee Merge branch 'master' into portexpander-keyboard 2024-06-20 16:10:45 +02:00
Thomas Göttgens
99431b12d2 Merge branch 'master' into portexpander-keyboard 2024-06-16 11:56:19 +02:00
Thomas Göttgens
37684294eb 50msec is a bit steep 2024-05-12 16:36:03 +02:00
Thomas Göttgens
a4efa30799 add PCF8574(A) port expander as passive 4x4 keyboard 2024-05-12 16:36:03 +02:00
Thomas Göttgens
1532e8cc95 Merge branch 'portexpander-keyboard' of https://github.com/meshtastic/firmware into portexpander-keyboard 2024-05-04 18:45:54 +02:00
Thomas Göttgens
4c229dfd4d 50msec is a bit steep 2024-04-23 13:48:16 +02:00
Thomas Göttgens
4ff27e0713 add PCF8574(A) port expander as passive 4x4 keyboard 2024-04-23 13:48:16 +02:00
Thomas Göttgens
8817b71513 50msec is a bit steep 2024-03-26 00:23:58 +01:00
Thomas Göttgens
b5a34490be add PCF8574(A) port expander as passive 4x4 keyboard 2024-03-26 00:18:23 +01:00
28 changed files with 194 additions and 230 deletions

View File

@@ -31,9 +31,8 @@ build_flags =
-fmerge-all-constants -fmerge-all-constants
-ffunction-sections -ffunction-sections
-fdata-sections -fdata-sections
build_src_filter = build_src_filter =
${arduino_base.build_src_filter} -<platform/esp32/> -<nimble/> -<mesh/api/> -<mesh/wifi/> -<mesh/http/> -<modules/esp32> -<mesh/eth/> -<input> -<buzz> -<modules/RemoteHardwareModule.cpp> -<platform/nrf52> -<platform/portduino> -<platform/rp2xx0> -<mesh/raspihttp> ${arduino_base.build_src_filter} -<platform/esp32/> -<nimble/> -<mesh/api/> -<mesh/wifi/> -<mesh/http/> -<modules/esp32> -<mesh/eth/> -<input> -<buzz> -<modules/RemoteHardwareModule.cpp> -<platform/nrf52> -<platform/portduino> -<platform/rp2xx0> -<mesh/raspihttp> -<.pio/*/*/I2CKeyPad/*>
board_upload.offset_address = 0x08000000 board_upload.offset_address = 0x08000000
upload_protocol = stlink upload_protocol = stlink
@@ -47,4 +46,5 @@ lib_deps =
https://github.com/caveman99/Crypto/archive/eae9c768054118a9399690f8af202853d1ae8516.zip https://github.com/caveman99/Crypto/archive/eae9c768054118a9399690f8af202853d1ae8516.zip
lib_ignore = lib_ignore =
I2CKeyPad
OneButton OneButton

View File

@@ -26,7 +26,6 @@ build_flags = -Wno-missing-field-initializers
-DUSE_THREAD_NAMES -DUSE_THREAD_NAMES
-DTINYGPS_OPTION_NO_CUSTOM_FIELDS -DTINYGPS_OPTION_NO_CUSTOM_FIELDS
-DPB_ENABLE_MALLOC=1 -DPB_ENABLE_MALLOC=1
-DRADIOLIB_LOW_LEVEL=1
-DRADIOLIB_EXCLUDE_CC1101=1 -DRADIOLIB_EXCLUDE_CC1101=1
-DRADIOLIB_EXCLUDE_NRF24=1 -DRADIOLIB_EXCLUDE_NRF24=1
-DRADIOLIB_EXCLUDE_RF69=1 -DRADIOLIB_EXCLUDE_RF69=1
@@ -73,6 +72,7 @@ lib_deps =
nanopb/Nanopb@0.4.91 nanopb/Nanopb@0.4.91
# renovate: datasource=custom.pio depName=ErriezCRC32 packageName=erriez/library/ErriezCRC32 # renovate: datasource=custom.pio depName=ErriezCRC32 packageName=erriez/library/ErriezCRC32
erriez/ErriezCRC32@1.0.1 erriez/ErriezCRC32@1.0.1
robtillaart/I2CKeyPad@0.5.0
; Used for the code analysis in PIO Home / Inspect ; Used for the code analysis in PIO Home / Inspect
check_tool = cppcheck check_tool = cppcheck

View File

@@ -150,11 +150,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// Define if screen should be mirrored left to right // Define if screen should be mirrored left to right
// #define SCREEN_MIRROR // #define SCREEN_MIRROR
// I2C Keyboards (M5Stack, RAK14004, T-Deck) // I2C Keyboards (M5Stack, RAK14004, T-Deck, PCF8574A passive)
#define CARDKB_ADDR 0x5F #define CARDKB_ADDR 0x5F
#define TDECK_KB_ADDR 0x55 #define TDECK_KB_ADDR 0x55
#define BBQ10_KB_ADDR 0x1F #define BBQ10_KB_ADDR 0x1F
#define MPR121_KB_ADDR 0x5A #define MPR121_KB_ADDR 0x5A
#define PCF8574A_ADDRESS 0x20
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// SENSOR // SENSOR

View File

@@ -31,8 +31,8 @@ ScanI2C::FoundDevice ScanI2C::firstRTC() const
ScanI2C::FoundDevice ScanI2C::firstKeyboard() const ScanI2C::FoundDevice ScanI2C::firstKeyboard() const
{ {
ScanI2C::DeviceType types[] = {CARDKB, TDECKKB, BBQ10KB, RAK14004, MPR121KB, TCA8418KB}; ScanI2C::DeviceType types[] = {CARDKB, TDECKKB, BBQ10KB, RAK14004, PCF8574A, MPR121KB, TCA8418KB};
return firstOfOrNONE(6, types); return firstOfOrNONE(7, types);
} }
ScanI2C::FoundDevice ScanI2C::firstAccelerometer() const ScanI2C::FoundDevice ScanI2C::firstAccelerometer() const

View File

@@ -18,6 +18,7 @@ class ScanI2C
TDECKKB, TDECKKB,
BBQ10KB, BBQ10KB,
RAK14004, RAK14004,
PCF8574A,
PMU_AXP192_AXP2101, // has the same adress as the TCA8418KB PMU_AXP192_AXP2101, // has the same adress as the TCA8418KB
BME_680, BME_680,
BME_280, BME_280,

View File

@@ -210,6 +210,9 @@ void ScanI2CTwoWire::scanPort(I2CPort port, uint8_t *address, uint8_t asize)
SCAN_SIMPLE_CASE(BBQ10_KB_ADDR, BBQ10KB, "BB Q10", (uint8_t)addr.address); SCAN_SIMPLE_CASE(BBQ10_KB_ADDR, BBQ10KB, "BB Q10", (uint8_t)addr.address);
SCAN_SIMPLE_CASE(ST7567_ADDRESS, SCREEN_ST7567, "ST7567", (uint8_t)addr.address); SCAN_SIMPLE_CASE(ST7567_ADDRESS, SCREEN_ST7567, "ST7567", (uint8_t)addr.address);
#ifndef HAS_TCA9535
SCAN_SIMPLE_CASE(PCF8574A_ADDRESS, PCF8574A, "PCF8574A", (uint8_t)addr.address);
#endif
#ifdef HAS_NCP5623 #ifdef HAS_NCP5623
SCAN_SIMPLE_CASE(NCP5623_ADDR, NCP5623, "NCP5623", (uint8_t)addr.address); SCAN_SIMPLE_CASE(NCP5623_ADDR, NCP5623, "NCP5623", (uint8_t)addr.address);
#endif #endif

View File

@@ -9,6 +9,10 @@ CardKbI2cImpl::CardKbI2cImpl() : KbI2cBase("cardKB") {}
void CardKbI2cImpl::init() void CardKbI2cImpl::init()
{ {
if (kb_model == 0x12) {
disable();
return;
}
#if !MESHTASTIC_EXCLUDE_I2C && !defined(ARCH_PORTDUINO) && !defined(I2C_NO_RESCAN) #if !MESHTASTIC_EXCLUDE_I2C && !defined(ARCH_PORTDUINO) && !defined(I2C_NO_RESCAN)
if (cardkb_found.address == 0x00) { if (cardkb_found.address == 0x00) {
LOG_DEBUG("Rescan for I2C keyboard"); LOG_DEBUG("Rescan for I2C keyboard");

View File

@@ -0,0 +1,88 @@
#include "peMatrixBase.h"
#include "configuration.h"
#include "detect/ScanI2C.h"
extern ScanI2C::DeviceAddress cardkb_found;
extern uint8_t kb_model;
#if WIRE_INTERFACES_COUNT == 2 // defined in architecture.h
I2CKeyPad keyPad(cardkb_found.address, cardkb_found.port == ScanI2C::WIRE1 ? &Wire1 : &Wire);
#else
I2CKeyPad keyPad(cardkb_found.address, &Wire);
#endif
PeMatrixBase::PeMatrixBase(const char *name) : concurrency::OSThread(name)
{
this->_originName = name;
}
int32_t PeMatrixBase::runOnce()
{
if (kb_model != 0x12) {
// Input device is not detected.
return disable();
}
if (firstTime) {
// This is the first time the OSThread library has called this function, so do port setup
firstTime = 0;
if (!keyPad.begin()) {
LOG_ERROR("Failed to initialize I2C keypad");
return disable();
}
keyPad.loadKeyMap(keymap);
} else {
if (keyPad.isPressed()) {
key = keyPad.getChar();
// debounce
if (key != prevkey) {
if (key != 0) {
LOG_DEBUG("Key 0x%x pressed\n", key);
// reset shift now that we have a keypress
InputEvent e;
e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_NONE;
e.source = this->_originName;
switch (key) {
case 0x1b: // ESC
e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_CANCEL;
break;
case 0x08: // Back
e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_BACK;
e.kbchar = key;
break;
case 0xb5: // Up
e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_UP;
break;
case 0xb6: // Down
e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_DOWN;
break;
case 0xb4: // Left
e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_LEFT;
e.kbchar = key;
break;
case 0xb7: // Right
e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_RIGHT;
e.kbchar = key;
break;
case 0x0d: // Enter
e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_SELECT;
break;
case 0x00: // nopress
e.inputEvent = meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_NONE;
break;
default: // all other keys
e.inputEvent = ANYKEY;
e.kbchar = key;
break;
}
if (e.inputEvent != meshtastic_ModuleConfig_CannedMessageConfig_InputEventChar_NONE) {
this->notifyObservers(&e);
}
}
prevkey = key;
}
}
}
return 100; // Keyscan every 100msec to avoid key bounce
}

22
src/input/peMatrixBase.h Normal file
View File

@@ -0,0 +1,22 @@
#pragma once
#include "InputBroker.h"
#include "concurrency/OSThread.h"
#include <I2CKeyPad.h>
class PeMatrixBase : public Observable<const InputEvent *>, public concurrency::OSThread
{
public:
explicit PeMatrixBase(const char *name);
protected:
virtual int32_t runOnce() override;
private:
const char *_originName;
bool firstTime = 1;
// char keymap[19] = "123A456B789C*0#DNF"; // N = NoKey, F = Fail
char keymap[19] = {0x1b, 0xb5, '3', 'A', 0xb4, 0x0d, 0xb7, 'B', '7', 0xb6, '9', 'C', 0x09, '0', 0x08, 'D', 'N', 'F'};
char key = 0;
char prevkey = 0;
};

View File

@@ -0,0 +1,16 @@
#include "peMatrixImpl.h"
#include "InputBroker.h"
PeMatrixImpl *peMatrixImpl;
PeMatrixImpl::PeMatrixImpl() : PeMatrixBase("matrixPE") {}
void PeMatrixImpl::init()
{
if (kb_model != 0x12) {
disable();
return;
}
inputBroker->registerSource(this);
}

19
src/input/peMatrixImpl.h Normal file
View File

@@ -0,0 +1,19 @@
#pragma once
#include "main.h"
#include "peMatrixBase.h"
/**
* @brief The idea behind this class to have static methods for the event handlers.
* Check attachInterrupt() at RotaryEncoderInteruptBase.cpp
* Technically you can have as many rotary encoders hardver attached
* to your device as you wish, but you always need to have separate event
* handlers, thus you need to have a RotaryEncoderInterrupt implementation.
*/
class PeMatrixImpl : public PeMatrixBase
{
public:
PeMatrixImpl();
void init();
};
extern PeMatrixImpl *peMatrixImpl;

View File

@@ -214,8 +214,6 @@ bool pauseBluetoothLogging = false;
bool pmu_found; bool pmu_found;
uint8_t pa_fan_percentage = 50;
#if !MESHTASTIC_EXCLUDE_I2C #if !MESHTASTIC_EXCLUDE_I2C
// Array map of sensor types with i2c address and wire as we'll find in the i2c scan // Array map of sensor types with i2c address and wire as we'll find in the i2c scan
std::pair<uint8_t, TwoWire *> nodeTelemetrySensorsMap[_meshtastic_TelemetrySensorType_MAX + 1] = {}; std::pair<uint8_t, TwoWire *> nodeTelemetrySensorsMap[_meshtastic_TelemetrySensorType_MAX + 1] = {};
@@ -609,6 +607,9 @@ void setup()
// assign an arbitrary value to distinguish from other models // assign an arbitrary value to distinguish from other models
kb_model = 0x11; kb_model = 0x11;
break; break;
case ScanI2C::DeviceType::PCF8574A:
kb_model = 0x12;
break;
case ScanI2C::DeviceType::MPR121KB: case ScanI2C::DeviceType::MPR121KB:
// assign an arbitrary value to distinguish from other models // assign an arbitrary value to distinguish from other models
kb_model = 0x37; kb_model = 0x37;
@@ -1377,36 +1378,16 @@ void setup()
mqttInit(); mqttInit();
#endif #endif
#ifdef RADIO_FAN_EN #ifdef RF95_FAN_EN
// Ability to disable FAN if PIN has been set with RADIO_FAN_EN. // Ability to disable FAN if PIN has been set with RF95_FAN_EN.
// Make sure LoRa has been started before disabling FAN. // Make sure LoRa has been started before disabling FAN.
#ifdef RADIO_FAN_PWM if (config.lora.pa_fan_disabled)
#if defined(ARCH_ESP32) digitalWrite(RF95_FAN_EN, LOW ^ 0);
// Set up PWM at Channel 1 at 25KHz, using 8-bit resolution
// Turn ON/OFF fan to the specified value if enabled by config.
// code by https://github.com/gjelsoe/
if (ledcSetup(1, 25000, 8)) {
ledcAttachPin(RADIO_FAN_EN, 1);
LOG_INFO("PWM init C1 P%d\n", RADIO_FAN_EN);
// Set PWM duty cycle based on fan disabled state
ledcWrite(1, config.lora.pa_fan_disabled ? 0 : (pa_fan_percentage * 2.55));
} else {
LOG_WARN("PWM init fail P%d\n", RADIO_FAN_EN);
}
#elif defined(ARCH_NRF52)
pinMode(RADIO_FAN_EN, OUTPUT);
analogWrite(RADIO_FAN_EN, config.lora.pa_fan_disabled ? 0 : (pa_fan_percentage * 2.55));
#endif
#else
// Set up as ON/OFF switch of fan
pinMode(RADIO_FAN_EN, OUTPUT);
digitalWrite(RADIO_FAN_EN, LOW ^ 0);
#endif
#endif #endif
#ifndef ARCH_PORTDUINO #ifndef ARCH_PORTDUINO
// Initialize Wifi // Initialize Wifi
#if HAS_WIFI #if HAS_WIFI
initWifi(); initWifi();
#endif #endif

View File

@@ -78,8 +78,6 @@ extern uint32_t shutdownAtMsec;
extern uint32_t serialSinceMsec; extern uint32_t serialSinceMsec;
extern uint8_t pa_fan_percentage;
// If a thread does something that might need for it to be rescheduled ASAP it can set this flag // If a thread does something that might need for it to be rescheduled ASAP it can set this flag
// This will suppress the current delay and instead try to run ASAP. // This will suppress the current delay and instead try to run ASAP.
extern bool runASAP; extern bool runASAP;

View File

@@ -3,7 +3,6 @@
#include "Throttle.h" #include "Throttle.h"
#include "configuration.h" #include "configuration.h"
#include "error.h" #include "error.h"
#include "main.h"
#include "mesh/NodeDB.h" #include "mesh/NodeDB.h"
#ifdef LR11X0_DIO_AS_RF_SWITCH #ifdef LR11X0_DIO_AS_RF_SWITCH
#include "rfswitch.h" #include "rfswitch.h"
@@ -55,8 +54,6 @@ template <typename T> bool LR11x0Interface<T>::init()
digitalWrite(LR11X0_POWER_EN, HIGH); digitalWrite(LR11X0_POWER_EN, HIGH);
#endif #endif
enableFan();
#if ARCH_PORTDUINO #if ARCH_PORTDUINO
float tcxoVoltage = (float)settingsMap[dio3_tcxo_voltage] / 1000; float tcxoVoltage = (float)settingsMap[dio3_tcxo_voltage] / 1000;
// FIXME: correct logic to default to not using TCXO if no voltage is specified for LR11x0_DIO3_TCXO_VOLTAGE // FIXME: correct logic to default to not using TCXO if no voltage is specified for LR11x0_DIO3_TCXO_VOLTAGE

View File

@@ -154,7 +154,10 @@ bool RF95Interface::init()
digitalWrite(RF95_TXEN, 0); digitalWrite(RF95_TXEN, 0);
#endif #endif
enableFan(); #ifdef RF95_FAN_EN
pinMode(RF95_FAN_EN, OUTPUT);
digitalWrite(RF95_FAN_EN, 1);
#endif
#ifdef RF95_RXEN #ifdef RF95_RXEN
pinMode(RF95_RXEN, OUTPUT); pinMode(RF95_RXEN, OUTPUT);
@@ -327,7 +330,10 @@ bool RF95Interface::sleep()
// put chipset into sleep mode // put chipset into sleep mode
setStandby(); // First cancel any active receiving/sending setStandby(); // First cancel any active receiving/sending
lora->sleep(); lora->sleep();
disableFan();
#ifdef RF95_FAN_EN
digitalWrite(RF95_FAN_EN, 0);
#endif
return true; return true;
} }

View File

@@ -531,37 +531,4 @@ bool RadioLibInterface::startSend(meshtastic_MeshPacket *txp)
return res == RADIOLIB_ERR_NONE; return res == RADIOLIB_ERR_NONE;
} }
}
void RadioLibInterface::enableFan()
{
#ifdef RADIO_FAN_EN
#ifdef RADIO_FAN_PWM
#if defined(ARCH_ESP32)
ledcWrite(1, config.lora.pa_fan_disabled ? 0 : (pa_fan_percentage * 2.55));
#elif defined(ARCH_NRF52)
analogWrite(RADIO_FAN_EN, config.lora.pa_fan_disabled ? 0 : (pa_fan_percentage * 2.55));
#endif
#else
pinMode(RADIO_FAN_EN, OUTPUT);
digitalWrite(RADIO_FAN_EN, 1);
#endif
#endif
}
void RadioLibInterface::disableFan()
{
#ifdef RADIO_FAN_EN
#ifdef RADIO_FAN_PWM
#if defined(ARCH_ESP32)
ledcWrite(1, 0);
#elif defined(ARCH_NRF52)
analogWrite(RADIO_FAN_EN, 0);
#endif
#else
pinMode(RADIO_FAN_EN, OUTPUT);
digitalWrite(RADIO_FAN_EN, 0);
#endif
#endif
} }

View File

@@ -146,9 +146,6 @@ class RadioLibInterface : public RadioInterface, protected concurrency::Notified
/** Attempt to find a packet in the TxQueue. Returns true if the packet was found. */ /** Attempt to find a packet in the TxQueue. Returns true if the packet was found. */
virtual bool findInTxQueue(NodeNum from, PacketId id) override; virtual bool findInTxQueue(NodeNum from, PacketId id) override;
void enableFan();
void disableFan();
private: private:
/** if we have something waiting to send, start a short (random) timer so we can come check for collision before actually /** if we have something waiting to send, start a short (random) timer so we can come check for collision before actually
* doing the transmit */ * doing the transmit */

View File

@@ -52,8 +52,6 @@ template <typename T> bool SX126xInterface<T>::init()
pinMode(SX126X_POWER_EN, OUTPUT); pinMode(SX126X_POWER_EN, OUTPUT);
#endif #endif
enableFan();
#if ARCH_PORTDUINO #if ARCH_PORTDUINO
tcxoVoltage = (float)settingsMap[dio3_tcxo_voltage] / 1000; tcxoVoltage = (float)settingsMap[dio3_tcxo_voltage] / 1000;
if (settingsMap[sx126x_ant_sw_pin] != RADIOLIB_NC) { if (settingsMap[sx126x_ant_sw_pin] != RADIOLIB_NC) {

View File

@@ -35,7 +35,10 @@ template <typename T> bool SX128xInterface<T>::init()
digitalWrite(SX128X_POWER_EN, HIGH); digitalWrite(SX128X_POWER_EN, HIGH);
#endif #endif
enableFan(); #ifdef RF95_FAN_EN
pinMode(RF95_FAN_EN, OUTPUT);
digitalWrite(RF95_FAN_EN, 1);
#endif
#if ARCH_PORTDUINO #if ARCH_PORTDUINO
if (settingsMap[rxen_pin] != RADIOLIB_NC) { if (settingsMap[rxen_pin] != RADIOLIB_NC) {

View File

@@ -706,21 +706,13 @@ void AdminModule::handleSetConfig(const meshtastic_Config &c)
requiresReboot = false; requiresReboot = false;
} }
#ifdef RADIO_FAN_EN #ifdef RF95_FAN_EN
#ifdef RADIO_FAN_PWM
#if defined(ARCH_ESP32)
ledcWrite(1, c.payload_variant.lora.pa_fan_disabled ? 0 : (pa_fan_percentage * 2.55));
#elif defined(ARCH_NFR52)
analogWrite(RADIO_FAN_EN, c.payload_variant.lora.pa_fan_disabled ? 0 : (pa_fan_percentage * 2.55));
#endif
#else
// Turn PA off if disabled by config // Turn PA off if disabled by config
if (c.payload_variant.lora.pa_fan_disabled) { if (c.payload_variant.lora.pa_fan_disabled) {
digitalWrite(RADIO_FAN_EN, LOW ^ 0); digitalWrite(RF95_FAN_EN, LOW ^ 0);
} else { } else {
digitalWrite(RADIO_FAN_EN, HIGH ^ 0); digitalWrite(RF95_FAN_EN, HIGH ^ 0);
} }
#endif
#endif #endif
config.lora = c.payload_variant.lora; config.lora = c.payload_variant.lora;
// If we're setting region for the first time, init the region // If we're setting region for the first time, init the region

View File

@@ -12,6 +12,7 @@
#include "input/cardKbI2cImpl.h" #include "input/cardKbI2cImpl.h"
#endif #endif
#include "input/kbMatrixImpl.h" #include "input/kbMatrixImpl.h"
#include "input/peMatrixImpl.h"
#endif #endif
#if !MESHTASTIC_EXCLUDE_PKI #if !MESHTASTIC_EXCLUDE_PKI
#include "KeyVerificationModule.h" #include "KeyVerificationModule.h"
@@ -181,6 +182,10 @@ void setupModules()
kbMatrixImpl = new KbMatrixImpl(); kbMatrixImpl = new KbMatrixImpl();
kbMatrixImpl->init(); kbMatrixImpl->init();
#endif // INPUTBROKER_MATRIX_TYPE #endif // INPUTBROKER_MATRIX_TYPE
peMatrixImpl = new PeMatrixImpl();
peMatrixImpl->init();
#ifdef INPUTBROKER_SERIAL_TYPE #ifdef INPUTBROKER_SERIAL_TYPE
aSerialKeyboardImpl = new SerialKeyboardImpl(); aSerialKeyboardImpl = new SerialKeyboardImpl();
aSerialKeyboardImpl->init(); aSerialKeyboardImpl->init();

View File

@@ -12,7 +12,7 @@
#define LORA_MISO 19 #define LORA_MISO 19
#define LORA_MOSI 23 #define LORA_MOSI 23
#define LORA_CS 5 #define LORA_CS 5
#define RADIO_FAN_EN 17 #define RF95_FAN_EN 17
// #define LED_PIN 16 // This is a LED_WS2812 not a standard LED // #define LED_PIN 16 // This is a LED_WS2812 not a standard LED
#define HAS_NEOPIXEL // Enable the use of neopixels #define HAS_NEOPIXEL // Enable the use of neopixels

View File

@@ -46,8 +46,7 @@
FAN is active at 250mW on it's ExpressLRS Firmware. FAN is active at 250mW on it's ExpressLRS Firmware.
This FAN has TACHO signal on Pin 27 for use with PWM. This FAN has TACHO signal on Pin 27 for use with PWM.
*/ */
#define RADIO_FAN_EN 2 #define RF95_FAN_EN 2
#define RADIO_FAN_PWM
/* /*
LED PIN setup and it has a NeoPixel LED. LED PIN setup and it has a NeoPixel LED.

View File

@@ -32,7 +32,7 @@
This unit has a FAN built-in. This unit has a FAN built-in.
FAN is active at 250mW on it's ExpressLRS Firmware. FAN is active at 250mW on it's ExpressLRS Firmware.
*/ */
#define RADIO_FAN_EN 2 #define RF95_FAN_EN 2
/* /*
LED PIN setup. LED PIN setup.

View File

@@ -1,20 +0,0 @@
[env:radiomaster_nomad_gemini]
extends = esp32_base
board = esp32doit-devkit-v1
build_flags =
${esp32_base.build_flags}
-DRADIOMASTER_NOMAD_GEMINI
-DPRIVATE_HW
-DVTABLES_IN_FLASH=1
-DCONFIG_DISABLE_HAL_LOCKS=1
-O2
-Ivariants/radiomaster_nomad_gemini
-DMESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR=1
-DMESHTASTIC_EXCLUDE_I2C=1
-DRADIOLIB_EXCLUDE_SX128X=1
-DRADIOLIB_EXCLUDE_SX127X=1
-DRADIOLIB_EXCLUDE_SX126X=1
board_build.f_cpu = 240000000L
upload_protocol = esptool
lib_deps =
${esp32_base.lib_deps}

View File

@@ -1,56 +0,0 @@
#include "RadioLib.h"
static const uint32_t rfswitch_dio_pins[] = {RADIOLIB_LR11X0_DIO5, RADIOLIB_LR11X0_DIO6, RADIOLIB_LR11X0_DIO7,
RADIOLIB_LR11X0_DIO8, RADIOLIB_NC};
static const Module::RfSwitchMode_t rfswitch_table[] = {
// mode DIO5 DIO6 DIO7 DIO8
{LR11x0::MODE_STBY, {LOW, LOW, LOW, LOW}}, {LR11x0::MODE_RX, {LOW, LOW, HIGH, LOW}},
{LR11x0::MODE_TX, {LOW, LOW, LOW, HIGH}}, {LR11x0::MODE_TX_HP, {LOW, LOW, LOW, HIGH}},
{LR11x0::MODE_TX_HF, {LOW, HIGH, LOW, LOW}}, {LR11x0::MODE_GNSS, {LOW, LOW, LOW, LOW}},
{LR11x0::MODE_WIFI, {HIGH, LOW, LOW, LOW}}, END_OF_MODE_TABLE,
};
/*
DIO5: RXEN 2.4GHz
DIO6: TXEN 2.4GHz
DIO7: RXEN 900MHz
DIO8: TXEN 900MHz
"radio_dcdc": true,
"radio_rfo_hf": true,
"power_apc2": 26,
"power_min": 0,
"power_high": 6,
"power_max": 6,
"power_default": 3,
"power_control": 3, POWER_OUTPUT_DACWRITE // use internal dacWrite function to set value on GPIO_PIN_RFamp_APC2
[0, 1, 2, 3, 4, 5, 6 ] // 0-6
"power_values": [120, 120, 120, 120, 120, 120, 95] // DAC Value
"power_values2": [-17, -16, -14, -11, -7, -3, 5 ] // 900M
"power_values_dual": [-18, -14, -8, -6, -2, 3, 5 ] // 2.4G
// default value 0 means direct!
#define POWER_OUTPUT_DACWRITE (hardware_int(HARDWARE_power_control)==3)
#define POWER_OUTPUT_VALUES hardware_i16_array(HARDWARE_power_values)
#define POWER_OUTPUT_VALUES_COUNT hardware_int(HARDWARE_power_values_count)
#define POWER_OUTPUT_VALUES2 hardware_i16_array(HARDWARE_power_values2)
#define POWER_OUTPUT_VALUES_DUAL hardware_i16_array(HARDWARE_power_values_dual)
#define POWER_OUTPUT_VALUES_DUAL_COUNT hardware_int(HARDWARE_power_values_dual_count)
#define GPIO_PIN_FAN_EN hardware_pin(HARDWARE_misc_fan_en)
case PWR_10mW: return 10;
case PWR_25mW: return 14;
case PWR_50mW: return 17;
case PWR_100mW: return 20;
case PWR_250mW: return 24;
case PWR_500mW: return 27;
case PWR_1000mW: return 30;
95 -> +25dBm
120 -> +24dBm
*/

View File

@@ -1,60 +0,0 @@
#define HAS_SCREEN 0
#define HAS_WIRE 0
#define HAS_GPS 0
#undef GPS_RX_PIN
#undef GPS_TX_PIN
#define PIN_SPI_MISO 33
#define PIN_SPI_MOSI 32
#define PIN_SPI_SCK 25
#define PIN_SPI_NSS 27
#define LORA_RESET 15
#define LORA_DIO1 37
#define LORA_DIO2 36
#define LORA_SCK PIN_SPI_SCK
#define LORA_MISO PIN_SPI_MISO
#define LORA_MOSI PIN_SPI_MOSI
#define LORA_CS PIN_SPI_NSS
// supported modules list
#define USE_LR1121
#define LR1121_IRQ_PIN LORA_DIO1
#define LR1121_NRESET_PIN LORA_RESET
#define LR1121_BUSY_PIN LORA_DIO2
#define LR1121_SPI_NSS_PIN LORA_CS
#define LR1121_SPI_SCK_PIN LORA_SCK
#define LR1121_SPI_MOSI_PIN LORA_MOSI
#define LR1121_SPI_MISO_PIN LORA_MISO
// this is correct and sets the cap for the Sub-GHz part
#define LR1110_MAX_POWER 5
// 2.4G Part
#define LR1120_MAX_POWER 5
#define POWER_SHIFT -20
// not yet implemented
#define JANUS_RADIO
#define LR1121_IRQ2_PIN 34
#define LR1121_NRESET2_PIN 21
#define LR1121_BUSY2_PIN 39
#define LR1121_SPI_NSS2_PIN 13
// TODO: check if this is correct
// #define LR11X0_DIO3_TCXO_VOLTAGE 1.6
#define LR11X0_DIO_AS_RF_SWITCH
#define HAS_NEOPIXEL // Enable the use of neopixels
#define NEOPIXEL_COUNT 2 // How many neopixels are connected
#define NEOPIXEL_DATA 22 // GPIO pin used to send data to the neopixels
#define NEOPIXEL_TYPE (NEO_GRB + NEO_KHZ800) // Type of neopixels in use
#define ENABLE_AMBIENTLIGHTING // Turn on Ambient Lighting
#define BUTTON_PIN 34
#define BUTTON_NEED_PULLUP
#undef EXT_NOTIFY_OUT
#define RADIO_FAN_EN 2

View File

@@ -17,6 +17,9 @@
// #define ADC_CHANNEL ADC1_GPIO27_CHANNEL // #define ADC_CHANNEL ADC1_GPIO27_CHANNEL
// #define ADC_MULTIPLIER 2 // #define ADC_MULTIPLIER 2
// Portexpander
#define HAS_TCA9535
// ST7701 TFT LCD // ST7701 TFT LCD
#define ST7701_CS (4 | IO_EXPANDER) #define ST7701_CS (4 | IO_EXPANDER)
#define ST7701_RS -1 // DC #define ST7701_RS -1 // DC