@felmue Hello Felix.
Is it possible to provide me the working code snippet with longer than 4 hours sleep duration?
Can you please check if there is any problem with the code snippet I posted earlier?
Software Solutions for Door Displays
@felmue Hello Felix.
I also already had
delay (10) before
Do I2CEnable need to be TRUE in M5 initialization? to use I2C commands?
I have it False in M5 initialization call
M5.begin(true, false, true, true, false);, could this be a problem?
However, it is working fine if the sleep duration is less than 4 hours
M5Paper has 100% battery, I can restart it manually by pressing the side button. The battery is showing as 100%
@felmue I think 4.35v are somehow coming from the charging cable, because as soon as I connect the charging cable the
M5.getBatteryVoltage() / 1000.0 giving me
4.35v but if I remove the charging cable then I get the actual battery voltages e.g
Is it possible that somehow I can read the actual battery voltages even if the device is connected to the charging cable?
@mtylerjr Thanks for your answer. This device is great to have full control but It is not fitting in my use case.
I am using this function
M5.getBatteryVoltage() / 1000.0; to get the battery information of M5stack-paper and display the remaining battery status on the display. It is giving me the correct value of voltages if the M5Paper is running on a battery.
However, If I connect the M5Paper to the charging cable then this function gives
4.35 vol irrespective of the actual battery status. This displays the incorrect
100% battery status on the display.
Is there a way Or any other function to get the actual correct voltages during the charging? So I can display the battery status correctly
Thank you very much for your reply.
I updated the code according to your suggestion.
rtc_date_t RTCDate; rtc_time_t RTCtime; RTCDate.year = year(); RTCDate.mon = month(); RTCDate.day = day(); M5.RTC.setDate(&RTCDate); RTCtime.hour = hour(); RTCtime.min = minute(); RTCtime.sec = second(); M5.RTC.setTime(&RTCtime); Serial.print("\n Actual RTC date and time =>" + String(RTCDate.day) + "-" + String(RTCDate.mon) + "-" + String(RTCDate.year) + " " + String(RTCtime.hour) + ":" + String(RTCtime.min) + ":" + String(RTCtime.sec) );
30 minutes (1800 secs). So I added these secs into the current time to get the wakeup time in the future.
int nextRereshTimeInSecs = now() + 1800; setTime(nextRereshTimeInSecs);
setAlarmIRQ(const rtc_date_t &date, const rtc_time_t &time)and shut down the M5stack-paper.
rtc_date_t wakeupDate; rtc_time_t wakeupTime; int currentYear = year(); int8_t int8_year = currentYear % 100; int8_t int8_month = month(); int8_t int8_day = day(); // Populate rtc_date_t structure wakeupDate.year = int8_year ; wakeupDate.mon = int8_month ; wakeupDate.day = int8_day; int8_t int8_hour = hour(); int8_t int8_minute = minute(); int8_t int8_second = second(); // Populate rtc_time_t structure wakeupTime.hour = int8_hour; wakeupTime.min = int8_minute; wakeupTime.sec = int8_second; Serial.print("\n Future RTC date and time =>" + String(wakeupDate.day) + "-" + String(wakeupDate.mon) + "-" + String(wakeupDate.year) + " " + String(wakeupTime.hour) + ":" + String(wakeupTime.min) + ":" + String(wakeupTime.sec) ); delay(300); M5.RTC.clearIRQ(); M5.RTC.setAlarmIRQ(wakeupDate, wakeupTime); delay(10); M5.shutdown();
Currently, I am testing it with the sleep duration of 30 minutes and it looks like working. I will test it for more than 4 hours tonight.
The question is that, do I have to use
M5.shutdown( wakeupDate, wakeupTime)
is it OK what I am currently using
I have programmed M5stack-Paper in a way that it connects to the WiFi, read data from Firebase and sleep for provided seconds using "M5.shutdown(Secs)". read documentation here
It is working fine if the sleep duration is less than 4 hours.
If the sleep duration is more than 4 hours then the M5 paper is waking up properly according to the given sleep duration but waking up randomly after 2 - 3 hours .
I also tried "M5.shutdown( const rtc_date_t &RTC_DateStruct, const rtc_time_t &RTC_TimeStruct)" but it didn't work as well.
I have written the code in Arduino and created the binary file.
I have logged in to the M5 burner and tried to upload the user's custom firmware into the M5 burner, but I cannot find the M5 paper in the list of device types (please see the screenshot in the attachment). I want to burn many M5 paper devices so uploading the code one by one from Arduino is very time-consuming.
Can anyone guide me that what I am doing wrong?
Is there any other way to burn/upload Arduino code on M5 paper quickly without uploading the code one by one on M5 paper devices from Arduino?