mirror of
https://github.com/markqvist/RNode_Firmware.git
synced 2026-04-27 14:30:33 +00:00
Throw in changes based on meshtastic's support of the v4.3 board
This commit is contained in:
parent
29981c9e86
commit
9fe3559e14
3 changed files with 34 additions and 32 deletions
6
Boards.h
6
Boards.h
|
|
@ -422,14 +422,14 @@
|
|||
|
||||
#define LORA_LNA_GAIN 17
|
||||
#define LORA_LNA_GVT 12
|
||||
#define LORA_PA_GC1109 true
|
||||
#define LORA_PA_KCT8103L true
|
||||
#define LORA_PA_PWR_EN 7
|
||||
#define LORA_PA_CSD 2
|
||||
#define LORA_PA_CPS 46
|
||||
#define LORA_PA_CTX 5
|
||||
|
||||
#define PA_MAX_OUTPUT 28
|
||||
#define PA_GAIN_POINTS 22
|
||||
#define PA_GAIN_VALUES 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 10, 10, 9, 9, 8, 7
|
||||
#define PA_GAIN_VALUES 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 12, 12, 11, 11, 10, 9, 8, 7
|
||||
|
||||
const int pin_cs = 8;
|
||||
const int pin_busy = 13;
|
||||
|
|
|
|||
|
|
@ -1767,7 +1767,11 @@ void sleep_now() {
|
|||
#endif
|
||||
#endif
|
||||
#if BOARD_MODEL == BOARD_HELTEC32_V4
|
||||
digitalWrite(LORA_PA_CPS, LOW);
|
||||
#if LORA_PA_KCT8103L
|
||||
digitalWrite(LORA_PA_CTX, LOW);
|
||||
#elif LORA_PA_GC1109
|
||||
digitalWrite(LORA_PA_CPS, LOW);
|
||||
#endif
|
||||
digitalWrite(LORA_PA_CSD, LOW);
|
||||
digitalWrite(LORA_PA_PWR_EN, LOW);
|
||||
digitalWrite(Vext, HIGH);
|
||||
|
|
|
|||
54
sx126x.cpp
54
sx126x.cpp
|
|
@ -343,7 +343,21 @@ int sx126x::begin(long frequency) {
|
|||
setPacketParams(_preambleLength, _implicitHeaderMode, _payloadLength, _crcMode);
|
||||
|
||||
#if HAS_LORA_PA
|
||||
#if LORA_PA_GC1109
|
||||
#if LORA_PA_KCT8103L
|
||||
// Enable Vfem_ctl for supply to PA power net.
|
||||
pinMode(LORA_PA_PWR_EN, OUTPUT);
|
||||
digitalWrite(LORA_PA_PWR_EN, HIGH);
|
||||
|
||||
// Enable KCT8103L: CSD=HIGH activates the chip.
|
||||
pinMode(LORA_PA_CSD, OUTPUT);
|
||||
digitalWrite(LORA_PA_CSD, HIGH);
|
||||
|
||||
// CTX=LOW selects LNA/RX mode by default.
|
||||
// CTX=HIGH switches to PA/TX mode.
|
||||
// Must be toggled on each TX/RX transition.
|
||||
pinMode(LORA_PA_CTX, OUTPUT);
|
||||
digitalWrite(LORA_PA_CTX, LOW);
|
||||
#elif LORA_PA_GC1109
|
||||
// Enable Vfem_ctl for supply to
|
||||
// PA power net.
|
||||
pinMode(LORA_PA_PWR_EN, OUTPUT);
|
||||
|
|
@ -353,21 +367,9 @@ int sx126x::begin(long frequency) {
|
|||
pinMode(LORA_PA_CSD, OUTPUT);
|
||||
digitalWrite(LORA_PA_CSD, HIGH);
|
||||
|
||||
// Keep PA CPS low until actual
|
||||
// transmit. Does it save power?
|
||||
// Who knows? Will have to measure.
|
||||
// Note from the future: Nope.
|
||||
// Power consumption is the same,
|
||||
// and turning it on and off is
|
||||
// not something that it likes.
|
||||
// Keeping it high for now.
|
||||
// Keep PA CPS high permanently.
|
||||
pinMode(LORA_PA_CPS, OUTPUT);
|
||||
digitalWrite(LORA_PA_CPS, HIGH);
|
||||
|
||||
// On Heltec V4, the PA CTX pin
|
||||
// is driven by the SX1262 DIO2
|
||||
// pin directly, so we do not
|
||||
// need to manually raise this.
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
|
@ -378,12 +380,11 @@ void sx126x::end() { sleep(); SPI.end(); _preinit_done = false; }
|
|||
|
||||
int sx126x::beginPacket(int implicitHeader) {
|
||||
#if HAS_LORA_PA
|
||||
#if LORA_PA_GC1109
|
||||
// Enable PA CPS for transmit
|
||||
// digitalWrite(LORA_PA_CPS, HIGH);
|
||||
// Disabled since we're keeping it
|
||||
// on permanently as long as the
|
||||
// radio is powered up.
|
||||
#if LORA_PA_KCT8103L
|
||||
// CTX=HIGH: switch KCT8103L to PA/TX mode.
|
||||
digitalWrite(LORA_PA_CTX, HIGH);
|
||||
#elif LORA_PA_GC1109
|
||||
// CPS kept HIGH permanently, no action needed.
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
|
@ -595,14 +596,11 @@ void sx126x::onReceive(void(*callback)(int)){
|
|||
|
||||
void sx126x::receive(int size) {
|
||||
#if HAS_LORA_PA
|
||||
#if LORA_PA_GC1109
|
||||
// Disable PA CPS for receive
|
||||
// digitalWrite(LORA_PA_CPS, LOW);
|
||||
// That turned out to be a bad idea.
|
||||
// The LNA goes wonky if it's toggled
|
||||
// on and off too quickly. We'll keep
|
||||
// it on permanently, as long as the
|
||||
// radio is powered up.
|
||||
#if LORA_PA_KCT8103L
|
||||
// CTX=LOW: switch KCT8103L to LNA/RX mode.
|
||||
digitalWrite(LORA_PA_CTX, LOW);
|
||||
#elif LORA_PA_GC1109
|
||||
// CPS kept HIGH permanently, no action needed.
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue