Fixed build

This commit is contained in:
lewisxhe 2026-01-27 16:28:07 +08:00
commit 30ce7f099d
68 changed files with 611 additions and 611 deletions

View file

@ -114,9 +114,9 @@ void disablePeripherals();
#endif
#ifdef DISPLAY_MODEL
extern DISPLAY_MODEL *u8g2;
#define U8G2_HOR_ALIGN_CENTER(t) ((u8g2->getDisplayWidth() - (u8g2->getUTF8Width(t))) / 2)
#define U8G2_HOR_ALIGN_RIGHT(t) ( u8g2->getDisplayWidth() - u8g2->getUTF8Width(t))
extern U8G2 *disp;
#define U8G2_HOR_ALIGN_CENTER(t) ((disp->getDisplayWidth() - (disp->getUTF8Width(t))) / 2)
#define U8G2_HOR_ALIGN_RIGHT(t) ( disp->getDisplayWidth() - disp->getUTF8Width(t))
#endif

View file

@ -86,16 +86,16 @@ void loop()
// print RSSI of packet
Serial.print("' with RSSI ");
Serial.println(LoRa.packetRssi());
if (u8g2) {
u8g2->clearBuffer();
if (disp) {
disp->clearBuffer();
char buf[256];
u8g2->drawStr(0, 12, "Received OK!");
u8g2->drawStr(0, 26, recv.c_str());
disp->drawStr(0, 12, "Received OK!");
disp->drawStr(0, 26, recv.c_str());
snprintf(buf, sizeof(buf), "RSSI:%i", LoRa.packetRssi());
u8g2->drawStr(0, 40, buf);
disp->drawStr(0, 40, buf);
snprintf(buf, sizeof(buf), "SNR:%.1f", LoRa.packetSnr());
u8g2->drawStr(0, 56, buf);
u8g2->sendBuffer();
disp->drawStr(0, 56, buf);
disp->sendBuffer();
}
}
}

View file

@ -114,9 +114,9 @@ void disablePeripherals();
#endif
#ifdef DISPLAY_MODEL
extern DISPLAY_MODEL *u8g2;
#define U8G2_HOR_ALIGN_CENTER(t) ((u8g2->getDisplayWidth() - (u8g2->getUTF8Width(t))) / 2)
#define U8G2_HOR_ALIGN_RIGHT(t) ( u8g2->getDisplayWidth() - u8g2->getUTF8Width(t))
extern U8G2 *disp;
#define U8G2_HOR_ALIGN_CENTER(t) ((disp->getDisplayWidth() - (disp->getUTF8Width(t))) / 2)
#define U8G2_HOR_ALIGN_RIGHT(t) ( disp->getDisplayWidth() - disp->getUTF8Width(t))
#endif

View file

@ -75,13 +75,13 @@ void loop()
LoRa.print(counter);
LoRa.endPacket();
if (u8g2) {
if (disp) {
char buf[256];
u8g2->clearBuffer();
u8g2->drawStr(0, 12, "Transmitting: OK!");
disp->clearBuffer();
disp->drawStr(0, 12, "Transmitting: OK!");
snprintf(buf, sizeof(buf), "Sending: %d", counter);
u8g2->drawStr(0, 30, buf);
u8g2->sendBuffer();
disp->drawStr(0, 30, buf);
disp->sendBuffer();
}
counter++;
delay(5000);