forked from Akcelerometry_drgania_WMT/PI_mikrokontroler
94 lines
2.5 KiB
C++
94 lines
2.5 KiB
C++
#ifndef DISPLAY_H
|
|
#define DISPLAY_H
|
|
|
|
#pragma once
|
|
#include "esp_log.h"
|
|
#include <Arduino.h>
|
|
#include <LiquidCrystal_I2C.h>
|
|
#include <Wire.h>
|
|
#include <Version.h>
|
|
#include <RTClib.h>
|
|
#include <Config.h>
|
|
|
|
#define SCREEN_WIDTH 40
|
|
#define SCREEN_HEIGHT 4
|
|
#define SCREEN_ADDRESS 0x27
|
|
|
|
class Display {
|
|
public:
|
|
Display(RTC_DS3231 &rtc,
|
|
uint8_t address = SCREEN_ADDRESS,
|
|
uint8_t columns = SCREEN_WIDTH,
|
|
uint8_t rows = SCREEN_HEIGHT);
|
|
|
|
// Zwraca true, jeśli urządzenie na I2C odpowiada
|
|
bool begin(TwoWire *wire = &Wire);
|
|
|
|
/* Ekran startowy urządzenia */
|
|
void welcomeScreen();
|
|
|
|
/* Czyście wiersz */
|
|
void clearRow(uint16_t line);
|
|
|
|
/* Wyświetla wyśrodkowany tekst w danym wierszu */
|
|
void textCenter(uint8_t line, const char *txt);
|
|
|
|
/* Wyświetla tekst w danym wierszu od lewej, bez centrowania */
|
|
void text(uint8_t line, const char *text);
|
|
|
|
/* Status - najniższy wiersz. Czyści przed zapisaniem */
|
|
void textStatus(const char *text);
|
|
|
|
void clear();
|
|
|
|
/* Ekran po uruchomieniu */
|
|
void mainScreen();
|
|
|
|
/* Ekran jeśli offline miga co 1 sek */
|
|
void displayOffline(bool measure, uint8_t count, float freeSpace, long licznik, bool refresh = false);
|
|
|
|
/* Podsumowanie po pomiarze: ramki, sampling, etc. */
|
|
void displaySampleRateSummary(uint32_t reccount, uint32_t captureSeconds, float khz, String filename);
|
|
|
|
void updateNetwork(String ip, bool connected);
|
|
void updateBarWiFi(long signal, bool connected);
|
|
void textStyle(const uint8_t st, String text);
|
|
void message(String text);
|
|
|
|
void print(String text);
|
|
void println(String text);
|
|
void setCursor(int16_t x, int16_t y);
|
|
void showAccel(float a, float b, float c);
|
|
void displayOnOffM(bool measure, String myDir, String myFile);
|
|
void initMeasure(
|
|
bool measure, // czy pomiar ciągły?
|
|
bool run, // czy uruchomiony?
|
|
bool runmes,
|
|
uint16_t pause, // Czas (s) pomiędzy próbkami
|
|
uint8_t duration, // Czas (s) trwania próbki
|
|
bool connect, // Czy połączenie Network
|
|
long counter, // główny licznik long
|
|
String gdate, // Data aktualna
|
|
String gtime); // Czas aktualny
|
|
|
|
private:
|
|
LiquidCrystal_I2C *_lcd;
|
|
RTC_DS3231 &rtc_;
|
|
uint8_t _columns;
|
|
uint8_t _rows;
|
|
uint8_t _address;
|
|
|
|
// Poprzednie
|
|
uint16_t oyear;
|
|
uint8_t omonth;
|
|
uint8_t oday;
|
|
uint8_t ohour;
|
|
uint8_t omin;
|
|
uint8_t osec;
|
|
float ospace;
|
|
uint8_t oadxlcnt;
|
|
bool omode;
|
|
};
|
|
|
|
#endif
|