Skip to content

Commit

Permalink
add debug points
Browse files Browse the repository at this point in the history
  • Loading branch information
wero1414 committed Jan 17, 2024
1 parent 60923b5 commit a03f69d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
18 changes: 12 additions & 6 deletions src/arduino-rfm/LoRaMAC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,14 +139,16 @@ void LORA_Cycle(sBuffer *Data_Tx, sBuffer *Data_Rx, RFM_command_t *RFM_Command,
LORA_Receive_Data(Data_Rx, Session_Data, OTAA_Data, Message_Rx, LoRa_Settings);
}while(millis() - prevTime < Receive_Delay_1 + RX1_Window);
//Return if message on RX1
if (Data_Rx->Counter>0){
if (Data_Rx-> >0){
Serial.println("[debug] Data update received on RX1");
Serial.println("[debug] Counter: "+String(Data_Rx->Counter));
return;
}

//
#ifdef _CLASS_C_
return;
#endif
// #ifdef _CLASS_C_
// return;
// #endif

// Class C open RX2 immediately after first rx window
if(LoRa_Settings->Mote_Class == CLASS_C){
Expand Down Expand Up @@ -202,6 +204,8 @@ void LORA_Cycle(sBuffer *Data_Tx, sBuffer *Data_Rx, RFM_command_t *RFM_Command,

//Return if message on RX2
if (Data_Rx->Counter>0){
Serial.println("[debug] Data update received on RX1");
Serial.println("[debug] Counter: "+String(Data_Rx->Counter));
return;
}
}
Expand Down Expand Up @@ -495,15 +499,17 @@ void LORA_Receive_Data(sBuffer *Data_Rx, sLoRa_Session *Session_Data, sLoRa_OTAA
//If it is a type A device switch RFM to single receive
if(LoRa_Settings->Mote_Class == CLASS_A)
{
Message_Status = RFM_Single_Receive(LoRa_Settings);
Message_Status = RFM_Single_Receive(LoRa_Settings);
}
else
{
//Switch RFM to standby
RFM_Switch_Mode(RFM_MODE_STANDBY);
Message_Status = NEW_MESSAGE;
}

if(Message_Status == TIMEOUT){
Data_Rx->Counter=0x00;
}
//If there is a message received get the data from the RFM
if(Message_Status == NEW_MESSAGE)
{
Expand Down
2 changes: 1 addition & 1 deletion src/arduino-rfm/lorawan-arduino-rfm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ void LoRaWANClass::update(void)
RFM_Command_Status = NO_RFM_COMMAND;
}

lora.setDeviceClass(CLASS_C); // start as class C device
//lora.setDeviceClass(CLASS_C); // start as class C device

}

Expand Down

0 comments on commit a03f69d

Please sign in to comment.