Cleanup
This commit is contained in:
parent
f229b78372
commit
32424b91a6
4
Makefile
4
Makefile
|
@ -118,8 +118,8 @@ upload-tbeam:
|
|||
arduino-cli upload -p /dev/ttyACM0 --fqbn esp32:esp32:t-beam
|
||||
@sleep 1
|
||||
rnodeconf /dev/ttyACM0 --firmware-hash $$(./partition_hashes ./build/esp32.esp32.t-beam/RNode_Firmware.ino.bin)
|
||||
@sleep 3
|
||||
python ./Release/esptool/esptool.py --chip esp32 --port /dev/ttyACM0 --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 80m --flash_size 4MB 0x210000 ./Release/console_image.bin
|
||||
# @sleep 3
|
||||
# python ./Release/esptool/esptool.py --chip esp32 --port /dev/ttyACM0 --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 80m --flash_size 4MB 0x210000 ./Release/console_image.bin
|
||||
|
||||
upload-lora32_v10:
|
||||
arduino-cli upload -p /dev/ttyUSB0 --fqbn esp32:esp32:ttgo-lora32
|
||||
|
|
40
sx126x.cpp
40
sx126x.cpp
|
@ -9,28 +9,6 @@
|
|||
#if MODEM == SX1262
|
||||
#include "sx126x.h"
|
||||
|
||||
#define MCU_1284P 0x91
|
||||
#define MCU_2560 0x92
|
||||
#define MCU_ESP32 0x81
|
||||
#define MCU_NRF52 0x71
|
||||
#if defined(__AVR_ATmega1284P__)
|
||||
#define PLATFORM PLATFORM_AVR
|
||||
#define MCU_VARIANT MCU_1284P
|
||||
#elif defined(__AVR_ATmega2560__)
|
||||
#define PLATFORM PLATFORM_AVR
|
||||
#define MCU_VARIANT MCU_2560
|
||||
#elif defined(ESP32)
|
||||
#define PLATFORM PLATFORM_ESP32
|
||||
#define MCU_VARIANT MCU_ESP32
|
||||
#elif defined(NRF52840_XXAA)
|
||||
#define PLATFORM PLATFORM_NRF52
|
||||
#define MCU_VARIANT MCU_NRF52
|
||||
#endif
|
||||
|
||||
#ifndef MCU_VARIANT
|
||||
#error No MCU variant defined, cannot compile
|
||||
#endif
|
||||
|
||||
#if MCU_VARIANT == MCU_ESP32
|
||||
#if MCU_VARIANT == MCU_ESP32 and !defined(CONFIG_IDF_TARGET_ESP32S3)
|
||||
#include "soc/rtc_wdt.h"
|
||||
|
@ -132,9 +110,7 @@ sx126x::sx126x() :
|
|||
}
|
||||
|
||||
bool sx126x::preInit() {
|
||||
// setup pins
|
||||
pinMode(_ss, OUTPUT);
|
||||
// set SS high
|
||||
digitalWrite(_ss, HIGH);
|
||||
|
||||
#if BOARD_MODEL == BOARD_RNODE_NG_22
|
||||
|
@ -144,6 +120,7 @@ bool sx126x::preInit() {
|
|||
#endif
|
||||
|
||||
// check version (retry for up to 2 seconds)
|
||||
// TODO: Actually read version registers, not syncwords
|
||||
long start = millis();
|
||||
uint8_t syncmsb;
|
||||
uint8_t synclsb;
|
||||
|
@ -342,9 +319,7 @@ void sx126x::setPacketParams(long preamble, uint8_t headermode, uint8_t length,
|
|||
executeOpcode(OP_PACKET_PARAMS_6X, buf, 9);
|
||||
}
|
||||
|
||||
|
||||
int sx126x::begin(long frequency)
|
||||
{
|
||||
void sx126x::reset(void) {
|
||||
if (_reset != -1) {
|
||||
pinMode(_reset, OUTPUT);
|
||||
|
||||
|
@ -354,6 +329,12 @@ int sx126x::begin(long frequency)
|
|||
digitalWrite(_reset, HIGH);
|
||||
delay(10);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int sx126x::begin(long frequency)
|
||||
{
|
||||
reset();
|
||||
|
||||
if (_busy != -1) {
|
||||
pinMode(_busy, INPUT);
|
||||
|
@ -797,8 +778,9 @@ long sx126x::getSignalBandwidth()
|
|||
}
|
||||
|
||||
void sx126x::handleLowDataRate(){
|
||||
_ldro = 1;
|
||||
setModulationParams(_sf, _bw, _cr, _ldro);
|
||||
// TODO: Why was this enabled without any logic to check LDRO conditions?
|
||||
//_ldro = 1;
|
||||
//setModulationParams(_sf, _bw, _cr, _ldro);
|
||||
}
|
||||
|
||||
void sx126x::optimizeModemSensitivity(){
|
||||
|
|
2
sx126x.h
2
sx126x.h
|
@ -112,6 +112,8 @@ private:
|
|||
void handleLowDataRate();
|
||||
void optimizeModemSensitivity();
|
||||
|
||||
void reset(void);
|
||||
|
||||
private:
|
||||
SPISettings _spiSettings;
|
||||
int _ss;
|
||||
|
|
|
@ -73,8 +73,8 @@
|
|||
#define IRQ_RX_DONE_MASK_7X 0x40
|
||||
#define IRQ_PAYLOAD_CRC_ERROR_MASK_7X 0x20
|
||||
|
||||
#define MAX_PKT_LENGTH 255
|
||||
#define SYNC_WORD_7X 0x12
|
||||
#define SYNC_WORD_7X 0x12
|
||||
#define MAX_PKT_LENGTH 255
|
||||
|
||||
extern SPIClass SPI;
|
||||
|
||||
|
|
Loading…
Reference in New Issue