mirror of
https://github.com/meshtastic/firmware.git
synced 2025-04-27 10:21:40 +00:00
pinelora WIP
This commit is contained in:
parent
8ec73e653b
commit
4c1b7d4840
@ -4,6 +4,7 @@ You probably don't care about this section - skip to the next one.
|
|||||||
|
|
||||||
## before next release
|
## before next release
|
||||||
|
|
||||||
|
* turn on setTx(timeout) and state = setDioIrqParams(SX126X_IRQ_TX_DONE | SX126X_IRQ_TIMEOUT, SX126X_IRQ_TX_DONE | SX126X_IRQ_TIMEOUT); in sx1262 code
|
||||||
* pine64 lora module
|
* pine64 lora module
|
||||||
* nrf52 USB is unreliable while sleeping?
|
* nrf52 USB is unreliable while sleeping?
|
||||||
* @havealoha fixedposition not working
|
* @havealoha fixedposition not working
|
||||||
|
@ -16,9 +16,9 @@
|
|||||||
;default_envs = tlora_v1_3
|
;default_envs = tlora_v1_3
|
||||||
;default_envs = tlora-v2
|
;default_envs = tlora-v2
|
||||||
;default_envs = lora-relay-v1 # nrf board
|
;default_envs = lora-relay-v1 # nrf board
|
||||||
default_envs = t-echo
|
;default_envs = t-echo
|
||||||
;default_envs = nrf52840dk-geeksville
|
;default_envs = nrf52840dk-geeksville
|
||||||
;default_envs = native # lora-relay-v1 # nrf52840dk-geeksville # linux # or if you'd like to change the default to something like lora-relay-v1 put that here
|
default_envs = native # lora-relay-v1 # nrf52840dk-geeksville # linux # or if you'd like to change the default to something like lora-relay-v1 put that here
|
||||||
;default_envs = rak4631
|
;default_envs = rak4631
|
||||||
;default_envs = rak4630
|
;default_envs = rak4630
|
||||||
|
|
||||||
@ -72,7 +72,7 @@ lib_deps =
|
|||||||
1202 ; CRC32, explicitly needed because dependency is missing in the ble ota update lib
|
1202 ; CRC32, explicitly needed because dependency is missing in the ble ota update lib
|
||||||
https://github.com/meshtastic/arduino-fsm.git#829e967b8a95c094f73c60ef8dacfe66eae38940
|
https://github.com/meshtastic/arduino-fsm.git#829e967b8a95c094f73c60ef8dacfe66eae38940
|
||||||
https://github.com/meshtastic/SparkFun_Ublox_Arduino_Library.git#31015a55e630a2df77d9d714669c621a5bf355ad
|
https://github.com/meshtastic/SparkFun_Ublox_Arduino_Library.git#31015a55e630a2df77d9d714669c621a5bf355ad
|
||||||
https://github.com/meshtastic/RadioLib.git#b022e575f8dce1fb879577ea07f177bc817f5f52
|
https://github.com/meshtastic/RadioLib.git#80ed10d689a0568782c5bd152906b0f97d2bce93
|
||||||
https://github.com/meshtastic/TinyGPSPlus.git#f0f47067ef2f67c856475933188251c1ef615e79
|
https://github.com/meshtastic/TinyGPSPlus.git#f0f47067ef2f67c856475933188251c1ef615e79
|
||||||
https://github.com/meshtastic/AXP202X_Library.git#8404abb6d4b486748636bc6ad72d2a47baaf5460
|
https://github.com/meshtastic/AXP202X_Library.git#8404abb6d4b486748636bc6ad72d2a47baaf5460
|
||||||
Wire ; explicitly needed here because the AXP202 library forgets to add it
|
Wire ; explicitly needed here because the AXP202 library forgets to add it
|
||||||
@ -88,7 +88,7 @@ framework = arduino
|
|||||||
lib_deps =
|
lib_deps =
|
||||||
${env.lib_deps}
|
${env.lib_deps}
|
||||||
|
|
||||||
build_flags = ${env.build_flags} -Os
|
build_flags = ${env.build_flags} -Os -DRADIOLIB_GODMODE
|
||||||
|
|
||||||
src_filter = ${env.src_filter} -<portduino/>
|
src_filter = ${env.src_filter} -<portduino/>
|
||||||
|
|
||||||
|
2
proto
2
proto
@ -1 +1 @@
|
|||||||
Subproject commit 157f9891dd35d3087f51e32dc0b103fcb1f0ca7c
|
Subproject commit d4232f9a8932c1d5ddd76af89c7737f4b287e145
|
@ -449,7 +449,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
#define SX1262_DIO1 LORA_DIO1
|
#define SX1262_DIO1 LORA_DIO1
|
||||||
#define SX1262_BUSY LORA_DIO2
|
#define SX1262_BUSY LORA_DIO2
|
||||||
#define SX1262_RESET LORA_RESET
|
#define SX1262_RESET LORA_RESET
|
||||||
#define SX1262_E22 // Seems to be an E22 clone
|
// HOPE RFM90 does not have a TCXO therefore not SX1262_E22
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
#include "mesh/generated/mesh.pb.h" // For CriticalErrorCode
|
#include "mesh/generated/mesh.pb.h" // For CriticalErrorCode
|
||||||
|
|
||||||
/// A macro that include filename and line
|
/// A macro that include filename and line
|
||||||
#define RECORD_CRITICALERROR(code) (code, __LINE__, __FILE__)
|
#define RECORD_CRITICALERROR(code) recordCriticalError(code, __LINE__, __FILE__)
|
||||||
|
|
||||||
/// Record an error that should be reported via analytics
|
/// Record an error that should be reported via analytics
|
||||||
void recordCriticalError(CriticalErrorCode code = CriticalErrorCode_Unspecified, uint32_t address = 0, const char *filename = NULL);
|
void recordCriticalError(CriticalErrorCode code = CriticalErrorCode_Unspecified, uint32_t address = 0, const char *filename = NULL);
|
||||||
|
@ -555,4 +555,10 @@ void recordCriticalError(CriticalErrorCode code, uint32_t address, const char *f
|
|||||||
myNodeInfo.error_code = code;
|
myNodeInfo.error_code = code;
|
||||||
myNodeInfo.error_address = address;
|
myNodeInfo.error_address = address;
|
||||||
myNodeInfo.error_count++;
|
myNodeInfo.error_count++;
|
||||||
|
|
||||||
|
// Currently portuino is mostly used for simulation. Make sue the user notices something really bad happend
|
||||||
|
#ifdef PORTDUINO
|
||||||
|
DEBUG_MSG("A critical failure occurred, portduino is exiting...");
|
||||||
|
exit(2);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -312,7 +312,13 @@ void RadioLibInterface::startSend(MeshPacket *txp)
|
|||||||
size_t numbytes = beginSending(txp);
|
size_t numbytes = beginSending(txp);
|
||||||
|
|
||||||
int res = iface->startTransmit(radiobuf, numbytes);
|
int res = iface->startTransmit(radiobuf, numbytes);
|
||||||
assert(res == ERR_NONE);
|
if(res != ERR_NONE) {
|
||||||
|
RECORD_CRITICALERROR(CriticalErrorCode_RadioSpiBug);
|
||||||
|
|
||||||
|
// This send failed, but make sure to 'complete' it properly
|
||||||
|
completeSending();
|
||||||
|
startReceive(); // Restart receive mode (because startTransmit failed to put us in xmit mode)
|
||||||
|
}
|
||||||
|
|
||||||
// Must be done AFTER, starting transmit, because startTransmit clears (possibly stale) interrupt pending register bits
|
// Must be done AFTER, starting transmit, because startTransmit clears (possibly stale) interrupt pending register bits
|
||||||
enableInterrupt(isrTxLevel0);
|
enableInterrupt(isrTxLevel0);
|
||||||
|
@ -59,6 +59,30 @@ bool SX1262Interface::init()
|
|||||||
res = lora.setDio2AsRfSwitch(false);
|
res = lora.setDio2AsRfSwitch(false);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
// Read/write a register we are not using (only used for FSK mode) to test SPI comms
|
||||||
|
uint8_t crcLSB = 0;
|
||||||
|
int err = lora.readRegister(SX126X_REG_CRC_POLYNOMIAL_LSB, &crcLSB, 1);
|
||||||
|
if(err != ERR_NONE)
|
||||||
|
RECORD_CRITICALERROR(CriticalErrorCode_SX1262Failure);
|
||||||
|
|
||||||
|
//if(crcLSB != 0x0f)
|
||||||
|
// RECORD_CRITICALERROR(CriticalErrorCode_SX1262Failure);
|
||||||
|
|
||||||
|
crcLSB = 0x5a;
|
||||||
|
err = lora.writeRegister(SX126X_REG_CRC_POLYNOMIAL_LSB, &crcLSB, 1);
|
||||||
|
if(err != ERR_NONE)
|
||||||
|
RECORD_CRITICALERROR(CriticalErrorCode_SX1262Failure);
|
||||||
|
|
||||||
|
err = lora.readRegister(SX126X_REG_CRC_POLYNOMIAL_LSB, &crcLSB, 1);
|
||||||
|
if(err != ERR_NONE)
|
||||||
|
RECORD_CRITICALERROR(CriticalErrorCode_SX1262Failure);
|
||||||
|
|
||||||
|
if(crcLSB != 0x5a)
|
||||||
|
RECORD_CRITICALERROR(CriticalErrorCode_SX1262Failure);
|
||||||
|
// If we got this far register accesses (and therefore SPI comms) are good
|
||||||
|
#endif
|
||||||
|
|
||||||
if (res == ERR_NONE)
|
if (res == ERR_NONE)
|
||||||
res = lora.setCRC(SX126X_LORA_CRC_ON);
|
res = lora.setCRC(SX126X_LORA_CRC_ON);
|
||||||
|
|
||||||
@ -78,15 +102,15 @@ bool SX1262Interface::reconfigure()
|
|||||||
// configure publicly accessible settings
|
// configure publicly accessible settings
|
||||||
int err = lora.setSpreadingFactor(sf);
|
int err = lora.setSpreadingFactor(sf);
|
||||||
if (err != ERR_NONE)
|
if (err != ERR_NONE)
|
||||||
recordCriticalError(CriticalErrorCode_InvalidRadioSetting);
|
RECORD_CRITICALERROR(CriticalErrorCode_InvalidRadioSetting);
|
||||||
|
|
||||||
err = lora.setBandwidth(bw);
|
err = lora.setBandwidth(bw);
|
||||||
if (err != ERR_NONE)
|
if (err != ERR_NONE)
|
||||||
recordCriticalError(CriticalErrorCode_InvalidRadioSetting);
|
RECORD_CRITICALERROR(CriticalErrorCode_InvalidRadioSetting);
|
||||||
|
|
||||||
err = lora.setCodingRate(cr);
|
err = lora.setCodingRate(cr);
|
||||||
if (err != ERR_NONE)
|
if (err != ERR_NONE)
|
||||||
recordCriticalError(CriticalErrorCode_InvalidRadioSetting);
|
RECORD_CRITICALERROR(CriticalErrorCode_InvalidRadioSetting);
|
||||||
|
|
||||||
// Hmm - seems to lower SNR when the signal levels are high. Leaving off for now...
|
// Hmm - seems to lower SNR when the signal levels are high. Leaving off for now...
|
||||||
err = lora.setRxGain(true);
|
err = lora.setRxGain(true);
|
||||||
@ -103,7 +127,7 @@ bool SX1262Interface::reconfigure()
|
|||||||
|
|
||||||
err = lora.setFrequency(freq);
|
err = lora.setFrequency(freq);
|
||||||
if (err != ERR_NONE)
|
if (err != ERR_NONE)
|
||||||
recordCriticalError(CriticalErrorCode_InvalidRadioSetting);
|
RECORD_CRITICALERROR(CriticalErrorCode_InvalidRadioSetting);
|
||||||
|
|
||||||
if (power > 22) // This chip has lower power limits than some
|
if (power > 22) // This chip has lower power limits than some
|
||||||
power = 22;
|
power = 22;
|
||||||
|
@ -47,7 +47,8 @@ typedef enum _CriticalErrorCode {
|
|||||||
CriticalErrorCode_InvalidRadioSetting = 7,
|
CriticalErrorCode_InvalidRadioSetting = 7,
|
||||||
CriticalErrorCode_TransmitFailed = 8,
|
CriticalErrorCode_TransmitFailed = 8,
|
||||||
CriticalErrorCode_Brownout = 9,
|
CriticalErrorCode_Brownout = 9,
|
||||||
CriticalErrorCode_SX1262Failure = 10
|
CriticalErrorCode_SX1262Failure = 10,
|
||||||
|
CriticalErrorCode_RadioSpiBug = 11
|
||||||
} CriticalErrorCode;
|
} CriticalErrorCode;
|
||||||
|
|
||||||
typedef enum _Routing_Error {
|
typedef enum _Routing_Error {
|
||||||
@ -217,8 +218,8 @@ typedef struct _ToRadio {
|
|||||||
#define _Constants_ARRAYSIZE ((Constants)(Constants_DATA_PAYLOAD_LEN+1))
|
#define _Constants_ARRAYSIZE ((Constants)(Constants_DATA_PAYLOAD_LEN+1))
|
||||||
|
|
||||||
#define _CriticalErrorCode_MIN CriticalErrorCode_None
|
#define _CriticalErrorCode_MIN CriticalErrorCode_None
|
||||||
#define _CriticalErrorCode_MAX CriticalErrorCode_SX1262Failure
|
#define _CriticalErrorCode_MAX CriticalErrorCode_RadioSpiBug
|
||||||
#define _CriticalErrorCode_ARRAYSIZE ((CriticalErrorCode)(CriticalErrorCode_SX1262Failure+1))
|
#define _CriticalErrorCode_ARRAYSIZE ((CriticalErrorCode)(CriticalErrorCode_RadioSpiBug+1))
|
||||||
|
|
||||||
#define _Routing_Error_MIN Routing_Error_NONE
|
#define _Routing_Error_MIN Routing_Error_NONE
|
||||||
#define _Routing_Error_MAX Routing_Error_NOT_AUTHORIZED
|
#define _Routing_Error_MAX Routing_Error_NOT_AUTHORIZED
|
||||||
|
Loading…
Reference in New Issue
Block a user