Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a destructor to M5EPD #23

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions src/M5EPD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,8 @@
#define SCALE 0.5//0.78571429
#define ADC_FILTER_SAMPLE 8


M5EPD::M5EPD()
M5EPD::M5EPD() : _is_adc_start(false), _isInited(false), _adc_chars(nullptr)
{
_isInited = false;
_is_adc_start = false;
}

/** @brief Initialize the power supply, screen and other peripherals
Expand Down
11 changes: 8 additions & 3 deletions src/M5EPD.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ class M5EPD
{
public:
M5EPD();
~M5EPD()
{
if (_adc_chars != nullptr)
free(_adc_chars);
}
void begin(bool touchEnable = true, bool SDEnable = true, bool SerialEnable = true, bool BatteryADCEnable = true, bool I2CEnable = false);
void update();
void enableEXTPower() { digitalWrite(M5EPD_EXT_PWR_EN_PIN, 1); }
Expand All @@ -52,9 +57,9 @@ class M5EPD
uint32_t getBatteryVoltage();

void shutdown();
int shutdown( int seconds );
int shutdown( const rtc_time_t &RTC_TimeStruct);
int shutdown( const rtc_date_t &RTC_DateStruct, const rtc_time_t &RTC_TimeStruct);
int shutdown(int seconds);
int shutdown(const rtc_time_t &RTC_TimeStruct);
int shutdown(const rtc_date_t &RTC_DateStruct, const rtc_time_t &RTC_TimeStruct);

Button BtnL = Button(M5EPD_KEY_LEFT_PIN, true, 10);
Button BtnP = Button(M5EPD_KEY_PUSH_PIN, true, 10);
Expand Down