Giter Club home page Giter Club logo

m5dial's Introduction

M5Dial

Basic library for M5Stack M5Dial Board

License

M5GFX : MIT
M5Unified : MIT
Encoder : original

m5dial's People

Contributors

gitshaoxiang avatar 3110 avatar lovyan03 avatar

Stargazers

maker114 avatar Nirmal avatar garrett avatar Outatime avatar Benedict Diederich avatar  avatar  avatar Guanghao Gao avatar TimothyChen avatar  avatar Exrector avatar Gonzo Gear avatar  avatar  avatar  avatar Jason Thomas Horn avatar  avatar GOROman avatar  avatar  avatar  avatar Leonardo Secades avatar Ross Kusler avatar  avatar 朴 avatar Nguyễn Lê Minh avatar Bjørn avatar Cristi avatar  avatar Bruce Johnson avatar Rikiya Yamamoto avatar Hugo Schmitt avatar  avatar yozora project avatar  avatar Tommy avatar Jeff Records avatar  avatar odanny avatar  avatar  avatar  avatar Arrate avatar Mushroom avatar  avatar Durin Gleaves avatar  avatar Tom Hermans avatar  avatar Raphael d'Ursel avatar  avatar  avatar  avatar Yea Chen avatar  avatar Ludovic BOUÉ avatar ticccco avatar tobozo avatar

Watchers

 avatar Paweł Pyszko avatar Martin Han avatar IAMLIUBO avatar  avatar  avatar  avatar  avatar

m5dial's Issues

wifi not work when rfid is enabled

even a simple code like this can raise my problem

//connect to WiFi Serial.printf("Connecting to %s ", ssid); WiFi.begin(ssid, password); while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print("."); } Serial.println(" CONNECTED");

with this config setting everything is ok

M5Dial.begin(cfg, false, false);

but if i enable rfid

M5Dial.begin(cfg, false, true);

m5dial can connect only once to my wifi network, i have a fritzbox router

any idea?

RFID Question.

From the documentation https://docs.m5stack.com/en/core/M5Dial
The Dial uses the WS1850S rfid chip, the same as the RFID2 Unit
https://docs.m5stack.com/en/unit/rfid2
I have no problem reading NFC512 ISO14443A Sticker tags with the RFID2 Unit, but the Dial will sometimes say UNSUPPORTED, or mostly it just refuses to read them at all.
IF it's using the same WS1850S chip, should it also read the same tags?
I used the demo code for the RFID2 Unit and the M5StickC-Plus without issue.
And the demo RFID example here in this repository for the Dial.
Both will read the credit card type MIFARE cards with out any problems.

I am very confused by this behavior thou, any suggestions - or maybe a different sketch/library to try.
Thanks.

Internal i2c pullups

Looking at the schematic, there don't appear to be any i2c bus pullup resistors for the shared Touch, RTC and RFID lines.
I'm experiencing corrupted data from the RTC. Could this be the cause of the problem or are the lines pulled to 3.3V elsewhere - in a way that I've missed?

Thanks

nik

How do i print a bitmap image logo on a M5Dial Display ?

Hello,

I am trying to print a logo bitmap on a M5Dial Display, Unable to print
Other text and simple features i am able to do

this is the code

#include <M5Dial.h>

const uint8_t smiley_bmp[] = {
0b00111100,
0b01000010,
0b10100101,
0b10000001,
0b10100101,
0b10011001,
0b01000010,
0b00111100};

void setup() {
M5.begin();
M5.Lcd.begin();
M5.Lcd.setRotation(1);
}

void loop() {
// Draw the bitmap at position (0, 0)
M5.Lcd.drawBitmap(0, 0, 8, 8, smiley_bmp);
delay(5000);
}

Wire.h: No such file or directory

I get a build error when using platform.io.

In file included from .pio/libdeps/m5stack-stamps3/M5Dial/src/M5Dial.h:7,
                 from .pio/libdeps/m5stack-stamps3/M5Dial/src/M5Dial.cpp:1:
.pio/libdeps/m5stack-stamps3/M5Dial/src/utility/MFRC522.h:83:10: fatal error: Wire.h: No such file or directory

 #include <Wire.h>
          ^~~~~~~~
compilation terminated.
In file included from .pio/libdeps/m5stack-stamps3/M5Dial/src/utility/MFRC522.cpp:10:
.pio/libdeps/m5stack-stamps3/M5Dial/src/utility/MFRC522.h:83:10: fatal error: Wire.h: No such file or directory

platformio.ini:

[env:m5stack-stamps3]
platform = espressif32
board = m5stack-stamps3
framework = arduino
lib_deps = 
	m5stack/M5Dial@^1.0.2
	m5stack/M5Unified@^0.1.16

Compilation error: exit status 1

Arduino IDE v2.2.1
M5Stack Boards v2.0.8
M5Dial Library v1.01

#include "M5Dial.h"

void setup() {
}

void loop() {
}

Error Log:

FQBN: esp32:esp32:stamp-s3
Using board 'stamp-s3' from platform in folder: /Users/hidden/Library/Arduino15/packages/esp32/hardware/esp32/2.0.11
Using core 'esp32' from platform in folder: /Users/hidden/Library/Arduino15/packages/esp32/hardware/esp32/2.0.11

bash -c "[ ! -f \"/private/var/folders/s5/9fwg2bbd5sggdqs1hlbp2pp00000gn/T/.arduinoIDE-unsaved20231016-14463-dxw3n8.09lmu/encoder\"/partitions.csv ] || cp -f \"/private/var/folders/s5/9fwg2bbd5sggdqs1hlbp2pp00000gn/T/.arduinoIDE-unsaved20231016-14463-dxw3n8.09lmu/encoder\"/partitions.csv \"/private/var/folders/s5/9fwg2bbd5sggdqs1hlbp2pp00000gn/T/arduino/sketches/CEE4FA9D792111B14A5E963407FC845A\"/partitions.csv"

--- removed for brevity ---

@/private/var/folders/s5/9fwg2bbd5sggdqs1hlbp2pp00000gn/T/arduino/sketches/CEE4FA9D792111B14A5E963407FC845A/file_opts -I/Users/hidden/Library/Arduino15/packages/esp32/hardware/esp32/2.0.11/cores/esp32 -I/Users/hidden/Library/Arduino15/packages/esp32/hardware/esp32/2.0.11/variants/m5stack_stamp_s3 -I/Users/hidden/Documents/Arduino/libraries/M5Dial/src -I/Users/hidden/Documents/Arduino/libraries/M5Unified/src -I/Users/hidden/Documents/Arduino/libraries/M5GFX/src -I/Users/hidden/Library/Arduino15/packages/esp32/hardware/esp32/2.0.11/libraries/Wire/src /Users/hidden/Documents/Arduino/libraries/M5Dial/src/utility/MFRC522.cpp -o /private/var/folders/s5/9fwg2bbd5sggdqs1hlbp2pp00000gn/T/arduino/sketches/CEE4FA9D792111B14A5E963407FC845A/libraries/M5Dial/utility/MFRC522.cpp.o
Using previously compiled file: /private/var/folders/s5/9fwg2bbd5sggdqs1hlbp2pp00000gn/T/arduino/sketches/CEE4FA9D792111B14A5E963407FC845A/libraries/M5Dial/M5Dial.cpp.o
/Users/hidden/Documents/Arduino/libraries/M5Dial/src/utility/MFRC522.cpp: In member function 'uint8_t MFRC522::PCD_CommunicateWithPICC(uint8_t, uint8_t, uint8_t*, uint8_t, uint8_t*, uint8_t*, uint8_t*, uint8_t, bool)':
/Users/hidden/Documents/Arduino/libraries/M5Dial/src/utility/MFRC522.cpp:464:20: error: '_validBits' may be used uninitialized in this function [-Werror=maybe-uninitialized]
   if (*backLen < 2 || _validBits != 0) {
       ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
cc1plus: some warnings being treated as errors

Using library M5Dial at version 1.0.1 in folder: /Users/hidden/Documents/Arduino/libraries/M5Dial 
Using library M5Unified at version 0.1.10 in folder: /Users/hidden/Documents/Arduino/libraries/M5Unified 
Using library M5GFX at version 0.1.11 in folder: /Users/hidden/Documents/Arduino/libraries/M5GFX 
Using library Wire at version 2.0.0 in folder: /Users/hidden/Library/Arduino15/packages/esp32/hardware/esp32/2.0.11/libraries/Wire 
exit status 1

Compilation error: exit status 1

M5DIal Battery port

What connector does the M5Dial's battery port use? This would be the one inside, below the M5Stamp

I've seen speculation (https://old.reddit.com/r/M5Stack/comments/18ppxmr/what_kind_of_battery_plug_does_the_m5_dial_use/), but when I purchased JST-ZH (https://a.co/d/h6YO8UD) and JST-SH (https://a.co/d/5xiDnRJ), neither fit (one slightly too big, one slightly too small). I haven't seen it documented (http://docs.m5stack.com/en/core/M5Dial) or on their forums. I'm looking for an official, or tested answer, since all I've seen is speculation.

Cannot wakeup from deep sleep with WAKE button

The documentation and schematics say that GPIO 42 - the dial switch - is for WAKE. When I put the ESP32-S3 into deep sleep mode, I cannot get it to wake up by pressing the dial switch.

The Espressif documents say that only RTC GPIOs can be used for wakeup from deep sleep. According to the ESP32-S3 datasheet at https://www.espressif.com/sites/default/files/documentation/esp32-s3_datasheet_en.pdf , only GPIOS 0-21 are RTC GPIOs.

Is there any way to wake from deep sleep with a button press on the M5 Dial?

Encoder works poorly due to undefined CORE_INT40_PIN and CORE_INT41_PIN

I am a developer on the same project cited in issue #5. We have discovered an issue whereby, when you spin the dial rapidly in one direction, the sequence of encoder delta values often changes sign. For example, you might see the sequence -1,-1,-1,-2,-1,2,-1 . The (+)2 is spurious; the dial is only spinning in one direction. Furthermore, the magnitude of the delta never exceeds 2.

I have tracked it down to the fact that attach_interrupt in Encoder.h is failing. The reason is that M5Dial.h has

#define DIAL_ENCODER_PIN_A 41
#define DIAL_ENCODER_PIN_B 40

but in Encoder.h, the list of interrupt pin defines ends at 39, i.e.

...
#define CORE_INT36_PIN 36
#define CORE_INT39_PIN 39

I suspect that this is because, on plain ESP32, the highest numbered GPIO is 39, whereas ESP32-S3 has GPIO numbers up to 48, and the code was not updated to reflect that.

When the interrupt does not attach, the update() method runs only when Encoder.read() is called, and that is not necessarily frequently enough to catch all encoder edges during fast rotation.

I manually added the following lines to Encoder.h to fix the problem:

#define CORE_INT40_PIN 40
#define CORE_INT41_PIN 41

A complete fix might include other GPIO numbers as well, although 40 and 41 suffice for the M5Dial hardware that uses those pins.

Encoder interrupts break USB OTG functionality

When the encoder is used, the encoder interrupt seems to interfere with the USB interrupt.
On my sketch with USB Keyboard and Serial, USB stops working when the encoder wheel is rotated fast for a few seconds. WIndows will sometimes report a malfunctioning USB device but most of the times, the device just stops working.

Full code of the sketch is below.
I must add that in order for the USB OTG to work in combination with the encoder, the Encoder::read method was changed to not call the noInterrupts() and interrupts() functions since that always breaks the USB device.
Note that there should be no harm in doing so since the access to encoder.position in that method is an atomic (32 bit read) action that cannot be interrupted. I also tested this change to be working in combination with the standard "Hardware CDC and JTAG" mode.

Small explanation of the example: the loop reads the encoder and prints the position. It will then simulate a cursor left or right, depending on the CCW/CW rotation of the encoder. Printing of the encoder position at the top of loop() is done constantly to show that the sketch keeps working when the encoder is not rotated.
It will happily print text for 15 minutes in a row but as soon as the encoder is rotated for a few seconds, USB stops working.

#include "src/M5Dial/M5Dial.h"
#include "USB.h"
#include "USBHIDKeyboard.h"

USBHIDKeyboard Keyboard;

void setup() {
  //auto cfg = M5.config();
  M5Dial.begin(true, false);
  Keyboard.begin();
  Serial.begin();
  USB.begin();
  Serial.println("Running");
}

long oldPosition = 0;

void loop() {

  long newPosition = (M5Dial.Encoder.read()+2) >> 2;
  Serial.printf("Pos = %d\n", newPosition);
  if(newPosition < oldPosition) {
    oldPosition--;
    Keyboard.press(KEY_LEFT_ARROW);
    Keyboard.releaseAll();
  }
  if(newPosition > oldPosition) {
    oldPosition++;
    Keyboard.press(KEY_RIGHT_ARROW);
    Keyboard.releaseAll();
  }

  delay(1);
}

Touch stops working.

Sometimes my touch screen stops working and it requires a power cycle to fix.

Is there anything that can be done in code to detect and fix the problem?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.