Skip to content

Commit

Permalink
Fixed LoRa-Shield recv invalid
Browse files Browse the repository at this point in the history
  • Loading branch information
lewisxhe committed Aug 21, 2024
1 parent d208084 commit e20dd09
Showing 1 changed file with 10 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ void switch_freq()
void loop()
{

// BOOT Pin Swtcih Freq1
// BOOT Pin Switch Freq1
#ifdef CONFIG_RADIO_FREQ1
prev_state = curr_state;
curr_state = digitalRead(0);
Expand Down Expand Up @@ -335,7 +335,9 @@ void dispRadioTx()
u8g2->sendBuffer();
} else {
Serial.println("-------------B2-----------------------");
Serial.println("Radio Tx ...");
Serial.print("[");
Serial.print(last_send_millis / 1000);
Serial.println("]Radio Tx ...");
Serial.print("FREQ:"); Serial.print(current_freq); Serial.println("MHz");
}

Expand Down Expand Up @@ -395,7 +397,13 @@ void dispRadioRx()
{

if (!last_recv_status) {
Serial.print("Start radio listing ");
transmissionState = radio.startReceive();
if(transmissionState != RADIOLIB_ERR_NONE){
Serial.println(" Failed");
}else{
Serial.println(" Success");
}
last_recv_status = true;
drawRadioRx("NONE", "0dB", "0dBm");
}
Expand Down Expand Up @@ -736,20 +744,6 @@ bool beginRadio()
radio.setRfSwitchPins(RADIO_RX_PIN, RADIO_TX_PIN);
#endif

// start transmitting the first packet
Serial.print(F("Radio Sending first packet ... "));

// you can transmit C-string or Arduino string up to
// 256 characters long
transmissionState = radio.startTransmit(String(counter).c_str());

// you can also transmit byte array up to 256 bytes long
/*
byte byteArr[] = {0x01, 0x23, 0x45, 0x67,
0x89, 0xAB, 0xCD, 0xEF};
state = radio.startTransmit(byteArr, 8);
*/

return true;
}

Expand Down

0 comments on commit e20dd09

Please sign in to comment.