mirror of
https://github.com/esphome/esphome.git
synced 2025-09-26 23:22:21 +01:00
Move ESPTime into core esphome namespace (#4926)
* Prep-work for datetime entities * Fix some includes and remove some restrictions on printing time on displays * format * format * More formatting * Move function contents * Ignore clang-tidy
This commit is contained in:
@@ -158,15 +158,13 @@ void LCDDisplay::clear() {
|
||||
for (uint8_t i = 0; i < this->rows_ * this->columns_; i++)
|
||||
this->buffer_[i] = ' ';
|
||||
}
|
||||
#ifdef USE_TIME
|
||||
void LCDDisplay::strftime(uint8_t column, uint8_t row, const char *format, time::ESPTime time) {
|
||||
void LCDDisplay::strftime(uint8_t column, uint8_t row, const char *format, ESPTime time) {
|
||||
char buffer[64];
|
||||
size_t ret = time.strftime(buffer, sizeof(buffer), format);
|
||||
if (ret > 0)
|
||||
this->print(column, row, buffer);
|
||||
}
|
||||
void LCDDisplay::strftime(const char *format, time::ESPTime time) { this->strftime(0, 0, format, time); }
|
||||
#endif
|
||||
void LCDDisplay::strftime(const char *format, ESPTime time) { this->strftime(0, 0, format, time); }
|
||||
void LCDDisplay::loadchar(uint8_t location, uint8_t charmap[]) {
|
||||
location &= 0x7; // we only have 8 locations 0-7
|
||||
this->command_(LCD_DISPLAY_COMMAND_SET_CGRAM_ADDR | (location << 3));
|
||||
|
@@ -1,11 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "esphome/core/component.h"
|
||||
#include "esphome/core/defines.h"
|
||||
|
||||
#ifdef USE_TIME
|
||||
#include "esphome/components/time/real_time_clock.h"
|
||||
#endif
|
||||
#include "esphome/core/time.h"
|
||||
|
||||
#include <map>
|
||||
#include <vector>
|
||||
@@ -44,13 +40,10 @@ class LCDDisplay : public PollingComponent {
|
||||
/// Evaluate the printf-format and print the text at column=0 and row=0.
|
||||
void printf(const char *format, ...) __attribute__((format(printf, 2, 3)));
|
||||
|
||||
#ifdef USE_TIME
|
||||
/// Evaluate the strftime-format and print the text at the specified column and row.
|
||||
void strftime(uint8_t column, uint8_t row, const char *format, time::ESPTime time)
|
||||
__attribute__((format(strftime, 4, 0)));
|
||||
void strftime(uint8_t column, uint8_t row, const char *format, ESPTime time) __attribute__((format(strftime, 4, 0)));
|
||||
/// Evaluate the strftime-format and print the text at column=0 and row=0.
|
||||
void strftime(const char *format, time::ESPTime time) __attribute__((format(strftime, 2, 0)));
|
||||
#endif
|
||||
void strftime(const char *format, ESPTime time) __attribute__((format(strftime, 2, 0)));
|
||||
|
||||
/// Load custom char to given location
|
||||
void loadchar(uint8_t location, uint8_t charmap[]);
|
||||
|
Reference in New Issue
Block a user