CC_MONITOR_ONLY option added

GPS Time will be displayed as YYYY-MM-DD HH-MM-SS
This commit is contained in:
tuxphone 2024-06-02 14:33:01 +02:00
parent 23f3ff0392
commit 30d259645c
2 changed files with 37 additions and 27 deletions

View File

@ -181,30 +181,35 @@ void startReceive(){
// send packet (blocking), MCU sleeps while waiting for TX DONE // send packet (blocking), MCU sleeps while waiting for TX DONE
bool perhapsSend(Packet_t* p) { bool perhapsSend(Packet_t* p) {
if (p->size > RADIOLIB_SX126X_MAX_PACKET_LENGTH) { if (!CC_MONITOR_ONLY) {
MSG("\n\r[INF]Packet size is %i! Reducing to %i. Sending ...", p->size, RADIOLIB_SX126X_MAX_PACKET_LENGTH); if (p->size > RADIOLIB_SX126X_MAX_PACKET_LENGTH) {
p->size = RADIOLIB_SX126X_MAX_PACKET_LENGTH; MSG("\n\r[INF]Packet size is %i! Reducing to %i. Sending ...", p->size, RADIOLIB_SX126X_MAX_PACKET_LENGTH);
} p->size = RADIOLIB_SX126X_MAX_PACKET_LENGTH;
// clear irq status, standby() }
radio.finishTransmit(); // clear irq status, standby()
dio1 = false; radio.finishTransmit();
PacketHeader* h = (PacketHeader *)p->buf; dio1 = false;
MSG("[TX] (id=0x%08X) HopLim=%i ", h->id, (h->flags & PACKET_FLAGS_HOP_MASK)); PacketHeader* h = (PacketHeader *)p->buf;
err=radio.startTransmit(p->buf, p->size); MSG("[TX] (id=0x%08X) HopLim=%i ", h->id, (h->flags & PACKET_FLAGS_HOP_MASK));
isReceiving = false; err=radio.startTransmit(p->buf, p->size);
if (err == RADIOLIB_ERR_NONE) { isReceiving = false;
MSG("starting ... "); if (err == RADIOLIB_ERR_NONE) {
MSG("starting ... ");
} else {
MSG("failed, ERR = %i - resume RX\n\r", err);
return false;
}
delay(10);
MCU_deepsleep(); // wait for TX to complete, will wake on any DIO1
err = radio.getIrqStatus();
(err & RADIOLIB_SX126X_IRQ_TX_DONE) ? MSG("done!\n\r") : MSG("failed. Returned IRQ=%i\n\r", err);
dio1 = false;
radio.finishTransmit();
return ( err & RADIOLIB_SX126X_IRQ_TX_DONE );
} else { } else {
MSG("failed, ERR = %i - resume RX\n\r", err); MSG("[TX]**Monitor only, no TX**\n\r");
return false; return true;
} }
delay(10);
MCU_deepsleep(); // wait for TX to complete, will wake on any DIO1
err = radio.getIrqStatus();
(err & RADIOLIB_SX126X_IRQ_TX_DONE) ? MSG("done!\n\r") : MSG("failed. Returned IRQ=%i\n\r", err);
dio1 = false;
radio.finishTransmit();
return ( err & RADIOLIB_SX126X_IRQ_TX_DONE );
} }
bool perhapsDecode(Packet_t* p) { bool perhapsDecode(Packet_t* p) {
@ -321,11 +326,13 @@ void printVariants(void){
return; return;
} }
// Log packet size and data fields // Log packet size and data fields
MSG("Node=%08X(%s) l=%d latI=%d lonI=%d msl=%d hae=%d geo=%d pdop=%d hdop=%d vdop=%d siv=%d fxq=%d fxt=%d pts=%d " MSG("Node=%08X(%s) l=%d latI=%d lonI=%d msl=%d hae=%d geo=%d pdop=%d hdop=%d vdop=%d siv=%d fxq=%d fxt=%d pts=%d ",
"time=%d\n\r",
mp.from, NodeDB.get(mp.from), d.payload.size, pos.latitude_i, pos.longitude_i, pos.altitude, pos.altitude_hae, mp.from, NodeDB.get(mp.from), d.payload.size, pos.latitude_i, pos.longitude_i, pos.altitude, pos.altitude_hae,
pos.altitude_geoidal_separation, pos.PDOP, pos.HDOP, pos.VDOP, pos.sats_in_view, pos.fix_quality, pos.fix_type, pos.timestamp, pos.altitude_geoidal_separation, pos.PDOP, pos.HDOP, pos.VDOP, pos.sats_in_view, pos.fix_quality, pos.fix_type, pos.timestamp
pos.time); );
MSG("time=%04d-%02d-%02d %02d:%02d:%02d\n\r",
year(pos.time), month(pos.time), day(pos.time),
hour(pos.time), minute(pos.time), second(pos.time));
NodeDB.update(&theNode); // update last heard NodeDB.update(&theNode); // update last heard
return; return;
} }

View File

@ -11,11 +11,13 @@
#define CC_MY_LORA_BW 125.0 // use these settings, if not using a modem preset #define CC_MY_LORA_BW 125.0 // use these settings, if not using a modem preset
#define CC_MY_LORA_SF 9 #define CC_MY_LORA_SF 9
#define CC_MY_LORA_CR 5 #define CC_MY_LORA_CR 5
#define CC_MY_LORA_POWER 20 // 0 = max legal power for region #define CC_MY_LORA_POWER 20 // 0 = max legal power for region
#define CC_MY_LORA_FREQ 0.0 // if you want to override frequency calculation: Freq in MHz (e.g. 869.4) #define CC_MY_LORA_FREQ 0.0 // if you want to override frequency calculation: Freq in MHz (e.g. 869.4)
#define CC_MAX_POWER 22 // TX power setting. Absolute Max for CubeCell is 22, enforced by RadioLib. #define CC_MAX_POWER 22 // TX power setting. Absolute Max for CubeCell is 22, enforced by RadioLib.
#define CC_MONITOR_ONLY false // set true to suppress transmitting of packets (just monitor the traffic)
#define MAX_ID_LIST 64 // number of stored packet IDs to prevent unnecesary repeating #define MAX_ID_LIST 64 // number of stored packet IDs to prevent unnecesary repeating
#define MAX_NODE_LIST 20 // number of stored known nodes #define MAX_NODE_LIST 20 // number of stored known nodes
#define MAX_TX_QUEUE 8 // max number of packets which can be waiting for transmission #define MAX_TX_QUEUE 8 // max number of packets which can be waiting for transmission
@ -69,6 +71,7 @@ SX1262 radio = new Module(RADIOLIB_BUILTIN_MODULE);
#include <pb_decode.h> #include <pb_decode.h>
#include <pb_encode.h> #include <pb_encode.h>
#include <CryptoEngine.h> #include <CryptoEngine.h>
#include <time.h>
/* /*
extern "C" extern "C"
{ {