@felmue Are you sleeping the IMU with M5.Imu.sleep when you deep sleep the ESP? I think by default the IMU stays awake.
Posts made by wsanders
-
RE: Paper S3 questions
-
RE: Paper S3 questions
@felmue Thanks again ....
Sure enough, the device rebooted 4.25 hours after the last reboot this morning. This isn't too bad a limitation for my badge test skeptch, the sketch will set the date anyway, and if it's less than 4.25 hr before midnight it will still reset at midnight.
Digging deeper into setAlarmIRQ, the 255 min limit is not in the rtc_time_t instance; the rtc_time_t instance should be able to handle an alarm up to a week away.
So far, the LED has not illuminated after M5.Power.timerSleep does whatever it does.
You have to be care to actually send M5.Power.deepSleep the right uint64_t, something like:
M5.Power.deepSleep(1000000L * uint64_t(w), false);
ESP deep sleep should be almost as good as a power off, assuming setAlarmIRQ works.
-
RE: Paper S3 questions
I am using M5.Power.timerSleep(int) in a sketch and it sort of works. The sketch displays the date and is supposed to wake up and refresh the date a few sec after midnight.
Sketch here: https://github.com/wsanders/M5PaperS3-Stuff/blob/main/papers3badge.ino
I used the int form of timerSleep since for now it was easier than reverse engineering the rtc_time struct. Utimately, the alarm should be set in the chip with a ?mumble?-bit int with value in ?mumble?-seconds. (*)
There are some problems:
- The device seems to randomly wake up at times.
- Occasionally the Status LED is illuminated continuous orange when the device is supposed to be asleep.
At first I thought I was passing timeSleep a 16-bit Arduino int which was limited to 2^16 sec (not a whole day) but the int in the sketch compiles into a ESP32 int which is 4 bytes.
The source for the _timerSleep private class starts at line 724 in Power_class.cpp FWIW. I haven't dug all the ay down to where it calls the chip, but the BM8563 chip is the RTC in almost all the M5 products and should be OK. (*)
PMS150G data sheet here: https://www.padauk.com.tw/upload/doc/PMS15B,PMS150G datasheet_EN_V008_20230216.pdf
(*) I coded up a wristwatch based on the StickCPlus and after nearly a year the RTC is only off by a few sec. )
-
Solution: Getting decent looking fonts on PaperS3
I'm trying to get decent-looking fonts on the PaperS3. As called by setFont, the fonts are huge and blocky (unaliased). However, If they are subsequently scaled by setTextSize, even wth a scale of 1.0, they are the right size and smooth.
You have to experiment. For example, with Font6 and Font8, punctuation charactersaren't rendered, I am guessing to save space. But Font4 scaled up to 2.0 looks very nice.
I've attached a couple of images that show this effect:
M5.Display.setFont(&fonts::Font4), without scaling:
M5.Display.setFont(&fonts::Font4);
M5.Display.setTextSize(2.0);
Not sure if this is a bug or a feature, but it works!
-
TZ magic in ESP/M5Unified
Mt RTC is set to UTC. Somehow, this magically works:
setenv("TZ","PST8PDT",1); tzset(); auto tm = localtime(&t); M5.Display.printf("ESP32 %04d/%02d/%02d (%s) %02d:%02d:%02d\r\n", tm->tm_year+1900, tm->tm_mon+1, tm->tm_mday, wd[tm->tm_wday], tm->tm_hour, tm->tm_min, tm->tm_sec);
Just posting here in case someone is mystified by the Rtc.ino example, since it doesn't set the TZ "environmen variable" the calls to localtime and gmtime will return the same.
-
RE: PaperS3 with M5United?
@felmue I did not see that error.
The afterimages have gone away. Leaving the screen all black and powered off a few minutes will help clear it, this is common EPD behavior.
-
RE: PaperS3 with M5United?
@felmue That PR did not work, only random lines on screen. The random lines burned an afterimage on the screen. I don't think the screen was permanently damaged; after a few cycles of leaving the screen all-black for several minutes the afterimage seems to be slowly going away.
But you had the right idea: On further investigation I added a "#include <epdiy.h>" and the program works now.
-
PaperS3 with M5United?
Has anyone gotten the PaperS3 peripherals to work with M5United?
My program compiles OK with #include <M5Unified.h> but when I include the call to M5.begin(); at the top of my setup() code, the program crashes and is stuck in a crash/restart loop.
For now, I have a working simple badge program here: https://github.com/wsanders/M5PaperS3-Stuff/tree/main
-
RE: Paper S3 questions
@felmue You are correct. I put some code in my program to blink a filled circle on the display, e.g.
void loop(void) { display.startWrite(); if (color == 0) { display.fillCircle(500,910,20,TFT_WHITE); } else { display.fillCircle(500,910,20,TFT_BLACK); } display.endWrite(); color = (color + 1) % 2; sleep(3); }
If I double click the switch while the device is connected to USB it turns off. This is using the Arduino IDE. If the device is off and I press-and-hold the switch the device does not reboot or power on.
-
RE: Paper S3 questions
[Some corrections - see followup comments.]
I have not started reverse engineering the power states on my PaperS3 yet but as far as I can tell with the Arduino IDE, clicking the button once will power up the device and double clicking will power it off.
Pushing and holding the device will cause it to re-run whatever boot stack is on it, which for a Arduino IDE-installed program in the same as powering it up.The device cannot be turned off when the USB is connected to a power souce.There is no way to control the LEDs so if you need to test if the device is running you can work something up with the screen, sound, and touch.
Being an e-ink device the objective is to leave the device off most of the time, and only wake it to update the screen every once in a while.
The feature I would like to see documented, if it exists, is a way to power the gyro off and on. The product page says, "Low power mode: DC 4.2V / 9.28µA (main power off, gyroscope in low power mode); Standby mode: DC 4.2V / 949.58µA (main power off, gyroscope on)" Which means the battery could last for weeks if you didn't need the gyro.
-
RE: Anybody get drawJpgFile to work with M5 PaperS3?
Now that I think of it, I could not get drawJpgFile to work in a previous project (a fake Nixie watch), and I see from the PaperS3 demo program sample code that the Jpg is stored as a static array.
I got my simple badge display program to work by storing the image as a C array (exported from GIMP) and walking through the pixels, which is how I did it in my previous project. Suprisingly it's not incredibly slow but of course data in this format is incredibly bulky.
This github code is an example of how to convert a file into a statoc C array: https://github.com/notisrac/FileToCArray
In the next few days, maybe I'll figure out if SPIFFS works on the PaperS3 and report back.
-
RE: Anybody get drawJpgFile to work with M5 PaperS3?
This is probably a problem with SPIFFs. If I change the file open to
File file = SPIFFS.open("/NONEXISTENT");
the open still succeeds even though the file doesn't exist.So I have no way to know if drawJpgFile even works or not.
-
Anybody get drawJpgFile to work with M5 PaperS3?
Anybody get drawJpgFile and SPIFFS to work with M5 PaperS3? The following program finds the file "badge.jpg" but the jpeg is not displayed. I have turned jpg optimization and progressive off since that has been a source of problems in the past:
#include <epdiy.h> #include <SPIFFS.h> #include <M5GFX.h> M5GFX display; void setup(void) { display.init(); display.startWrite(); display.fillScreen(TFT_WHITE); display.setTextSize(5.0); if (display.isEPD()) { display.setEpdMode(epd_mode_t::epd_fastest); } // eyelet at top display.setRotation(display.getRotation() ^ 2); display.println("I RUN"); if(!SPIFFS.begin(true)){ display.println("An Error has occurred while mounting SPIFFS"); } display.println("SPIFFS OK"); File file = SPIFFS.open("/badge.jpg"); if(!file){ display.println("Failed to open file"); } file.close(); display.println("Open OK"); display.drawJpgFile(SPIFFS, "/badge.jpg" , 0, 0); display.display(); }
If I cant get drawJpgFile to work, has someone written a script to put the result in a const array such as in the example file at https://github.com/m5stack/M5GFX/blob/2c12f148d6e3df64ead33b04c7989fe6d90a7a83/examples/Basic/drawImageData/drawImageData.ino?
-
RE: [SOLVED] Can't Run Paper S3 With BarGraph Example
I got the bar graph demo to work:
-
Using the latest M5 board package, you should see a board "M5PaperS3", so the requirement to downgrade the esp32 board package to 3.0.6 is not necessary. Use the "M5PaperS3" board definition instead of the generic ESP32S3 one.
-
The instructions to install epdiy are somewhat vague. Simply clone the epdiy library to your arduino library directory and it will work, doing a "make" is not necessary.
-
Follow the rest of the instructions at https://docs.m5stack.com/en/arduino/m5papers3/program, pay careful attention to the special board settings for OPI PSRAM, etc.
-
-
[SOLVED] Can't Run Paper S3 With BarGraph Example
Trying to follow instructions in https://docs.m5stack.com/en/arduino/m5papers3/program
Rather than install a generic ESP32 board manager I now see there is a specific M5PaperS3 board defined, so I used that.
I cannot put the M5PaperS3 into download mode for more than a few seconds, the LED blinks 9 times then the unit turns itself off. However, BarGraph.ino successfully compiles and uploads to the M5PaperS3, but afterwards the device is bricked. This text is output continuously from the serial port:
My includes have been edited as instructed:
#include <epdiy.h> #include <M5GFX.h>
Upload occurs:
After which the device doesn't turn on and clear the screen on reboot.
I am still using Arduino IDE 1.8.19. Presumably IDE 2.0+ is mandatory?
The eocumentation states, "M5Unified and M5GFX versions must be greater than 0.2.2" but the latest version of M5Unified is 0.2.2.
Also - is UIFlow support proposed for this device? I have never been able to get UIFlow to work over a serial port, and the device did not come with a BIOS/key for OTA installs.
-
RE: Has anyone gotten MP3 streaming to work on Core2?
I got the sketches to work, They will be posted to the above repo shortly. The key changes from some of the existing code out there that does not work anymore:
After WiFi connects, the delay must be increased to at least 1 sec:
while ( !WiFi.isConnected() ) delay(100); delay(1000);
Preallocating the source buffer seems to be essential:
const int preallocateBufferSize = 128*1024; const int preallocateCodecSize = 85332; // AAC+SBR codec max mem needed void *preallocateBuffer = NULL; void *preallocateCodec = NULL; ... // Don't forget to malloc the buffers preallocateBuffer = malloc(preallocateBufferSize); preallocateCodec = malloc(preallocateCodecSize); ... srcbuf = new AudioFileSourceBuffer(file, preallocateBuffer, preallocateBufferSize); ... // Preallocating the MP3 generator doesn't seem to be essential //gen = new AudioGeneratorMP3(preallocateCodec, preallocateCodecSize);
You must call M5.begin with the 6th argument false to disable the M5.Speaker code. With this argument, the skeptch will produce audio, but at half speed and half pitch:
M5.begin(true, false, true, true, kMBusModeOutput, false);
My M5Core2 library version is 0.1.9. I have 2.0.9 of the M5 board. definitions.
-
Has anyone gotten MP3 streaming to work on Core2?
I'm about ready to give up after three days of trial and error. Has anyone gotten MP3 streaming to work on Core2?
Yesterday, I was able to stream a low-bandwidth station but today even that doesn't work. I posted some examples of what I have tried, in https://github.com/wsanders/M5Core2-Audio-Is-Broken. The sketch WSWebRadio-broken.ino was working yesterday for a low-bandwith (32k) stream, but produced broken distorted audio from a 192k stream. Today none of the programs in my repo produce any audio.
I haven't seen any posts about working MP3 streaming sketches less than a couple years old, which seems to hint that it just doesn't work. Maybe everyone has switched to MicroPython?
I am using Arduino IDE, M5Core2 library 0.1.9, ESP8266Audio 1.9.7.
-
RE: Which is more current, M5Unified of M5Core2?
@teastain I posted an issue in the library repo, perhaps the ambiguous comment will be clarified. M5Core2 was updated last Jan 29, latest update to M5Unified was 3 days ago.