Add drawLoraMessage in Screen.cpp

This commit is contained in:
Ludovic BOUÉ 2024-10-13 20:56:21 +02:00 committed by GitHub
parent fb9f361052
commit 952ed6e4dd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -954,6 +954,24 @@ bool deltaToTimestamp(uint32_t secondsAgo, uint8_t *hours, uint8_t *minutes, int
return validCached; return validCached;
} }
static void drawLoraMessage(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y){
display->drawString(x + 0, y + 0, myRegion->name);
display->setFont(FONT_MEDIUM);
display->drawString(x + 10, y + 30,"channel: "+String(DataRegion.lora_channel_num+1));
display->drawString(x + 10, y + 60,"bw: "+ String(DataRegion.lora_bw));
display->drawString(x + SCREEN_WIDTH/2+10, y+30,"freq: "+String(DataRegion.lora_freq));
display->drawString(x + SCREEN_WIDTH/2+10, y+60,"power: "+ String(DataRegion.lora_power_output));
display->drawString(x + 10, y + 90,"sf: "+String(DataRegion.lora_sf));
display->drawString(x + SCREEN_WIDTH/2+10, y+90,"cr: 4/:"+ String(DataRegion.lora_cr));
display->setTextAlignment(TEXT_ALIGN_LEFT);
const char *title = "LoRa";
display->drawString(x + SCREEN_WIDTH/2-20, y +0, title);
display->setFont(FONT_SMALL);
display->setTextAlignment(TEXT_ALIGN_RIGHT);
display->drawString(x + SCREEN_WIDTH, y,String(DataRegion.lora_channel_name));
display->setTextAlignment(TEXT_ALIGN_LEFT); // Restore left align, just to be kind to any other unsuspecting code
}
/// Draw the last text message we received /// Draw the last text message we received
static void drawTextMessageFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y) static void drawTextMessageFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y)
{ {
@ -2817,4 +2835,4 @@ int Screen::handleAdminMessage(const meshtastic_AdminMessage *arg)
} // namespace graphics } // namespace graphics
#else #else
graphics::Screen::Screen(ScanI2C::DeviceAddress, meshtastic_Config_DisplayConfig_OledType, OLEDDISPLAY_GEOMETRY) {} graphics::Screen::Screen(ScanI2C::DeviceAddress, meshtastic_Config_DisplayConfig_OledType, OLEDDISPLAY_GEOMETRY) {}
#endif // HAS_SCREEN #endif // HAS_SCREEN