mirror of
https://github.com/meshtastic/firmware.git
synced 2025-06-08 14:12:05 +00:00
Update PaxcounterModule.cpp with CommonHeader
This commit is contained in:
parent
50b3da262d
commit
993f644954
@ -3,6 +3,9 @@
|
|||||||
#include "Default.h"
|
#include "Default.h"
|
||||||
#include "MeshService.h"
|
#include "MeshService.h"
|
||||||
#include "PaxcounterModule.h"
|
#include "PaxcounterModule.h"
|
||||||
|
#include "graphics/ScreenFonts.h"
|
||||||
|
#include "graphics/SharedUIDisplay.h"
|
||||||
|
#include "graphics/images.h"
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
PaxcounterModule *paxcounterModule;
|
PaxcounterModule *paxcounterModule;
|
||||||
@ -115,16 +118,25 @@ int32_t PaxcounterModule::runOnce()
|
|||||||
|
|
||||||
void PaxcounterModule::drawFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y)
|
void PaxcounterModule::drawFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y)
|
||||||
{
|
{
|
||||||
|
display->clear();
|
||||||
|
display->setTextAlignment(TEXT_ALIGN_LEFT);
|
||||||
|
display->setFont(FONT_SMALL);
|
||||||
|
|
||||||
|
// === Set Title
|
||||||
|
const char *titleStr = "Pax";
|
||||||
|
|
||||||
|
// === Header ===
|
||||||
|
graphics::drawCommonHeader(display, x, y, titleStr);
|
||||||
|
|
||||||
char buffer[50];
|
char buffer[50];
|
||||||
display->setTextAlignment(TEXT_ALIGN_LEFT);
|
display->setTextAlignment(TEXT_ALIGN_LEFT);
|
||||||
display->setFont(FONT_SMALL);
|
display->setFont(FONT_SMALL);
|
||||||
display->drawString(x + 0, y + 0, "PAX");
|
|
||||||
|
|
||||||
libpax_counter_count(&count_from_libpax);
|
libpax_counter_count(&count_from_libpax);
|
||||||
|
|
||||||
display->setTextAlignment(TEXT_ALIGN_CENTER);
|
display->setTextAlignment(TEXT_ALIGN_CENTER);
|
||||||
display->setFont(FONT_SMALL);
|
display->setFont(FONT_SMALL);
|
||||||
display->drawStringf(display->getWidth() / 2 + x, 0 + y + 12, buffer, "WiFi: %d\nBLE: %d\nuptime: %ds",
|
display->drawStringf(display->getWidth() / 2 + x, compactFirstLine, buffer, "WiFi: %d\nBLE: %d\nUptime: %ds",
|
||||||
count_from_libpax.wifi_count, count_from_libpax.ble_count, millis() / 1000);
|
count_from_libpax.wifi_count, count_from_libpax.ble_count, millis() / 1000);
|
||||||
}
|
}
|
||||||
#endif // HAS_SCREEN
|
#endif // HAS_SCREEN
|
||||||
|
Loading…
Reference in New Issue
Block a user