Navigation

    M5Stack Community

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    1. Home
    2. wa-berlin
    W
    • Continue chat with wa-berlin
    • Start new chat with wa-berlin
    • Flag Profile
    • Profile
    • Following
    • Followers
    • Blocks
    • Topics
    • Posts
    • Best
    • Groups
    Save
    Saving

    wa-berlin

    @wa-berlin

    0
    Reputation
    5
    Posts
    1039
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online

    wa-berlin Follow

    Posts made by wa-berlin

    • RE: Core2 how to know the current battery level

      In Core2_factory_test.ino you find the following lines (ca. 900) with the magic value 3.2, i.e. battery empty.
      They use the variables in their code to make up some nice graphics about battery status.

         float batVoltage = M5.Axp.GetBatVoltage();
          float batPercentage = ( batVoltage < 3.2 ) ? 0 : ( batVoltage - 3.2 ) * 100;
      
      posted in Core 2
      W
      wa-berlin
    • Solution to make Button disappear

      Re: [Core2] make Button disappear
      Re: [Core2] make Button disappear

      I found the following solution, which works for me (extract only):

      Button* button1 = NULL;
      // create button
      if (button1) delete(button1);
      button1 = new Button(0, 0, 158, 80, false);
      // disable button
      button1->delHandlers(_softButtonEvent);
      // the following line is optional, does not change anything if button is deleted
      // button1->erase(BLACK); // documentation in M5Button.h -> line 716
      delete(button1);
      
      // that trick does it; other approaches did not work reliably
      button1 = new Button(0, 0, 0, 0, false, ""); 
      
      posted in Core 2
      W
      wa-berlin
    • [Core2] make Button disappear

      I seek for a solution for the following problem.

      The code below shows a button handling in Core2.
      When the Event is detected I want to get rid of the button, i.e. make the button disappear.
      I tried several options, see source code.
      What happens is, that the event is disabled.
      However when I push in the button area on the TFT the button appearance still behaves by changing colors.
      What do I miss here?
      Thank you in advance for any hints!

      #include <M5Core2.h>
      
      ButtonColors onCol = { TFT_DARKGREY, TFT_WHITE, TFT_WHITE };
      ButtonColors offCol = { TFT_WHITE, TFT_BLACK, TFT_WHITE };
      
      Button rt(162, 0, 158, 80, false, "120 sec", onCol, offCol);
      
      void RtBtnTouched(Event& e) {
              Serial.println("Touched!");
      		// deactivate button --> three approaches tested so far	   
      		rt.delHandlers(RtBtnTouched); 
      		rt.hide();
      		~rt;		
      }
      
      void setup() {
      	M5.begin();
      	rt.addHandler(RtBtnTouched, E_TOUCH);
      	rt.draw();
      }
      
      void loop() {
      	M5.update();
      }
      
      posted in Core 2
      W
      wa-berlin
    • [Core2] M5Timer-Lib // How to use "numTimer" in e.g. "setInterval()"

      I want to use the M5Timer Library with Core2.
      In <M5Timer.h> there are functions having a <numTimer> argument and those without.

      Questions:
      How can I use
      0_1612800101761_89beb75e-65e8-4440-ba61-01fbb4c67451-image.png
      with a certain timer?
      I am simply missing the argument "numTimer" in the function.

      A working example for Core2 would be helpful.
      Thank you in advance.

      posted in Core 2
      W
      wa-berlin