m5stack / m5unified Goto Github PK
View Code? Open in Web Editor NEWUnified library for M5Stack series
License: MIT License
Unified library for M5Stack series
License: MIT License
Dear M5Stack team.
we have selected M5Stack technology with nanoFramework as strategy technology for our smart devices.
We have started developing and we have found the first critical point. We need to use the ATOM QR-CODE Kit on the nanoFramework image, but the only place that I have found until now to read QR code is downloading and burd directly with your tool, but that is not the solution.
I need a wrapper solution in C# language to access the QR reader information.
Could you help me?
Thanks it is so important at that moment take the right decision.
Arduino1.0.5(ESP-IDF3.3)から追加されたファイルのため、1.0.4(ESP-IDF3.2)ベースのM5Stack1.0.9には存在していません
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 0, 0)
の部分がM5Stack1.0.9でエラーになります。
C:\Users\tanaka\Documents\Arduino\libraries\M5Unified-0.0.1\src\M5Unified.cpp:14:43: error: missing binary operator before token "("
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 0, 0)
^
ESP_IDF_VERSIONが未定義の場合はESP-IDF3.2未満と判定する必要があります。
Unlike M5Core2 where the touch surface is bigger than the display, the CoreS3 touch surface is limited to the inner display area.
There are many valid reasons why touch buttons emulation is not activated with CoreS3, but in some projects there is is also a need for a transparent solution.
This snippet enables BtnA, BtnB and BtnC on CoreS3 using modified logic from M5Core2 buttons emulation, without breaking the Unified
in M5Unified.
// 1) optionnally draw three buttons at the bottom of the screen (20px max)
// 2) use `M5Update()` instead of `M5.update()`
void M5Update()
{
if( M5.getBoard()==lgfx::boards::board_M5StackCoreS3 && M5.Touch.isEnabled() ) {
// M5Unified doesn't handle Touch->M5.BtnX translation for CoreS3, give it a little help
uint8_t edge = 220; // spoil 20px out from the touch zone
auto ms = m5gfx::millis();
M5.Touch.update(ms);
uint_fast8_t btn_bits = 0;
int i = M5.Touch.getCount();
if( i>0 ) {
while (--i >= 0) {
auto raw = M5.Touch.getTouchPointRaw(i);
if (raw.y > edge) {
auto det = M5.Touch.getDetail(i);
if (det.state & m5::touch_state_t::touch) {
if (M5.BtnA.isPressed()) { btn_bits |= 1 << 0; }
if (M5.BtnB.isPressed()) { btn_bits |= 1 << 1; }
if (M5.BtnC.isPressed()) { btn_bits |= 1 << 2; }
if (btn_bits || !(det.state & m5::touch_state_t::mask_moving)) {
btn_bits |= 1 << ((raw.x - 2) / 107);
}
}
}
}
}
M5.BtnA.setRawState(ms, btn_bits & 1);
M5.BtnB.setRawState(ms, btn_bits & 2);
M5.BtnC.setRawState(ms, btn_bits & 4);
} else { // trust M5Unified
M5.update();
}
}
The Gesture code, and other touch code is missing from Unified for M5Tough.
The M5Tough is crashing with the following panic during the Arduino setup() function:
I (0) cpu_start: Starting scheduler on APP CPU.
Guru Meditation Error: Core 1 panic'ed (InstrFetchProhibited). Exception was unhandled.
Core 1 register dump:
PC : 0x00000040 PS : 0x00060030 A0 : 0x800d5fa5 A1 : 0x3ffb9eb0
A2 : 0x3ffb2cf4 A3 : 0x00000040 A4 : 0x000000a4 A5 : 0x00000000
A6 : 0x00010101 A7 : 0x00060823 A8 : 0x800d6aa7 A9 : 0x3ffb9ea0
A10 : 0x3ffb2cf4 A11 : 0x00000000 A12 : 0x00000000 A13 : 0x3ffb32da
A14 : 0x00000000 A15 : 0x01000101 SAR : 0x00000000 EXCCAUSE: 0x00000014
EXCVADDR: 0x00000040 LBEG : 0x4000c2e0 LEND : 0x4000c2f6 LCOUNT : 0xffffffff
Backtrace:0x0000003d:0x3ffb9eb00x400d5fa2:0x3ffb9f50 0x400894e5:0x3ffb9f70
0x400d5fa2: loopTask(void*) at /home/max/projects/hardware/esp32-temp/tough/build/../components/arduino-esp32/cores/esp32/main.cpp:42
0x400894e5: vPortTaskWrapper at /home/max/esp/esp-idf-v4.4/components/freertos/port/xtensa/port.c:131
I'm trying to run the HowToStart
example.
I was able to draw to the LCD using the M5Tough library.
M5Unified: Latest as of today
ESP-IDF: 4.4
arduino-esp32: Latest as of today (master branch)
Hi, if I use the sprite class, I get this error:
C:\Users\ftens\Sviluppo SW\Arduino\M5Stack-core2_display\Sprite_drawPixel\Sprite_drawPixel.ino:39:1: error: 'TFT_eSprite' does not name a type
TFT_eSprite spr = TFT_eSprite(&M5.Lcd);
If I use the M5Core.h library it works..
I was surprised that the channel default volume is 64. In audio designs, usually channel volume is attenuation only. So I'd expect the default to be the maximum (255).
Otherwise, the master volume doesn't really mean the "maximum volume", and some channels may have a volume equivalent to a master volume of 1024...
M5Unified/src/utility/Speaker_Class.hpp
Line 234 in 42717f0
Naively, I thought that repeated calls to Speaker.playRaw()
on the same channel with stop_current_sound=false
would connect exactly, without a gap. But I tried it and there seems to be clicking artifacts due to a gap.
We could use it to simply stream from an audio file or real-time generated waveform.
Since Speaker has multiple channels and various functionality, it would be nice to combine streaming on one channel with one-shot sounds on other channels under a single API.
Do I understand it correctly? 🙏 @lovyan03
Hi there, I would like to create a simple tone at a specific frequency from the Core2 speaker. I saw M5 stack API has this:
M5.Speaker.begin(); //Initialize the speaker
M5.Speaker.tone(661, 1000); //Set the speaker to tone at 661Hz for 1000ms
But it is not in M5Unified as far as I can tell. Or do I need to do a full I2S implementation like in this example
https://github.com/m5stack/M5-ProductExampleCodes/blob/master/Core/M5Core2/Arduino/speak/speak.ino
Thanks for your help!
Hi,
I try to ring the speaker of M5Stack CoreS3 on an esp-idf project with M5Unified component , I have no compilation errors but the speaker remains mute , in the arduino framework speaker works fine .
conditions:
1.use M5Unified lib;
2.use platfrom io IDE;
3.use Arduino Framwork base Espressif 32 Verision 4.2.0 lasted.
Hi. Thank you very much for releasing such a useful library. 🙇
I have been trying to migrate from the M5Stack library to the M5Unified library and found a problem regarding SmartConfig. The following example works fine when M5Stack.h
is selected. However, I can't configure Wi-Fi when M5Unified.h
is selected. I confirmed with an M5Stack FIRE.
#include <WiFi.h>
#if 1
#include <M5Unified.h>
#else
#include <M5Stack.h>
#endif
void setup(void) {
M5.begin();
WiFi.mode(WIFI_AP_STA);
WiFi.beginSmartConfig();
M5.Lcd.println("Waiting for SmartConfig");
while (!WiFi.smartConfigDone()) {
delay(500);
M5.Lcd.print(".");
}
M5.Lcd.println();
M5.Lcd.println("Waiting for Wi-Fi");
while (WiFi.status() != WL_CONNECTED) {
delay(500);
M5.Lcd.print(".");
}
M5.Lcd.println();
M5.Lcd.print("IP Address: ");
M5.Lcd.println(WiFi.localIP());
}
void loop(void) {
vTaskDelay(1);
M5.update();
}
I'm sorry if this is a false alarm, but I want to report to make sure. Thank you very much.
How can we get our own custom callbacks for buttons as we issued to have with Core2?
` int16_t xx=elem["xx"].as<int16_t>();
int16_t yy=elem["yy"].as<int16_t>();
int16_t ww=elem["ww"].as<int16_t>();
int16_t hh=elem["hh"].as<int16_t>();
int16_t id=elem["id"].as<int16_t>();
if(elem["manualOpen"].as<bool>()==true){
bAcceso = new Button(xx, yy, ww, hh, false, text, onCol, offCol);
bAcceso->addHandler(eventDisplay, E_RELEASE);
}else{
bAcceso = new Button(xx, yy, ww, hh, false, text, onColD, onColD);
}
bAcceso->userData=elem["id"].as<int16_t>();`
m5stack/M5Unified/src/M5Unified.cpp:583:20: error: invalid conversion from 'int' to 'i2c_port_t' [-fpermissive]
583 | In_I2C.setPort(-1, -1, -1);
| ^~
| |
| int
possible fix: bhuvanchandra@8e4c4af
M5Stack BASIC/GRAY GO/FIRE |
M5Stack Core2/Tough |
M5Stick C/Cplus |
M5Stack CoreInk |
M5Paper | M5Station | M5ATOM Lite/Matrix ECHO/U PSRAM |
M5STAMP PICO |
M5Stamp C3/C3U |
M5Stack CoreS3 |
M5ATOMS3 / S3Lite |
|
---|---|---|---|---|---|---|---|---|---|---|---|
PORT.A I2C_SDA |
21 | 32 | 32 | 32 | 25 | 32 | 26 | 32 | 1 | 2 | 2 |
PORT.A I2C_SCL |
22 | 33 | 33 | 33 | 32 | 33 | 32 | 33 | 0 | 1 | 1 |
I2C1_SDA | 21 | 21 | 21 | 21 | 21 | 22 | 12 | 38 | |||
I2C1_SCL | 22 | 22 | 22 | 22 | 22 | 25 | 11 | 39 |
| | M5Stack<BR>BASIC/GRAY<BR>GO/FIRE | M5Stack<BR>Core2/Tough | M5Stick<BR>C/Cplus | M5Stack<BR>CoreInk | M5Paper | M5Station | M5ATOM<BR>Lite/Matrix<BR>ECHO/U<BR>PSRAM | M5STAMP<BR>PICO | M5Stamp<BR>C3/C3U | M5Stack<BR>CoreS3 | M5ATOMS3 <BR>/ S3Lite |
|-------------------------|:--------------------------------:|:----------------------:|:------------------:|:------------------:|:-------:|:---------:|:----------------------------------------:|:---------------:|:-----------------:|:-----------------:|:---------------------:|
| `PORT.A`<BR>**I2C_SDA** | 21 | 32 | 32 | 32 | 25 | 32 | 26 | 32 | 1 | 2 | 2 |
| `PORT.A`<BR>**I2C_SCL** | 22 | 33 | 33 | 33 | 32 | 33 | 32 | 33 | 0 | 1 | 1 |
| **I2C1_SDA** | | 21 | 21 | 21 | 21 | 21 | 22 | | | 12 | 38 |
| **I2C1_SCL** | | 22 | 22 | 22 | 22 | 22 | 25 | | | 11 | 39 |
スケッチのUpload中に以下のようなエラーが発生します
c:\Users\■■■■\Documents\Arduino\libraries\M5Unified\src\utility\Power_Class.cpp: In member function 'void m5::Power_Class::_powerOff(bool)':
c:\Users\■■■■\Documents\Arduino\libraries\M5Unified\src\utility\Power_Class.cpp:588:21: error: 'esp_sleep_enable_ext0_wakeup' was not declared in this scope
if (ESP_OK != esp_sleep_enable_ext0_wakeup( pin, false))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
c:\Users\■■■■\Documents\Arduino\libraries\M5Unified\src\utility\Power_Class.cpp:588:21: note: suggested alternative: 'esp_sleep_enable_wifi_wakeup'
if (ESP_OK != esp_sleep_enable_ext0_wakeup( pin, false))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
esp_sleep_enable_wifi_wakeup
Using library M5Unified at version 0.1.9 in folder: C:\Users\■■■■\Documents\Arduino\libraries\M5Unified
Using library M5GFX at version 0.1.9 in folder: C:\Users\■■■■\Documents\Arduino\libraries\M5GFX
exit status 1
Compilation error: exit status 1
使用デバイスは
M5Stamp C3
でIDEは ArduinoIDE 2.2.1
です
Hi there @lovyan03 this looks very promising. Is it ready for people to start using?
I have been using @tobozo's ESP32-Chimera-Core because I want an up to date TFT_eSPI library for use with M5 Stack Core2. However the 3 touch buttons at the bottom of the LCD were not working properly (.pressedFor(1000) specifically) and tobozo told me about M5Unified.
I tried this library today and found the following issues:
M5.Axp.SetLed(0);
to turn the LED off.Wire.begin(32, 33);
. I then tried M5.Ex_I2C.begin(I2C_NUM_1, 32, 33);
but this also doesn't seem to work.I'd appreciate your thoughts / ideas on these issues, thank you.
C:\Users\tanaka\Documents\Arduino\libraries\M5Unified-0.0.1\src\M5Unified.cpp: In member function 'void m5::M5Unified::begin()':
C:\Users\tanaka\Documents\Arduino\libraries\M5Unified-0.0.1\src\M5Unified.cpp:162:25: error: 'adc_power_acquire' was not declared in this scope
adc_power_acquire(); /// for GPIO 36,39 Chattering prevention.
^
上記のコンパイルエラーが出ました
IMU_Class::getTemp()
is defined in IMU_Class.hpp
, but not implemented in IMU_Class.cpp
which leads to a link error when attempting to leverage the function.
Here is a possible implementation for IMU_Class.cpp
:
bool IMU_Class::getTemp(float *t) {
bool res = false;
switch (_imu) {
case imu_t::imu_sh200q:
res = Sh200q.getTemp(t);
break;
case imu_t::imu_mpu6050:
case imu_t::imu_mpu9250:
case imu_t::imu_mpu6886:
res = Mpu6886.getTemp(t);
break;
case imu_t::imu_unknown:
default:
break;
}
return res;
}
I hope this helps!
PS: Working on an ESPHome wrapper for m5unified.
Hi, I tried the library with two samples and and when I run the programs in a Core2 with a GoPlus2 attached, the servo connected to SERVO1 out start to run.
The examples I tried are the bluetooth speaker and the "HowToUse.ino" demo.
The description says this supports ESP-IDF framework, but I don't see any example or guide to setup in that framework.
BTW I see that https://github.com/m5stack/M5Stack-IDF was archived, so is this supposed to be the new home?
Hello, I'm try to test audio on M5StickC Plus with SPK HAT, using [WebRadio_with_ESP8266Audio.ino] example.
How can I avoid the white noise ? or is it expected from design ?
Hi there, thanks for your great library. My question is related to PR #20
I cannot get the basic RTC.ino example to compile when I uncomment these lines to sync Core2 RTC with NTP
M5Unified/examples/Basic/Rtc/Rtc.ino
Lines 42 to 66 in 42717f0
It is failing on line 55. I'm unsure how this can compile when it is an IDF framework function, not an Arduino framework function?
while (sntp_get_sync_status() != SNTP_SYNC_STATUS_COMPLETED)
I acknowledge this is not a M5 Unified issue, but any help would be appreciated because I get inconsistent results using a 1sec delay after calling sync with NTP. Sometimes it works, other times it syncs to an incorrect time.
Thankyou.
I'm having an issue, the M5core2 is the near perfect ready made system for my application. I have tried to use just the bare board with no screen/touch sensor or battery connected and I have found that the internal I2c bus seams to not be responding. I see no i2c traffic using a scope after calling M5.begin , subsequent attempts to read the AXP192 all return 0 the, 5v boost will not turn on... Is there a quick easy i can disable using the primary display/touch sensor so i can start to narrow this down? I'm kind of new to using the ESP32, and i see there is some logging built into the code, how can i enable its output so i can see whats happening at startup?
The external I2c Bus still functions and the program itself is not hung up.
Thank You!
Hi there,
I have been developing on M5 Stack Core2 with this library for a couple of weeks now and all has been good! Yesterday I noticed that I was still on v0.0.1 so I upgraded to v0.0.3, however now the Core2 crashes during setup(). I have narrowed this down to the createSprite() call. I have tried to debug this but I quickly get lost in the M5GFX code.
Here is a shortened version of my code:
#include <M5Unified.h>
... many other includes
#define batt_spr_wdth 190 // Battery sprite width
#define batt_spr_ht 20 // Battery sprite height
M5Canvas batt_sprite(&M5.Lcd); // Sprite for battery icon and percentage text
void setup(void) {
Serial.begin(115200);
M5.begin();
M5.Power.setExtPower(true); // Enable 5V output on external port
// Create battery icon sprite
batt_sprite.createSprite(batt_spr_wdth, batt_spr_ht); // <== crashes here :(
while (true); // prevent subsequent setup code from being compiled
... other code
}
and here is the ESP32 exception decoder output (just core 1 output). If I'm reading this correctly, the problem seems to be related to a palette colour type, as per decoder lines 6 and 5.
Rebooting...
ets Jul 29 2019 12:21:46
rst:0xc (SW_CPU_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0018,len:4
load:0x3fff001c,len:1044
load:0x40078000,len:10124
load:0x40080400,len:5828
entry 0x400806a8
Guru Meditation Error: Core 1 panic'ed (Interrupt wdt timeout on CPU1)
Core 1 register dump:
PC : 0x40091c75 PS : 0x00060f34 A0 : 0x80093cae A1 : 0x3ffb1e80
A2 : 0x37735220 A3 : 0x0000abab A4 : 0xb33fffff A5 : 0x00000001
A6 : 0x00060320 A7 : 0x0000cdcd A8 : 0x400fad7c A9 : 0x3ffb1f70
A10 : 0x3f429568 A11 : 0x00000069 A12 : 0x3f42989c A13 : 0x3f4295f4
A14 : 0x00000003 A15 : 0x00060a23 SAR : 0x0000000a EXCCAUSE: 0x00000006
EXCVADDR: 0x00000000 LBEG : 0x400dbf68 LEND : 0x400dbf72 LCOUNT : 0x00000000
ELF file SHA256: 0000000000000000
Backtrace: 0x40091c75:0x3ffb1e80 0x40093cab:0x3ffb1eb0 0x400942e5:0x3ffb1ed0 0x4008203d:0x3ffb1ef0 0x400d724b:0x3ffb1f10 0x400d6a39:0x3ffb1f30 0x400d1f39:0x3ffb1f50 0x400d3a35:0x3ffb1f70 0x400e1322:0x3ffb1fb0 0x40090c42:0x3ffb1fd0
#0 0x40091c75:0x3ffb1e80 in vPortCPUAcquireMutexIntsDisabledInternal at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/tasks.c:3507
(inlined by) vPortCPUAcquireMutexIntsDisabled at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/portmux_impl.h:98
(inlined by) vTaskEnterCritical at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/tasks.c:4201
#1 0x40093cab:0x3ffb1eb0 in multi_heap_internal_lock at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/heap/multi_heap.c:380
#2 0x400942e5:0x3ffb1ed0 in multi_heap_malloc at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/heap/multi_heap_poisoning.c:321
#3 0x4008203d:0x3ffb1ef0 in heap_caps_malloc at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/heap/heap_caps.c:232
#4 0x400d724b:0x3ffb1f10 in lgfx::v1::SpriteBuffer::reset(unsigned int, lgfx::v1::AllocationSource) at .pio/libdeps/Core2_SCD30/M5GFX/src/lgfx/v1/misc/SpriteBuffer.cpp:106
(inlined by) lgfx::v1::SpriteBuffer::reset(unsigned int, lgfx::v1::AllocationSource) at .pio/libdeps/Core2_SCD30/M5GFX/src/lgfx/v1/misc/SpriteBuffer.cpp:131
#5 0x400d6a39:0x3ffb1f30 in lgfx::v1::Panel_Sprite::createSprite(int, int, lgfx::v1::color_conv_t*, bool) at .pio/libdeps/Core2_SCD30/M5GFX/src/lgfx/v1/misc/colortype.hpp:585
#6 0x400d1f39:0x3ffb1f50 in lgfx::v1::LGFX_Sprite::createSprite(int, int) at .pio/libdeps/Core2_SCD30/M5GFX/src/lgfx/v1/misc/colortype.hpp:827
#7 0x400d3a35:0x3ffb1f70 in setup() at src/main.cpp:182
#8 0x400e1322:0x3ffb1fb0 in loopTask(void*) at /Users/patrickfelstead/.platformio/packages/framework-arduinoespressif32/cores/esp32/main.cpp:18
#9 0x40090c42:0x3ffb1fd0 in vPortTaskWrapper at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/port.c:355 (discriminator 1)
I haven't tried the devlop branch to see if this fixes the problem yet. Please let me know if I've done something wrong, or what I can try to fix this. Thanks.
Hi there
When changing from the Core2 Library to the M5Unified library, since it allows to create sin-waves via speaker, the SD-Card isn't recognized, probably by <SPIFFS.h> or <SD.h>.
#include <M5Unified.h>
#include <SPIFFS.h>
#include <SD.h>
I thought it might be a problem with the format of the SD-Card being on FAT32, but changing it to NTFS didn't solve the problem.
Monitoring Error Code: [ 10910][E][vfs_api.cpp:24] open(): File system is not mounted
isHoldingは前回と今回の両方がホールドである必要がある。
wasHoldは今回がホールドであるとtrueになるので結果がずれる。
意図している or 仕様であれば問題ありません
bool isHolding(void) const { return _oldPress == 2 && _press == 2; }
/// Returns true when the button has been held pressed for a while.
bool wasHold(void) const { return _currentState == state_hold; }
#include <M5Unified.h>
void setup(void) {
M5.begin();
}
void loop(void) {
String printStr = "";
static String oldStr = "";
delay(1);
M5.update();
printStr += String(",isPressed:") + String(M5.BtnA.isPressed() ? "X" : " ");
printStr += String(",isHolding:") + String(M5.BtnA.isHolding() ? "X" : " ");
printStr += String(",isReleased:") + String(M5.BtnA.isReleased() ? "X" : " ");
printStr += String(",wasPressed:") + String(M5.BtnA.wasPressed() ? "X" : " ");
printStr += String(",wasHold:") + String(M5.BtnA.wasHold() ? "X" : " ");
printStr += String(",wasReleased:") + String(M5.BtnA.wasReleased() ? "X" : " ");
printStr += String(",wasClicked:") + String(M5.BtnA.wasClicked() ? "X" : " ");
printStr += String(",wasSingleClicked:") + String(M5.BtnA.wasSingleClicked() ? "X" : " ");
printStr += String(",wasDoubleClicked:") + String(M5.BtnA.wasDoubleClicked() ? "X" : " ");
printStr += String(",wasDecideClickCount:") + String(M5.BtnA.wasDecideClickCount() ? "X" : " ");
printStr += String(",wasChangePressed:") + String(M5.BtnA.wasChangePressed() ? "X" : " ");
printStr += String(",wasReleasedAfterHold:") + String(M5.BtnA.wasReleasedAfterHold() ? "X" : " ");
printStr += String(",getClickCount:") + String(M5.BtnA.getClickCount());
if (oldStr != printStr) {
Serial.println(printStr);
oldStr = printStr;
}
}
,isPressed:X,isHolding: ,isReleased: ,wasPressed:X,wasHold: ,wasReleased: ,wasClicked: ,wasSingleClicked: ,wasDoubleClicked: ,wasDecideClickCount: ,wasChangePressed:X,wasReleasedAfterHold: ,getClickCount:0
,isPressed:X,isHolding: ,isReleased: ,wasPressed: ,wasHold: ,wasReleased: ,wasClicked: ,wasSingleClicked: ,wasDoubleClicked: ,wasDecideClickCount: ,wasChangePressed: ,wasReleasedAfterHold: ,getClickCount:0
,isPressed:X,isHolding: ,isReleased: ,wasPressed: ,wasHold:X,wasReleased: ,wasClicked: ,wasSingleClicked: ,wasDoubleClicked: ,wasDecideClickCount: ,wasChangePressed: ,wasReleasedAfterHold: ,getClickCount:0
,isPressed:X,isHolding:X,isReleased: ,wasPressed: ,wasHold: ,wasReleased: ,wasClicked: ,wasSingleClicked: ,wasDoubleClicked: ,wasDecideClickCount: ,wasChangePressed: ,wasReleasedAfterHold: ,getClickCount:0
,isPressed: ,isHolding: ,isReleased:X,wasPressed: ,wasHold: ,wasReleased:X,wasClicked: ,wasSingleClicked: ,wasDoubleClicked: ,wasDecideClickCount: ,wasChangePressed:X,wasReleasedAfterHold:X,getClickCount:0
,isPressed: ,isHolding: ,isReleased:X,wasPressed: ,wasHold: ,wasReleased: ,wasClicked: ,wasSingleClicked: ,wasDoubleClicked: ,wasDecideClickCount: ,wasChangePressed: ,wasReleasedAfterHold: ,getClickCount:0
Hi, I recently modified a Mini Proto Unit to read two analog sensors (2 FSR) with GPIO 26 and 36 at Port B. It works perfectly with M5Stack.h, both sensors read 0 to 4095 responsively. However, when I kept the same code but changed to M5Unified.h, one of them (GPIO 26) stop working correctly. Is there a work around to this? Many thanks!
I use a M5Stack Fire.
Using the M5Unified library and the Displays.ino example, I've been able to easily get my Unit Mini OLED display to work with an M5 Atom Lite and an M5 Atom S3. But when I try the same display and the same code with my M5Stamp-Pico, the screen is blank.
I've been able to get several other i2c devices to work with my M5Stamp-Pico, so I know the header is soldered properly. Is there a special incantation I need to perform to get this display to work with the stamp?
(I've also tried this sample code but that also doesn't work.)
Hi there
When starting the implementation of the SD-Card with SD.begin(GPIO_NUM_4, SPI, 25000000)
, the DAC Output of G25 and G26
aren't giving any signals out.
I tested it with an Oscilloscope which is able to detect Frequency's.
The DAC Output normally works when the SD-Card isn't implemented, so it seems that GPIO_NUM_4 interferes with DAC in some way.
Is there a way to set the GPIO_NUM_4 back to it's origin settings after the Data has been downloaded and loaded from the SD-Card, or is there another solution to it?
The settings of Speaker_Class Config is:
struct speaker_config_t
{
/// i2s_data_out (for spk)
int pin_data_out = I2S_PIN_NO_CHANGE;
/// i2s_bck
int pin_bck = I2S_PIN_NO_CHANGE;
/// i2s_ws (lrck)
int pin_ws = I2S_PIN_NO_CHANGE;
/// output sampling rate (Hz)
uint32_t sample_rate = 254000;
/// use stereo output
bool stereo = false;
/// use single gpio buzzer, ( need only pin_data_out )
bool buzzer = false;
/// use DAC speaker, ( need only pin_data_out ) ( only GPIO_NUM_25 or GPIO_NUM_26 )
bool use_dac = true;
/// Zero level reference value when using DAC ( 0=Dynamic change )
uint8_t dac_zero_level = 0;
/// multiplier for output value
uint8_t magnification = 128;
/// for I2S dma_buf_len
size_t dma_buf_len = 128;
/// for I2S dma_buf_count
size_t dma_buf_count = 8;
/// background task priority
UBaseType_t task_priority = 2;
/// background task pinned core
BaseType_t task_pinned_core = -1;
/// I2S port
i2s_port_t i2s_port = i2s_port_t::I2S_NUM_0;
};
M5StickC(or他のボード)とATOM MatrixをUSBポートを手前にして、画面orマトリクスを上にした状態で動かした場合にIMUの数値がATOM Matrixのみ違う
おそらくセンサーの向きが違うので、できれば同じ方向に揃えてほしい
M5STAMPS3
M5Dial
M5DinMeter
M5Capsule
M5Cardputer
上記がないようです
PR出したほうがよければPRだします!
M5.Touch get wrong X and Y values more you go away from display center. The same problem there is with M5Core2.
How to fix it? With this type of issue the display touch is compliteli useless. X and Y are not centered with the touch point.
M5.Rtc.getDateTime() returns wrong week of day since January. I compiled Rtc.ino from the examples on Core2 with M5Unified 0.12 on PlatformIO, and it returns Thursday on Feb 5th (which is Sunday actually). localtime() or gmtime() works without problems, so it looks like only RTC is returning a strange value.
I found the similar report on Twitter as well.
https://twitter.com/hhajime0101/status/1612371508843941889
いつも使いやすいライブラリ提供ありがとうございます。
lovyangfxとaquestalkを組み合わせてm5stackcore2のコード書いてましたが、タッチ操作も追加したくなり、ちょうどm5の機能が統合されたm5unifiedが使えそうなので試しました。
setup内での再生はうまくいくのですが、loop内で非同期再生しようとaquesTTSを修正して試しましたが、うまく行きません。
音は出ますが細切れの超スロー再生のような感じになってしまいます。
非同期バージョンのexampleがあると嬉しいです。
Apologies for all the issues. What's the preferred way to create a sprite object? Before setup() declare:
M5Canvas BattSprite;
or
M5Canvas BattSprite(&M5.Lcd);
or even
LGFX_Sprite BattSprite;
They all seem to work. Obviously then in setup():
BattSprite.createSprite(batt_spr_wdth, batt_spr_ht);
etc
Thank you.
Hello,
first of all cudos to the developer(s) of M5Unified - excellent work!
After modifing <m5stack path>/src/utility/In_eSPI_Setup.h, At the end of the file add "#define USE_M5_FONT_CREATOR"
, as per README.md, the sketch "Examples -> M5Stack -> Advanced -> Display -> Display_Unicode"
runs without any problems on Core1 (V2.7) and Core2.
If I'm now "porting" this example to M5Unified by
// #include <M5Stack.h>
#include <M5Unified.h>
...
void setup() {
// M5.begin(); // Init M5Stack. 初始化M5Stack
auto cfg = M5.config();
M5.begin(cfg);
I got the following compilation error:
In file included from C:\ <...> \Display_Unicode\Display_Unicode.ino:20:
C:\ <...> \Display_Unicode\CUF_24px.h:64274:7: error: 'EncodeRange' does not name a type
const EncodeRange unicode_24pxEncodeRange[] PROGMEM = {
^~~~~~~~~~~
C:\ <...> \Display_Unicode\CUF_24px.h:66327:32: error: 'EncodeRange' was not declared in this scope
(EncodeRange *)unicode_24pxEncodeRange};
^~~~~~~~~~~
C:\ <...> \Display_Unicode\CUF_24px.h:66327:32: note: suggested alternative:
In file included from c:\ <...> \Documents\Arduino\libraries\M5GFX\src/lgfx/v1/LGFXBase.hpp:32,
from c:\<...> \Documents\Arduino\libraries\M5GFX\src/M5GFX.h:21,
from c:\<...> \Documents\Arduino\libraries\M5Unified\src/M5Unified.hpp:19,
from c:\<...> \Documents\Arduino\libraries\M5Unified\src/M5Unified.h:5,
from C:\ <...> \Display_Unicode\Display_Unicode.ino:18:
c:\<...> \Arduino\libraries\M5GFX\src/lgfx/v1/lgfx_fonts.hpp:126:10: note: 'lgfx::v1::EncodeRange'
struct EncodeRange {
^~~~~~~~~~~
In file included from C:\ <...> \Display_Unicode\Display_Unicode.ino:20:
C:\ <...> \Display_Unicode\CUF_24px.h:66327:45: error: expected primary-expression before ')' token
(EncodeRange *)unicode_24pxEncodeRange};
^
C:\ <...> \Display_Unicode\CUF_24px.h:66327:46: error: expected '}' before 'unicode_24pxEncodeRange'
(EncodeRange *)unicode_24pxEncodeRange};
^~~~~~~~~~~~~~~~~~~~~~~
C:\ <...> \Display_Unicode\CUF_24px.h:66321:30: note: to match this '{'
const GFXfont unicode_24px = {(uint8_t *)unicode_24pxBitmaps,
^
C:\ <...> \Display_Unicode\CUF_24px.h:66327:46: error: could not convert '{((uint8_t*)((const uint8_t*)(& unicode_24pxBitmaps))), ((GFXglyph*)((const GFXglyph*)(& unicode_24pxGlyphs))), 32, 65439, 25, 4090, <expression error>}' from '<brace-enclosed initializer list>' to 'const GFXfont' {aka 'const lgfx::v1::GFXfont'}
(EncodeRange *)unicode_24pxEncodeRange};
^~~~~~~~~~~~~~~~~~~~~~~
C:\ <...> \Display_Unicode\CUF_24px.h:66327:69: error: expected declaration before '}' token
(EncodeRange *)unicode_24pxEncodeRange};
^
exit status 1
Compilation error: 'EncodeRange' does not name a type
Which is the same also on a Core2.
As an Austrian, I depend on Unicode (äöüßÄÖÜ°)
Thank you,
Marcus
P.S.: I am looking forward to when M5.getPin()
will be available.
Hi Lovyan. I am curious. I seem to recall that M5Unified included LovyanGFX library, however it now looks like it uses M5GFX, which looks like a branch of LovyanGFX. Can I ask why you did this, doesn't it mean you need to duplicate library maintenance? i.e. you need to make the same changes to LovyanGFX and also M5GFX - or do I misunderstand.
Thanks in advance.
I see ongoing commits relating to CoreS3 support in both https://github.com/m5stack/M5Unified and https://github.com/m5stack/M5CoreS3, and very recent
can you please clarify which repo is intended to be used for CoreS3 development?
is the intent to fold M5CoreS3 into M5Unified eventually or what is the plan here?
thanks
Michael
We have no longer have access to M5 Timers, how this should be handle?
Thanks
How do I turn on the Vibration Motor (PWM:AXP_LDO3)?
Hi there, I'm not sure if this is the correct library to report this, please advise if not.
When BtnA.pressedFor(1000)
is true, I run some code which takes a few seconds to complete, and in this time, I release touch button A, wait for the Wifi to connect, sync RTC to NTP service. On the next loop, this code executes again, i.e. BtnA.pressedFor(1000)
is true a second time, even though I am not touching the button.
I found by inserting an extra M5.update()
the flag is cleared. Can you please advise if this is a bug or not?
void loop(void) {
// Update M5 object
M5.update();
clock_display.update();
if (M5.BtnA.pressedFor(1000)) {
M5.Lcd.clear();
clock_display.pause();
// Connect to WiFi
if (connect_wifi()) {
delay(500);
sync_rtc_to_ntp(true);
WiFi.disconnect(true); // Disconnect wifi
WiFi.mode(WIFI_OFF); // Set the wifi mode to off
}
delay(2000); // Give user time to read the Wifi and NTP success / failure message
init_main_display();
M5.update(); // Needed otherwise another pressed event occurs on next loop
clock_display.resume();
}
// other code ...
}
Hi,
Thank you for your incredible work.
The leds from M5GO2 module seem to don't work (GPIO 25) with M5Stack CORE2 or AWS.
It works like a charm with M5GO module on BASIC (GPIO 15).
Do you confirm ?
Armel.
Hi there, for reasons I won't go into here, I'm trying to initialise the second I2C port as follows:
SDA = GPIO26
SCL = GPIO36
The first thing I do is:
void setup(void) {
auto cfg = M5.config();
cfg.serial_baudrate = 115200; // default=115200. if "Serial" is not needed, set it to 0.
cfg.clear_display = true; // default=true. clear the screen when begin.
cfg.output_power = true; // default=true. use external port 5V output.
cfg.internal_imu = true; // default=true. use internal IMU.
cfg.internal_rtc = true; // default=true. use internal RTC.
cfg.external_imu = false; // default=false. use Unit Accel & Gyro.
cfg.external_rtc = false; // default=false. use Unit RTC.
cfg.led_brightness = 0; // default= 0. Green LED brightness (0=off / 255=max) (※ not NeoPixel)
M5.begin(cfg);
...
and then a short while later, I call
begin_ok = Wire.begin(26, 36);
However my I2C sensor on pins 26, 36 is not being found. I think this should be possibe, but the M5Unified begin code is a little hard for me to follow. It appears to me that you use I2C channel 1 (I2C_NUM_1) pins 21 and 22 for the PMU and internal RTC etc. So I2C channel 0 should be available for me to use given I'm not using external RTC or external IMU.
Is there an easy way for me to configure the unused I2C port with pins 26 and 36?
Thanks in advance!
いつもお世話になっています。
WebRadioのサンプルコードですが
コンパイルすると下記のエラーになります。
ESP8266Audioも他のライブラリ、ボードライブラリもArduinoIDE全て最新にしています。
ESP32 Coreを使っています。(M5Stick-Cも試しましたが同じエラーでした)
In file included from /Users/demo/Documents/Arduino/libraries/ESP8266Audio/src/AudioGeneratorMIDI.cpp:65:
/Users/demo/Documents/Arduino/libraries/ESP8266Audio/src/libtinysoundfont/tsf.h: In function 'void tsf_channel_midi_control(tsf*, int, int, int)':
/Users/demo/Documents/Arduino/libraries/ESP8266Audio/src/libtinysoundfont/tsf.h:2100:1: error: insn does not satisfy its constraints:
}
^
(insn 858 343 344 51 (set (reg:SF 19 f0 [407])
(mem/u/c:SF (symbol_ref/u:SI ("*.LC248") [flags 0x2]) [0 S4 A32])) "/Users/demo/Documents/Arduino/libraries/ESP8266Audio/src/libtinysoundfont/tsf.h":2053 47 {movsf_internal}
(nil))
during RTL pass: postreload
Hi guys
is there any particular reason the backup battery (RTC) charging is disabled by default on M5Core2, M5Tough and M5StickCPlus?
I only noticed this since the backup battery in my M5Tough was flat when the device arrived and the RTC time restarted at 00:00:00 every time I powered M5Tough via USB and it did not improve even after letting it run with USB plugged in. Then looking through the code I noticed this function Axp192.setBACKUP();
but it isn't called from anywhere.
Thanks
Felix
I have this code which worked with the m5core2 library:
void atecc608Init(){
Wire.begin(21, 22);
if (!ECCX08.begin(0x35)) {
Serial.println("ATECC608 secure element failed to start.");
while (1);
}
Serial.print("ATECC608 serial number: ");
Serial.println(ECCX08.serialNumber());
}
Wakes up the ECCX08 chip and prints the serial number. But when I try with the M5 Unified library instead, it fails to start.
Any ideas how to make this work? Or maybe it's not supported with this library?
Hi there,
After some time with the display on, something makes it fade. I am using a repeating cycle of wake from deep sleep, clear display, update display with sensor data, wait for user input for 10 seconds, then go to deep sleep for 60 seconds and repeat. After a few hours the ePaper display fades (sorry I don't know exactly how long, but some time).
No amount of my powering down, or resetting, or clearing the display helps unfortunately.
This photo doesn't show it very well, the humidity 41.8% has not faded much, but the battery "Batt: 100%" has faded quite a lot.
Also if you look closely the background still has some grey which hasn't been cleared properly.
I did some searching, and there is some feature called HV on and HV off for the SPI connection to the ePaper display. This issue is discussed on the M5Stack forum here. Apparently it solves this display fade issue.
I also see the M5Stack library has this HV on and off function for Arduino here and here.
I would like to try using HV on and off using M5Unified but I don't think those functions are currently available. How hard would it be to implement this? I would be happy to test if you need. Maybe I will try using the M5stack library and see if this solves my problem.
Thank you!
Hi and thanks for this awesome project 👍
This line triggers a compilation error when the compiler warnings are at the maximum level in Arduino IDE:
M5Unified/src/utility/Power_Class.cpp
Line 527 in 8553791
~/Arduino/libraries/M5Unified/src/utility/Power_Class.cpp: In member function 'bool m5::Power_Class::getUsbOutput()':
~/Arduino/libraries/M5Unified/src/utility/Power_Class.cpp:527:62: error: unused variable 'port0_bitmask' [-Werror=unused-variable]
static constexpr const uint32_t port0_bitmask = 0b00100000; // USB OTG EN
^~~~~~~~~~~~~
cc1plus: some warnings being treated as errors
looks like dead code, removing this line doesn't seem to break anything, prefixing [[maybe_unused]]
works too.
Using tag 0.1.6.
Calling M5.Power.timerSleep(int)
puts a CoreInk to deep sleep, but when it wakes up, if it is running on battery, the reboot reason (result of esp_reset_reason()
) is not ESP_RST_DEEPSLEEP
but ESP_RST_WDT
or ESP_RST_POWERON
and any RTC Slow memory variable (RTC_NOINIT_ATTR
) is lost.
The problem doesn't happen if the CoreInk is plugged on USB.
The problem doesn't happen if the following two lines are commented:
void Power_Class::timerSleep( int seconds )
{
- M5.Rtc.clearIRQ();
- M5.Rtc.setAlarmIRQ(seconds);
+// M5.Rtc.clearIRQ();
+// M5.Rtc.setAlarmIRQ(seconds);
esp_sleep_enable_timer_wakeup(seconds * 1000000ULL);
_timerSleep();
}
Also, I haven't been able to get M5.Power.timerSleep(const rtc_time_t&)
on the CoreInk to work at all.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.