Fork to see if I can get working
Dependencies: BufferedSerial OneWire WinbondSPIFlash libxDot-dev-mbed5-deprecated
Fork of xDotBridge_update_test20180823 by
Revision 97:594e47206604, committed 2017-11-28
- Comitter:
- mbriggs_vortex
- Date:
- Tue Nov 28 16:19:57 2017 +0000
- Parent:
- 96:e962c5000145
- Parent:
- 95:aa9908d459c2
- Child:
- 98:3609f600c2f5
- Commit message:
- Merged branch.
Changed in this revision
--- a/xDotBridge/src/CommProtocolPeerBrute.cpp Tue Nov 21 19:43:01 2017 -0700
+++ b/xDotBridge/src/CommProtocolPeerBrute.cpp Tue Nov 28 16:19:57 2017 +0000
@@ -9,7 +9,7 @@
#include "dot_util.h"
#include "util.h"
#include "MyLog.h"
-#include "ChannelPlan.h"
+#include "ChannelPlans.h"
// wireless bridge protocol
const uint8_t TX_PWR = 20; // 20 dBm
@@ -57,6 +57,7 @@
// myLogInfo("defaulting Dot configuration");
// dot->resetConfig();
+// dot->setWakePin(GPIO0);
// Common Configuration
dot->setAesEncryption(true); // Enable encryption
@@ -86,7 +87,7 @@
// DR6 : SF7 @ 250kHz
// DR0 - DR5 (125kHz channels) available but much slower
tx_frequency = 869850000;
- tx_datarate = mDot::DR6;
+ tx_datarate = lora::DR_6;
// the 869850000 frequency is 100% duty cycle if the total power is under 7 dBm - tx power 4 + antenna gain 3 = 7
tx_power = 4;
break;
@@ -94,7 +95,6 @@
case lora::ChannelPlan::US915:
case lora::ChannelPlan::AU915_OLD:
case lora::ChannelPlan::AU915:
- default:
// 500kHz channels achieve highest throughput
// DR8 : SF12 @ 500kHz
// DR9 : SF11 @ 500kHz
@@ -104,10 +104,13 @@
// DR13 : SF7 @ 500kHz
// DR0 - DR3 (125kHz channels) available but much slower
tx_frequency = 915500000;
- tx_datarate = mDot::DR13;
+ tx_datarate = lora::DR_13;
// 915 bands have no duty cycle restrictions, set tx power to max
tx_power = 20;
break;
+ default:
+ logError("ChannelPlan Error!!!");
+ return cmdError;
}
// in PEER_TO_PEER mode there is no join request/response transaction
// as long as both Dots are configured correctly, they should be able to communicate
@@ -123,8 +126,9 @@
return cmdError;
}
-// myLogInfo("defaulting Dot configuration");
-// dot->resetConfig();
+ myLogInfo("defaulting Dot configuration"); // TEST
+ dot->resetConfig();
+ dot->setWakePin(GPIO0);
// Common Configuration
dot->setAesEncryption(true); // Enable encryption
@@ -133,8 +137,6 @@
dot->setClass("C"); // Set class C
dot->setTxPower(TX_PWR);
dot->setPreserveSession(false);
-// dot->setDownLinkCounter(0);
-// dot->setUpLinkCounter(1);
// TODO break out in a utility function
// update configuration if necessary
myLogDebug("Setting up peer to peer configuration");
@@ -156,7 +158,7 @@
// DR6 : SF7 @ 250kHz
// DR0 - DR5 (125kHz channels) available but much slower
tx_frequency = 869850000;
- tx_datarate = mDot::DR6;
+ tx_datarate = lora::DR_6;
// the 869850000 frequency is 100% duty cycle if the total power is under 7 dBm - tx power 4 + antenna gain 3 = 7
tx_power = 4;
break;
@@ -164,7 +166,6 @@
case lora::ChannelPlan::US915:
case lora::ChannelPlan::AU915_OLD:
case lora::ChannelPlan::AU915:
- default:
// 500kHz channels achieve highest throughput
// DR8 : SF12 @ 500kHz
// DR9 : SF11 @ 500kHz
@@ -174,10 +175,14 @@
// DR13 : SF7 @ 500kHz
// DR0 - DR3 (125kHz channels) available but much slower
tx_frequency = 915500000;
- tx_datarate = mDot::DR13;
+ tx_datarate = lora::DR_13;
// 915 bands have no duty cycle restrictions, set tx power to max
tx_power = 20;
break;
+ default:
+ logError("ChannelPlan Error!!!");
+ return cmdError;
+
}
update_peer_to_peer_config(pair_network_address, pair_network_session_key, pair_data_session_key, tx_frequency, tx_datarate, tx_power);
dot->saveConfig(); // This is required for network settings to apply
--- a/xDotBridge/src/main.cpp Tue Nov 21 19:43:01 2017 -0700
+++ b/xDotBridge/src/main.cpp Tue Nov 28 16:19:57 2017 +0000
@@ -18,7 +18,7 @@
#define RX_SEQ_LOG 1
-const float BridgeVersion = 1.98; // Bumped 2017/11/TODO
+const float BridgeVersion = 1.96; // Bumped 2017/11/TODO
// 232 Pins
const PinName SER_TERM_TX = UART_TX;
@@ -30,6 +30,7 @@
InterruptIn uart1RxIntIn (SER_TERM_RX);
mDot* dot = NULL; // Used by dot-utils
+lora::ChannelPlan* plan = NULL;
volatile bool uartRxFlag;
volatile bool ccIntFlag;
@@ -71,7 +72,7 @@
MyLog::setLogLevel(MyLog::DEBUG_LEVEL);
// use US915 plan
- lora::ChannelPlan* plan = new lora::ChannelPlan_US915();
+ plan = new lora::ChannelPlan_US915();
// use EU868 plan
// lora::ChannelPlan* plan = new lora::ChannelPlan_EU868();
assert(plan);
@@ -101,7 +102,6 @@
dot->setWakeMode(mDot::RTC_ALARM_OR_INTERRUPT);
dot->setWakePin(GPIO0);
-// dot->setWakePin(UART_RX);
display_config(); // Print configuration for now
@@ -194,6 +194,8 @@
rxSeqLog.clear();
rxSeqLog.save();
myLogInfo("NVM Cleared Seq Log");
+ myLogInfo("Resetting...");
+ dot->resetCpu();
}
}
if (protocol->isRx()) {
@@ -221,6 +223,8 @@
rxSeqLog.clear();
rxSeqLog.save();
myLogInfo("NVM Cleared Seq Log");
+ myLogInfo("Resetting...");
+ dot->resetCpu();
}
else if (pairBtnState == pairBtnLongPress) {
myLogInfo("Clearing pair values and generating new ones.");
