Navigation

    M5Stack Community

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    1. Home
    2. galeap
    3. Posts
    G
    • Continue chat with galeap
    • Start new chat with galeap
    • Flag Profile
    • Profile
    • Following
    • Followers
    • Blocks
    • Topics
    • Posts
    • Best
    • Groups

    Posts made by galeap

    • Any example references to using the extra fonts in M5 Tough

      Hi all,
      My learning journey has been a big one over the past two weeks with my M5 Tough, and I'm now a lot more comfortable with doing most basic things with it. However one thing that I haven't been able to do is get the GFXFF extra font set working with instructions like "M5.Lcd.drawString()". At the moment I'm limited to the basic fonts 1, 2 4, etc.

      I found the information in the Free_fonts.h file, and included it with #include<Free_Fonts.h> in my main project. And then had a go at trying to reference the fonts using this type of reference "&fonts::&FreeSansBold18pt7b" for the font parameter within the M5.Lcd.drawString command above, but couldn't get the code to compile as it looks like the drawString function is expecting an integer value.

      I'm sure I'm probably missing something simple here, so any pointers or examples of how to use the free fonts on the M5 Tough is appreciated.

      Thanks.
      galeap

      posted in Arduino
      G
      galeap
    • RE: Trouble getting touch button example code to work on M5 Tough.

      @felmue Hey felmue, I've managed to sort out my issue. It wasn't a power thing.

      I've been using PlatformIO to do my work as I'm trying to start using VSC for a number of tasks. I ended up going back to the Arduino IDE and surprise surprise the above code compiled and worked ok. So Iwent back and started looking at how I was trying to use the library in PlatformIO. Because the M5Tough library didn't appear in the usual library list, I had just copied the files in the GIT repo under the src folder into my VSC project src folder. It turns out that this works ok for some examples, but not the buttons one (I assuming it tries to reach a header file that it couldn't locate for these ones or something.

      Anyway, I found out how to add a third part library into PIO using CLI, started a new Tough project, and now the code works well. So in the end the problem was my lack of understanding (again!) but at least now I've learnt how PIO goes together.

      Thanks for the suggestions and your time, I sure you'll get another chance to try and help me in the future :)

      galeap.

      posted in Arduino
      G
      galeap
    • Trouble getting touch button example code to work on M5 Tough.

      Hi everyone,

      I'm still in the process of learning the M5 Tough's capability and approach to coding it. I'm mostly looking through the examples in the this repo (https://github.com/m5stack/M5Tough) to understand how to do things.

      I'm having troubles though trying to run any code that shows how to use touch button. When I run any of the example code the M5 Tough controller panics and ends up in a boot loop.

      For example if I run the following sample bit of code that is documented in the M5Button.h file.

      #include <M5Tough.h>
      
      
      
          ButtonColors onCol = {BLACK, WHITE, WHITE};
      
          ButtonColors offCol = {RED, WHITE, WHITE};
      
          Button myButton(10, 10, 200, 100, false, "I'm a button !", onCol, offCol);
      
      
      
          
      
          void touched(Event& e) {
      
            Serial.println("Touched!");
      
          }
      
      
      
          void released(Event& e) {
      
            Serial.println("Released!");
      
          }
      
      
      
          void setup() {
      
            M5.begin();
      
            myButton.addHandler(touched, E_TOUCH);
      
            myButton.addHandler(released, E_RELEASE);
      
          }
      
      
      
          void loop() {
      
            M5.update();
      
          }
      

      A core dump /boot loop occurs with the following info displaying over and over in the Terminal window:
      ...........

      E (277) esp_core_dump_flash: Core dump flash config is corrupted! CRC=0x7bd5c66f instead of 0x0
      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:0x3fff0030,len:1184
      load:0x40078000,len:13192
      load:0x40080400,len:3028
      entry 0x400805e4
      Guru Meditation Error: Core 0 panic'ed (LoadProhibited). Exception was unhandled.

      Core 0 register dump:
      PC : 0x400d5035 PS : 0x00060330 A0 : 0x800d5089 A1 : 0x3ffe3b10
      A2 : 0x3ffc2a44 A3 : 0xffff0000 A4 : 0x0000ffff A5 : 0x0000db40
      A6 : 0x00060320 A7 : 0x00000001 A8 : 0x00000000 A9 : 0x00000000
      A10 : 0x3ffc2a44 A11 : 0xffff0000 A12 : 0x00060320 A13 : 0x00060523
      A14 : 0x007b7e1c A15 : 0x003fffff SAR : 0x0000001c EXCCAUSE: 0x0000001c
      EXCVADDR: 0x00000000 LBEG : 0x40088a2d LEND : 0x40088a3e LCOUNT : 0xfffffff0

      Backtrace: 0x400d5032:0x3ffe3b10 0x400d5086:0x3ffe3b40 0x400d5c25:0x3ffe3b60 0x400d5d15:0x3ffe3b90 0x400d2755:0x3ffe3bc0 0x400e49b7:0x3ffe3c10 0x4008333a:0x3ffe3c40 0x40079266:0x3ffe3c90 |<-CORRUPTED

      ........................

      I've also tried the TouchButton.ino example file code (From the GIT project repo listed above project) and it does exactly the same thing.

      Is there something simple that I have missed doing here, because all of the example code looks pretty straight forward?

      Any help or ideas on this is appreciated.

      Thanks,
      galeap

      posted in Arduino
      G
      galeap
    • RE: Wake M5 Tough from Light Sleep with GPIO Input???

      @felmue Thanks very much for the super fast reply and the sample code, it works a treat.

      posted in Arduino
      G
      galeap
    • Wake M5 Tough from Light Sleep with GPIO Input???

      Hi all.

      I'm totally new to the whole M5 world. I have a M5 Tough that I have been playing with, initially coding it with UiFlow, but now using PlatformIO in VSC with arduino based libraries.

      I've pretty much run into a wall straight away with my tinkering and I hope someone can help me out.

      What I would like to do is, place the Tough into a LightSleep mode and then wake it up from either a GPIO Input interrupt and also if the screen is touched.

      I stared playing with the sleep example in the M5Tough library, hacking it up a bit (Listed below) to introduce an Input on Pin 19 and associate it with an input interrupt. I've attached a simple push button circuit and proved it worked with a simple input pin read before trying to use it as the wake interrupt trigger.
      And I've tried all sorts of things with the interrupt handler code, but I just cant find a way to wake the Tough out of sleep. The only way the controller wakes in my test code is that the sleep timer expires. In fact I'm at the point of thinking the interrupt is not being seen at all when I push the button while the Tough is asleep.

      It would be greatly appreciated if anyone help me out with ideas, or better still, a piece of sample code?

      Cheers,
      galeap

      For ref here is the latest hack code I've been playing with:

      /*


      • Copyright (c) 2021 by M5Stack
      •              Equipped with M5Tough sample source code
        
      •                      配套  M5Tough 示例源代码
        
      • Visit the website for more information:https://docs.m5stack.com/en/core/tough
      • 获取更多资料请访问:https://docs.m5stack.com/zh_CN/core/tough
      • describe:Sleep--Axp电源休眠
      • date:2021/7/21

      */
      #include <M5Tough.h>

      void wakeUp() {
      // Wake-up interrupt handler
      // M5.Power.wakeUp();
      M5.Axp.RestoreFromLightSleep();
      Serial.println("Interupt Wake Up.");
      M5.Lcd.println("Interupt Wake Up.");

      }

      /* After M5Tough is started or reset
      the program in the setUp () function will be run, and this part will only be run once.
      在 M5Tough 启动或者复位后,即会开始执行setup()函数中的程序,该部分只会执行一次。 */
      void setup(){
      M5.begin(); //Init M5Tough. 初始化 M5Tough

      // Set GPIO Pin 19 as an input
      pinMode(19, INPUT_PULLUP);

      // Attach the wake-up interrupt to GPIO Pin 19
      attachInterrupt(digitalPinToInterrupt(19), wakeUp, RISING);

      M5.Lcd.setTextFont(2); //Set font size to 19. 设置字体大小为2

      Serial.println("Light / Deep Sleep Test."); //The serial port prints the formatted string with a newline. 串口输出格式化字符串并换行
      M5.Lcd.println("Light / Deep Sleep Test."); //The screen prints the formatted string and wraps it. 屏幕打印格式化字符串并换行

      }

      void loop()
      {
      Serial.println("Going to light sleep for 15 seconds.");
      M5.Lcd.println("Going to light sleep for 15 seconds.");

      delay(2500); //delay 2500ms. 延迟2500ms

      M5.Axp.LightSleep(SLEEP_SEC(15)); //Wake up after 5 seconds of light sleep, the CPU will reboot and the program will start from the beginning. 轻度睡眠10秒后重新启动,程序从下一行继续执行

      Serial.println("Wakeup from light sleep.");
      M5.Lcd.println("Wakeup from light sleep.");
      delay(10000);
      }

      posted in Arduino
      G
      galeap