bugfixes
This commit is contained in:
2
.vscode/arduino.json
vendored
2
.vscode/arduino.json
vendored
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"board": "bsfrance:avr:lora32u4",
|
"board": "bsfrance:avr:lora32u4",
|
||||||
"sketch": "crossbow/crossbow.ino",
|
"sketch": "crossbow/crossbow.ino",
|
||||||
"port": "COM11",
|
"port": "COM7",
|
||||||
"output": "../build"
|
"output": "../build"
|
||||||
}
|
}
|
||||||
@@ -285,7 +285,18 @@ void loop(void)
|
|||||||
|
|
||||||
uint32_t currentMillis = millis();
|
uint32_t currentMillis = millis();
|
||||||
|
|
||||||
#ifdef DEVICE_MODE_TX
|
#ifdef DEVICE_MODE_RX
|
||||||
|
/*
|
||||||
|
* This routine handles resync of TX/RX while hoppping frequencies
|
||||||
|
*/
|
||||||
|
radioNode.handleChannelDwell();
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Detect the moment when radio module stopped transmittig and put it
|
||||||
|
* back in to receive state
|
||||||
|
*/
|
||||||
|
radioNode.handleTxDoneState(false);
|
||||||
|
#else
|
||||||
|
|
||||||
//Process buttons
|
//Process buttons
|
||||||
button0.loop();
|
button0.loop();
|
||||||
@@ -314,21 +325,10 @@ void loop(void)
|
|||||||
txInput.restart();
|
txInput.restart();
|
||||||
serialRestartMillis = currentMillis;
|
serialRestartMillis = currentMillis;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
radioNode.handleTxDoneState(true);
|
||||||
* This routine handles resync of TX/RX while hoppping frequencies
|
|
||||||
*/
|
|
||||||
#ifdef DEVICE_MODE_RX
|
|
||||||
radioNode.handleChannelDwell();
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
|
||||||
* Detect the moment when radio module stopped transmittig and put it
|
|
||||||
* back in to receive state
|
|
||||||
*/
|
|
||||||
radioNode.handleTxDoneState();
|
|
||||||
|
|
||||||
radioNode.readAndDecode(
|
radioNode.readAndDecode(
|
||||||
&qsp,
|
&qsp,
|
||||||
&rxDeviceState,
|
&rxDeviceState,
|
||||||
|
|||||||
@@ -119,8 +119,9 @@ void RadioNode::handleChannelDwell(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RadioNode::handleTxDoneState(void) {
|
void RadioNode::handleTxDoneState(bool hop) {
|
||||||
uint32_t currentMillis = millis();
|
uint32_t currentMillis = millis();
|
||||||
|
|
||||||
if (
|
if (
|
||||||
currentMillis > nextTxCheckMillis &&
|
currentMillis > nextTxCheckMillis &&
|
||||||
deviceState == RADIO_STATE_TX &&
|
deviceState == RADIO_STATE_TX &&
|
||||||
@@ -130,9 +131,9 @@ void RadioNode::handleTxDoneState(void) {
|
|||||||
/*
|
/*
|
||||||
* In case of TX module, hop right now
|
* In case of TX module, hop right now
|
||||||
*/
|
*/
|
||||||
#ifdef DEVICE_MODE_TX
|
if (hop) {
|
||||||
hopFrequency(true, getChannel(), currentMillis);
|
hopFrequency(true, getChannel(), currentMillis);
|
||||||
#endif
|
}
|
||||||
|
|
||||||
LoRa.receive();
|
LoRa.receive();
|
||||||
deviceState = RADIO_STATE_RX;
|
deviceState = RADIO_STATE_RX;
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ class RadioNode {
|
|||||||
uint8_t getChannel(void);
|
uint8_t getChannel(void);
|
||||||
uint32_t getChannelEntryMillis(void);
|
uint32_t getChannelEntryMillis(void);
|
||||||
void handleChannelDwell(void);
|
void handleChannelDwell(void);
|
||||||
void handleTxDoneState();
|
void handleTxDoneState(bool hop);
|
||||||
void handleTx(QspConfiguration_t *qsp);
|
void handleTx(QspConfiguration_t *qsp);
|
||||||
volatile int8_t bytesToRead = -1;
|
volatile int8_t bytesToRead = -1;
|
||||||
volatile uint8_t deviceState = RADIO_STATE_RX;
|
volatile uint8_t deviceState = RADIO_STATE_RX;
|
||||||
|
|||||||
Reference in New Issue
Block a user