Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <lilka.h>
- #include "ipapp.h"
- #include "servicemanager.h"
- #include "services/network.h"
- IPApp::IPApp() : App("IP Address") {}
- void IPApp::run() {
- while (true) {
- String ipAddress = WiFi.localIP().toString();
- String macStr = WiFi.macAddress();
- String info = "IP: " + ipAddress + "\nMAC: " + macStr;
- // Читаємо стан кнопок
- lilka::State state = lilka::controller.getState();
- if (state.b.pressed) {
- return;
- }
- // Використовуємо готовий UI-компонент
- lilka::Alert alert("Мережа", info);
- alert.draw(canvas);
- queueDraw();
- // Можна додати очікування, поки користувач не натисне кнопку для виходу
- while (!alert.isFinished()) {
- alert.update();
- vTaskDelay(LILKA_UI_UPDATE_DELAY_MS / portTICK_PERIOD_MS);
- lilka::State state = lilka::controller.getState();
- if (state.b.pressed) {
- return;
- }
- }
- }
- }
- #ifndef IPAPP_H
- #define IPAPP_H
- #include <lilka.h>
- #include "app.h"
- #include "services/network.h"
- class IPApp : public App {
- public:
- IPApp();
- private:
- void run() override;
- };
- #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement