Add missing macro definition

This commit is contained in:
lewisxhe 2021-01-27 09:58:35 +08:00
commit 3a360eb884

View file

@ -50,25 +50,13 @@ void setup()
// When the power is turned on, a delay is required.
delay(1500);
// initialize SX1262 with default settings
Serial.print(F("[SX1262] Initializing ... "));
#ifndef LoRa_frequency
int state = radio.begin(868.0);
#else
#ifdef LoRa_frequency
int state = radio.begin(LoRa_frequency);
#else
int state = radio.begin(868.0);
#endif
#ifdef HAS_DISPLAY
if (u8g2) {
if (state != ERR_NONE) {
u8g2->clearBuffer();
u8g2->drawStr(0, 12, "Initializing: FAIL!");
u8g2->sendBuffer();
}
}
#endif
if (state == ERR_NONE) {
Serial.println(F("success!"));
} else {
@ -142,19 +130,7 @@ void loop()
Serial.print(F("[SX1262] SNR:\t\t"));
Serial.print(radio.getSNR());
Serial.println(F(" dB"));
#ifdef HAS_DISPLAY
if (u8g2) {
u8g2->clearBuffer();
char buf[256];
u8g2->drawStr(0, 12, "Received OK!");
u8g2->drawStr(5, 26, str.c_str());
snprintf(buf, sizeof(buf), "RSSI:%.2f", radio.getRSSI());
u8g2->drawStr(0, 40, buf);
snprintf(buf, sizeof(buf), "SNR:%.2f", radio.getSNR());
u8g2->drawStr(0, 54, buf);
u8g2->sendBuffer();
}
#endif
} else if (state == ERR_CRC_MISMATCH) {
// packet was received, but is malformed
Serial.println(F("CRC error!"));