51 lines
1.5 KiB
C++
51 lines
1.5 KiB
C++
// =====================================================================
|
|
// OLEDDisplay.h
|
|
// Quản lý hiển thị màn hình OLED I2C 128x64
|
|
// =====================================================================
|
|
#pragma once
|
|
|
|
#include <Arduino.h>
|
|
#include <Wire.h>
|
|
#include <Adafruit_GFX.h>
|
|
#include <Adafruit_SSD1306.h>
|
|
#include "LD2453Parser.h"
|
|
|
|
#define SCREEN_WIDTH 128
|
|
#define SCREEN_HEIGHT 64
|
|
#define OLED_RESET -1 // Reset pin (hoặc -1 nếu dùng chung với ESP32 reset)
|
|
|
|
class OLEDDisplay {
|
|
public:
|
|
OLEDDisplay(uint8_t sdaPin, uint8_t sclPin, uint8_t i2cAddr);
|
|
|
|
bool begin();
|
|
void clear();
|
|
|
|
// Hiển thị trạng thái khởi động
|
|
void showBootScreen(const char* nodeId);
|
|
|
|
// Hiển thị trạng thái kết nối WiFi
|
|
void showWiFiConnecting(const char* ssid);
|
|
void showWiFiConnected(IPAddress ip);
|
|
|
|
// Hiển thị chế độ Diagnostic
|
|
void showDiagnosticMode();
|
|
|
|
// Hiển thị thông tin radar (DIAGNOSTIC_MODE)
|
|
void updateRadarInfo(const RadarFrame &frame, const LD2453Stats &stats);
|
|
|
|
// Hiển thị tóm tắt detection (full mode)
|
|
void updateDetectionSummary(uint8_t targetCount, bool zone1, bool zone2, bool zone3);
|
|
|
|
// Hiển thị thống kê khi không có frame
|
|
void updateStats(const LD2453Stats &stats);
|
|
|
|
private:
|
|
Adafruit_SSD1306 _display;
|
|
uint8_t _sdaPin;
|
|
uint8_t _sclPin;
|
|
uint8_t _i2cAddr;
|
|
|
|
void centerText(const char* text, int16_t y);
|
|
};
|