Fork to see if I can get working
Dependencies: BufferedSerial OneWire WinbondSPIFlash libxDot-dev-mbed5-deprecated
Fork of xDotBridge_update_test20180823 by
Revision 54:c04d7b6fa075, committed 2017-02-22
- Comitter:
- Matt Briggs
- Date:
- Wed Feb 22 15:39:40 2017 -0700
- Parent:
- 53:a1563574a980
- Child:
- 55:79ab0bbc5008
- Commit message:
- Working static network bridge. Woot!
Changed in this revision
--- a/xDotBridge/inc/CommProtocolPeerBrute.h Wed Feb 22 10:45:56 2017 -0700
+++ b/xDotBridge/inc/CommProtocolPeerBrute.h Wed Feb 22 15:39:40 2017 -0700
@@ -122,6 +122,8 @@
*/
CmdResult listen (bool &msgPending);
+ CmdResult sampleDLC();
+
/**
* @brief Returns the last message received via listening
*
@@ -165,6 +167,7 @@
uint8_t mNetwork_session_key[16];
uint8_t mData_session_key[16];
bool mIsTx;
+ uint32_t mPrevDownLinkCnt;
/**
* @brief Reads baseboard information from non-volatile memory (NVM)
--- a/xDotBridge/src/CommProtocolPeerBrute.cpp Wed Feb 22 10:45:56 2017 -0700
+++ b/xDotBridge/src/CommProtocolPeerBrute.cpp Wed Feb 22 15:39:40 2017 -0700
@@ -21,6 +21,7 @@
logInfo("RX_SLEEP_TIME %f, timeOnAir %lu, nTimesToTx %lu", RX_SLEEP_TIME, TX_TIME, nTimesToTx);
mIsTx = true; // default to TX
+ mPrevDownLinkCnt = dot->getDownLinkCounter();
// dot = mDot::getInstance();
}
@@ -127,19 +128,25 @@
join_network();
}
- uint32_t cDwnLink = dot->getDownLinkCounter();
+// uint32_t cDwnLink = dot->getDownLinkCounter();
wait(TX_TIME/1000.0); // Wait TX_TIME
- if (cDwnLink < dot->getDownLinkCounter()) {
+ if (mPrevDownLinkCnt < dot->getDownLinkCounter()) {
msgPending = true;
}
else {
msgPending = false;
}
+ mPrevDownLinkCnt = dot->getDownLinkCounter();
return cmdSuccess; // Maybe add timeout as a possible return value
}
+CmdResult CommProtocolPeerBrute::sampleDLC () {
+ mPrevDownLinkCnt = dot->getDownLinkCounter();
+ return cmdSuccess;
+}
+
CmdResult CommProtocolPeerBrute::recv (std::vector<uint8_t> &msg)
{
dot->recv(msg);
--- a/xDotBridge/src/main.cpp Wed Feb 22 10:45:56 2017 -0700
+++ b/xDotBridge/src/main.cpp Wed Feb 22 15:39:40 2017 -0700
@@ -55,7 +55,7 @@
dot->setLogLevel(mts::MTSLog::INFO_LEVEL);
// attach the custom events handler
-// dot->setEvents(&events); // Little bonus event debug information
+ dot->setEvents(&events); // Little bonus event debug information
// Finish radio init
protocol->init();
@@ -86,7 +86,7 @@
// logInfo("Programmable Voltage Detector set for level: %d", pvdConfig.PVDLevel);
// // HAL_PWR_PVDCallback need to define this I think this will override the current implementation
- dot->setWakePin(GPIO3);
+ dot->setWakePin(UART1_RX);
// display configuration
@@ -183,7 +183,7 @@
#if LED_FEEDBACK
bbio->ledOn();
#endif
- wait(0.5); // TODO this should be configurable
+ wait(5.0); // TODO this should be configurable
}
bbio->ledOff();
bbio->relayNormal();
@@ -191,6 +191,7 @@
// sleep_save_io();
// sleep_configure_io();
// TODO maybe add if statement here to prevent double hits by sleeping for a longer time
+ protocol->sampleDLC();
dot->sleep(2, mDot::RTC_ALARM_OR_INTERRUPT, false); // Go to sleep until wake button
// sleep_restore_io();
}
