This was caused by a missing double quotation mark in a file name in an "Execute code" block.....
Best posts made by wsanders
-
RE: UIFlow "Invalid Syntax"?
-
RE: M5STACK STATION PORT CONNECTORS
You want UNbuckled "Grove" connectors to fit all M5Stack devices. For example, the M5StickC-Plus will accept both unbuckled and bucked connectors, but the Core2 will only accept an unbuckled connector. If you have the buckled type, you can always cut the clip off so it will fit.
Generically, these connectors are called "HY2.0-4P" although nearly all vendors sell them as "Grove".
There's no standard for the Vcc and logic levels! So make sure your devices match. M5Stack devices supply 5V on the red conductor, but the logic levels are 3.3V.
-
RE: M5StickC-Plus Buzzer not working
Using //https://101010.fun/iot/m5stickc-plus-firststep.html
for inspiration, we can upload this program:#include <M5StickCPlus.h>
void setup() {
M5.begin();
M5.Lcd.setTextSize(3);
M5.Lcd.setRotation(3);
M5.Lcd.setTextColor(TFT_ORANGE);
}void loop() {
M5.update();
soundTest();
}void soundTest() {
for (int tone=100; tone < 4000; tone=tone+50) {
M5.Lcd.fillScreen(BLACK);
M5.Lcd.setCursor(80, 50);
M5.Lcd.printf("%d", tone);
M5.Beep.tone(tone);
M5.Beep.update();
delay(200);
}
}According to my ears there is a definite peak about 2500 Hz, with frequencies under 250 Hz and over 3000 not audible. Your ears may vary .....
-
UIFlow: How to try/except for "Connect to Wifi"?
I am trying to get the program to ignore failure to connect to WiFi. I tried to place a Wifi Connect block inside a try/except (with a bogus SSID/password):
Instead, the program hangs, before the LED comes on, because the python that gets generated places the wifiCfg.doConnect up at the top of the program (line 20):
and the try/except block is empty, much later in the program at line 87:
Is there a way to create an exception for WiFi failure to connect?
I also notice that UIFlow does not have a "pass" block. I just put a wait() in mine - ???
-
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.
-
-
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 "environment variable" the calls to localtime and gmtime will return the same.
-
RE: UIFlow: How to try/except for "Connect to Wifi"?
@wsanders SOLUTION: Use "Original Network Function" blocks instead.
-
RE: How to use "pushToSprite" in Core2
Isn't the method called pushSprite?
On a M5StickC-Plus, I use:
setup():
TFT_eSprite sgraph = TFT_eSprite(&M5.Lcd);
...
sgraph.createSprite(GRAPHW, GRAPHH);
...loop():
...
sgraph.pushSprite(TEXTW, 0);
.... -
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.
-
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!
Latest posts made by wsanders
-
Has anyone gotten M5.Rtc.setAlarmIRQ to work on ESP32S3? for
Trying to get M5.Rtc.setAlarmIRQ to work. Note: Device is PaperS3, so this function may not be implemented yet.
M5.Rtc.setAlarmIRQ(30); M5.Power.powerOff();
This should reboot the device every 30 sec but doesn't.
M5.Power.timeSleep works, and is coded thus in Power_Class.cpp:
void Power_Class::timerSleep( int seconds ) { M5.Rtc.disableIRQ(); M5.Rtc.setAlarmIRQ(seconds); #if !defined (M5UNIFIED_PC_BUILD) esp_sleep_enable_timer_wakeup(seconds * 1000000ULL); #endif _timerSleep(); }
However, for the PaperS3, M5UNIFIED_PC_BUILD is not defined, so the RTC timer call is not used, and the esp timer is called instead. I'm not sure why, because the PaperS3 has the same RTC chip as all the other M5 devices, and getting and setting the RTC clock seems to work. Yet, when I call M5.Rtc.disableIRQ and M5.Rtc.setAlarmIRQ separately in my code, it doesn't work.
It's also unclear form the ESP documentation is esp_sleep_enable_timer_wakeup even puts the ESP to sleep. You can put the ESP in deep sleep with a wakeup time, but the PaperS3 still drains about 5mA of power, much more than it should if it were completely powered off. (It is a known issue that M5.Power.powerOff doesn't completely power off the PaperS3, but this should not affect the Rtc alarm.)
I hope this is not a bug in the odd PMS150G power chip since that chip cannot be reprogrammed in the PowerS3.
Any ideas?
-
RE: Paper S3 questions
@felmue Your measurement for ESP deep sleep + Imu.sleep is accurate. My device is drawing the battery down about 5-7% per day, which is roughly 5ma.
I tested your patch. Unfortunately it doesn't seem to work once the RTC countdown timer is set. If one uses Power.shutdown, the Rtc timer is bypassed in the code in favor of the ESP timer since M5UNIFIED_PC_BUILD is not defined (why?).
Rtc.setAlarmIRQ does work in it's integer form, if followed by Power.powerOff. I could not get Rtc.setAlarmIRQ to work in its date,time form.
Your patch does turn off the PaperS3 otherwise, but with the ESP completely powered down its timers aren't functional.
So I think we're stuck with ESP deep sleep for now. It would be interesting to see the code for the PMS150G. I'm not sure what all that FET logic around it is for, maybe an AXP192 wouldn't fit on the board. (And why a USB chip that would prevent the device from frying when plugged into a USB PM port wasn't included.)
I tested skipping M5.begin but the PaperS3 would do nothing. Tested with Display.init and it worked, but battery readings were undfined. Tested that with M5.Power.begin and battery readings were still undefined, probably because board_t isn't set.
Something besides the IMU is sucking that power though, the BMI270 should use less than 1ma even when fully awake. The PMS150G uses only a few uA when running, I don't think it ever turns off.
-
RE: Paper S3 questions
@felmue Are you sleeping the IMU with M5.Imu.sleep when you deep sleep the ESP? I think by default the IMU stays awake.
-
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 "environment 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