mirror of
https://github.com/meshtastic/firmware.git
synced 2025-08-24 05:50:16 +00:00
add UI frame to display PaxCounter module data
This commit is contained in:
parent
02192e1163
commit
bbc76f884e
@ -87,4 +87,25 @@ int32_t PaxcounterModule::runOnce()
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Probably we could get this from Screen or other central class
|
||||
#define FONT_SMALL ArialMT_Plain_10
|
||||
#define FONT_MEDIUM ArialMT_Plain_16
|
||||
#define FONT_LARGE ArialMT_Plain_24
|
||||
|
||||
void PaxcounterModule::drawFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y)
|
||||
{
|
||||
char buffer[50];
|
||||
display->setTextAlignment(TEXT_ALIGN_LEFT);
|
||||
display->setFont(FONT_SMALL);
|
||||
display->drawString(x + 0, y + 0, "PAX");
|
||||
|
||||
libpax_counter_count(&count_from_libpax);
|
||||
|
||||
display->setTextAlignment(TEXT_ALIGN_CENTER);
|
||||
display->setFont(FONT_SMALL);
|
||||
display->drawStringf(display->getWidth() / 2 + x, 0 + y + 12,
|
||||
buffer, "WiFi: %d\nBLE: %d\nuptime: %ds",
|
||||
count_from_libpax.wifi_count, count_from_libpax.ble_count, millis() / 1000);
|
||||
}
|
||||
|
||||
#endif
|
@ -23,6 +23,8 @@ class PaxcounterModule : private concurrency::OSThread, public ProtobufModule<me
|
||||
bool sendInfo(NodeNum dest = NODENUM_BROADCAST);
|
||||
virtual bool handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshtastic_Paxcount *p) override;
|
||||
virtual meshtastic_MeshPacket *allocReply() override;
|
||||
virtual bool wantUIFrame() override { return true; }
|
||||
virtual void drawFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y) override;
|
||||
};
|
||||
|
||||
extern PaxcounterModule *paxcounterModule;
|
||||
|
Loading…
Reference in New Issue
Block a user