Advertisement
nene1234

ip work short

Jul 3rd, 2025
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.23 KB | None | 0 0
  1. #include <lilka.h>
  2. #include "ipapp.h"
  3. #include "servicemanager.h"
  4. #include "services/network.h"
  5.  
  6. IPApp::IPApp() : App("IP Address") {}
  7.  
  8. void IPApp::run() {
  9.     while (true) {
  10.         String ipAddress = WiFi.localIP().toString();
  11.  
  12.         // Читаємо стан кнопок
  13.         lilka::State state = lilka::controller.getState();
  14.         if (state.b.pressed) {
  15.             return;
  16.         }
  17.  
  18.         // Використовуємо готовий UI-компонент
  19.         lilka::Alert alert("IP Адреса", ipAddress);
  20.         alert.draw(canvas);
  21.         queueDraw();
  22.  
  23.         // Можна додати очікування, поки користувач не натисне кнопку для виходу
  24.         while (!alert.isFinished()) {
  25.             alert.update();
  26.             vTaskDelay(LILKA_UI_UPDATE_DELAY_MS / portTICK_PERIOD_MS);
  27.             lilka::State state = lilka::controller.getState();
  28.             if (state.b.pressed) {
  29.                 return;
  30.             }
  31.         }
  32.     }
  33. }
  34.  
  35.  
  36.  
  37. #ifndef IPAPP_H
  38. #define IPAPP_H
  39.  
  40. #include <lilka.h>
  41. #include "app.h"
  42. #include "services/network.h"
  43.  
  44. class IPApp : public App {
  45. public:
  46.     IPApp();
  47. private:
  48.     void run() override;
  49. };
  50.  
  51. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement