Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions examples/companion_radio/MyMesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,10 @@
#define RESP_CODE_TUNING_PARAMS 23
#define RESP_CODE_STATS 24 // v8+, second byte is stats type

#define SEND_TIMEOUT_BASE_MILLIS 500
#define SEND_TIMEOUT_BASE_MILLIS 1000 // Increased from 500 for 3-hop reliability
#define FLOOD_SEND_TIMEOUT_FACTOR 16.0f
#define DIRECT_SEND_PERHOP_FACTOR 6.0f
#define DIRECT_SEND_PERHOP_EXTRA_MILLIS 250
#define DIRECT_SEND_PERHOP_FACTOR 10.0f // Increased from 6.0 for congested repeaters
#define DIRECT_SEND_PERHOP_EXTRA_MILLIS 500 // Increased from 250 for queueing delays
#define LAZY_CONTACTS_WRITE_DELAY 5000

#define PUBLIC_GROUP_PSK "izOH6cXN6mrJ5e26oRXNcg=="
Expand Down
5 changes: 2 additions & 3 deletions src/helpers/CommonCLI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ void CommonCLI::handleCommand(uint32_t sender_timestamp, const char* command, ch
sprintf(reply, "> %d", ((uint32_t) _prefs->advert_interval) * 2);
} else if (memcmp(config, "guest.password", 14) == 0) {
sprintf(reply, "> %s", _prefs->guest_password);
} else if (sender_timestamp == 0 && memcmp(config, "prv.key", 7) == 0) { // from serial command line only
} else if (memcmp(config, "prv.key", 7) == 0) { // requires admin authentication when remote
uint8_t prv_key[PRV_KEY_SIZE];
int len = _callbacks->getSelfId().writeTo(prv_key, PRV_KEY_SIZE);
mesh::Utils::toHex(tmp, prv_key, len);
Expand Down Expand Up @@ -406,8 +406,7 @@ void CommonCLI::handleCommand(uint32_t sender_timestamp, const char* command, ch
StrHelper::strncpy(_prefs->guest_password, &config[15], sizeof(_prefs->guest_password));
savePrefs();
strcpy(reply, "OK");
} else if (sender_timestamp == 0 &&
memcmp(config, "prv.key ", 8) == 0) { // from serial command line only
} else if (memcmp(config, "prv.key ", 8) == 0) { // requires admin authentication when remote
uint8_t prv_key[PRV_KEY_SIZE];
bool success = mesh::Utils::fromHex(prv_key, PRV_KEY_SIZE, &config[8]);
if (success) {
Expand Down
26 changes: 23 additions & 3 deletions src/helpers/radiolib/CustomSX1262.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class CustomSX1262 : public SX1262 {
}

setCRC(1);

#ifdef SX126X_CURRENT_LIMIT
setCurrentLimit(SX126X_CURRENT_LIMIT);
#endif
Expand All @@ -74,7 +74,27 @@ class CustomSX1262 : public SX1262 {
#define SX126X_TXEN RADIOLIB_NC
#endif
setRfSwitchPins(SX126X_RXEN, SX126X_TXEN);
#endif
#endif

#ifdef SX126X_SEMTECH_PATCH
// Apply Semtech-recommended register modification for improved performance
// Read-modify-write to register 0x08B5 to set bit 0 while preserving other bits
uint8_t regValue = 0;
int16_t regStatus = readRegister(0x08B5, &regValue, 1);
if (regStatus == RADIOLIB_ERR_NONE) {
regValue |= 0x01; // Set bit 0 while preserving other bits
regStatus = writeRegister(0x08B5, &regValue, 1);
if (regStatus == RADIOLIB_ERR_NONE) {
Serial.println("SX126x begin 0X8B5 enabled");
} else {
Serial.print("SX126x register 0X8B5 write failed: ");
Serial.println(regStatus);
}
} else {
Serial.print("SX126x register 0X8B5 read failed: ");
Serial.println(regStatus);
}
#endif

return true; // success
}
Expand All @@ -84,4 +104,4 @@ class CustomSX1262 : public SX1262 {
bool detected = (irq & SX126X_IRQ_HEADER_VALID) || (irq & SX126X_IRQ_PREAMBLE_DETECTED);
return detected;
}
};
};
1 change: 1 addition & 0 deletions variants/heltec_tracker_v2/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ build_flags =
-D SX126X_RX_BOOSTED_GAIN=1
; GC1109 FEM: TX/RX switching is handled by DIO2 -> CTX pin (via SX126X_DIO2_AS_RF_SWITCH)
; GPIO46 is CPS (PA mode), not TX control - do not use for RF switching
-D SX126X_SEMTECH_PATCH=1
-D PIN_BOARD_SDA=5
-D PIN_BOARD_SCL=6
-D PIN_USER_BTN=0
Expand Down
3 changes: 2 additions & 1 deletion variants/heltec_v4/HeltecV4Board.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ void HeltecV4Board::begin() {
// CSD (GPIO2): Chip enable - must be HIGH for GC1109 to work
pinMode(P_LORA_PA_EN, OUTPUT);
digitalWrite(P_LORA_PA_EN, HIGH);
delay(1); // Allow GC1109 FEM time to power up
}

periph_power.begin();
Expand Down Expand Up @@ -99,7 +100,7 @@ void HeltecV4Board::begin() {

digitalWrite(PIN_ADC_CTRL, LOW);

return (5.42 * (3.3 / 1024.0) * raw) * 1000;
return (5.23 * (3.325 / 1024.0) * raw) * 1000;
}

const char* HeltecV4Board::getManufacturerName() const {
Expand Down
1 change: 1 addition & 0 deletions variants/heltec_v4/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ build_flags =
-D SX126X_RX_BOOSTED_GAIN=1
; GC1109 FEM: TX/RX switching is handled by DIO2 -> CTX pin (via SX126X_DIO2_AS_RF_SWITCH)
; GPIO46 is CPS (power save), not TX control - do not use for RF switching
-D SX126X_SEMTECH_PATCH=1
-D PIN_GPS_RX=38
-D PIN_GPS_TX=39
-D PIN_GPS_RESET=42
Expand Down