GithubHelp home page GithubHelp logo

m5stickc-plus's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

m5stickc-plus's Issues

Is someone going to update M5Stick+ on Arduino library manager?

The Arduino library manager says my Stick Plus is up to date on 0.0.2
But it's missing the entire directory: M5StickC-Plus/examples/Hat/C_BACK_DRIVER/
That folder's over 6 months old... so I figured there's probably several updates that should be in release 0.0.3 by now?

How to use MPU6886

MPU6886 works in M5stickC by M5.MPU6886.getAccelData(&accX, &accY, &accZ);
So I write M5.IMU.getAccelData(&accX, &accY, &accZ);, but it get result "X is:0.00 Y is:0.00 Z is:0.00" in Plus.
How can I get values from MPU6866 in Plus?

Esp-idf arduino component require

set(COMPONENT_PRIV_REQUIRES arduino)

Hello m5stack team,

this is more a question than an issue. Im trying to use M5StickC-Plus as a esp-idf component. Seems like it requires another component named arduino. What is the repo for the arduino component?. I can only find this -> https://github.com/espressif/arduino-esp32

Is arduino-esp32 component compatible with M5SickC-Plus?

Thank you very much and kind regards,
Rafa

Free_Fonts.h missing

Describe the bug

The source file "Free_Fonts.h" is missing.
So I cannot complete compiling codes with free font.
The statement below:
M5.Lcd.setFreeFont(FSS9);
causes a message:
error: 'struct GFXfont' has no member named 'range_num'

To reproduce

#include <M5StickCPlus.h>
#include <Free_Fonts.h>
void setup()
{
M5.begin();
M5.Lcd.setFreeFont(FSS9);
M5.Lcd.drawString("Test drawString", 0, 0, GFXFF);
}
void loop()
{
M5.update();
}

Expected behavior

I have copied "Free_Fonts.h" from M5Stack repository, and complete compiling and some free fonts are displayed on the LCD.

Screenshots

No response

Environment

  • OS: Windows11
  • IDE &IDE Version: 1.8.19
  • Repository Version: 0.0.8

Additional context

It will be same for the M5Stick repository.

Issue checklist

  • I searched for previous reports in the issue tracker
  • My report contains all necessary details

After flash a .bin file with esptool.py, M5stickC Plus doesn't work

I inputed below:

esptool.py --port COM4 -b 1500000 write_flash 0x00000 M5ZoomcontrollerPlus3.ino.m5stick_c.bin

The M5stickC Plus doesn't work after this command. I think something wrong with this command.
Because of hiding my code, I need this process. Please kindly give me advice.

Best regards

[SOLVED] Flashing with other tools than Arduino IDE results display fail

When flashing with the following tools, bad things happen (display black or garbage)

  • EasyLoader_M5StickC_FactoryTest.exe
  • M5Burner (any rom flashed from StickCPlus)

When using Arduino IDE, I can flash any Example without problems.
Tried with different baud rates for upload, different partitions with Arduino IDE, always the same, Arduino IDE works, the other tools failing.

Pease advice. I want to flash at least the latest UIFlow rom.

Wrong IMU pins

Describe the bug

The sketch M5StickC-Plus/examples/Basics/IMU/IMU.ino doesn't work because the line imu6886.Init(32, 33) is wrong. With my device, it should be imu6886.Init(GPIO_NUM_21, GPIO_NUM_22).

To reproduce

  1. Compile and run M5StickC-Plus/examples/Basics/IMU/IMU.ino
    => IMU readings are random

Expected behavior

IMU readings are correct

Screenshots

No response

Environment

  • OS: Ms Windows
  • IDE &IDE Version: VSCode + PlatformIO
  • Repository Version: latest

Additional context

No response

Issue checklist

  • I searched for previous reports in the issue tracker
  • My report contains all necessary details

Cant Change CPU speed

Describe the bug

Micropython get an error when using machine.freq() to change CPU speed

To reproduce

machine.freq(160000000)

Expected behavior

No Error and cpu speed to change

Screenshots

No response

Environment

  • OS:
  • IDE &IDE Version:
  • Repository Version:

Additional context

No response

Issue checklist

  • I searched for previous reports in the issue tracker
  • My report contains all necessary details

Why is this a separate library from M5StickC?

Given the similarities between the M5StickC and the M5StickC-Plus, it seems unnecessary to make this a completely separate library. There is already unnecessary divergence between the two libraries, e.g. the wake on motion functionality (present on M5StickC, missing here). With the platformio support already present, could we not just use build flags and platform settings to differentiate and otherwise use the same library for both?

C_BACK_DRIVER.ino is wildly incomplete for a commercial example

Describe the bug

C_BACK_DRIVER.ino doesn't even contain a single 360 servo example, you know, servo 360, a product you sell M5 Stack. Your dev even commented out the 360 code example, probably because it is WRONG, and won't even compile.
Come on, you can at least show a working SINGLE EXAMPLE for M5 hardware YOU SELL, you can do better.

To reproduce

Look at C_BACK_DRIVER.ino

Expected behavior

the commercial entity that creates M5 stack should have tried running their own code, C_BACK_DRIVER.ino at least ONCE, good lord.

Screenshots

No response

Environment

  • OS:
  • IDE &IDE Version:
  • Repository Version:

Additional context

No response

Issue checklist

  • I searched for previous reports in the issue tracker
  • My report contains all necessary details

Wifi inop

Using the Arduino IDE with the latest ESP32 Package (versions 1.0.4 thru 1.0.5 rc4) and the current version of M5StickC-Plus library (0.1) I have been struggling to determine why the wifi does not work on M5StickC-Plus devices. In each case WiFi.status() returns WL_NO_SHIELD. I tested the code on two different devices and I have noted others reporting the same issue.

The code in questions works fine on a M5StickC device so it would appear to be something specific to the Plus devices.

If you have any ideas on how to isolate this issue we would be appreciative.

Wont compile

Describe the bug

Just get a general error that says:

Error compiling for board M5Stick-C-plus. Just curious how to get around this error

Arduino: 1.8.16 (Windows 10), Board: "M5Stick-C-Plus, Default, 240MHz (WiFi/BT), 1500000, None, Disabled"

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

To reproduce

just load and compile. I have loaded all libraries

Expected behavior

I expect the program to compile and load

Screenshots

No response

Environment

  • OS: Win 11
  • IDE &IDE Version: arduino 1.8.16
  • Repository Version:

Additional context

No response

Issue checklist

  • I searched for previous reports in the issue tracker
  • My report contains all necessary details

Issue with ESP32 Analog Motor Control (using ledcwrite)

I've been trying to get my M5StickC-Plus working with various motor controllers including TB6612FNG / MX1508 and have come across an issue. They work fine on the M5Stick-C Plus without the M5StickCPlus.h library (and related features) included, but it fails when enabling the M5 library. In both examples below, the code compiles/downloads fine, but the motor fails to drive in the latter example. I also did some testing using the MX1508 motor driver board and the same issue happened and can re-create this issue using other similar libraries. Also verified both motor controller boards are working. I suspect there is some conflict with setting up ledcwrite related features (e.g. channels? etc)? As there are no errors thrown during compile time, I can't debug the issue.

I've included 2 samples below using the TB6612FNG controller:

Sample 1 WORKS: No M5 library included and works fine and the motor drives per instruction:

#include <Arduino.h>
#include <TB6612_ESP32.h>
#define AIN1 26
#define AIN2 25
#define PWMA 0
#define STBY NULL   //note STBY connected directly to 5V pulled high (to save a pin)

int counter =0;
const int offsetA = 1;


Motor motor1 = Motor(AIN1, AIN2, PWMA, offsetA, STBY,5000 ,8,1 );
// Initializing motors.  The library will allow you to initialize as many
// motors as you have memory for.  If you are using functions like forward
// that take 2 motors as arguements you can either write new functions or
// call the function more than once.


void setup()
{
  Serial.begin(115200);
  gpio_pulldown_dis(GPIO_NUM_36);  //G36/25 share the same port, so set 36 as floating - https://github.com/m5stack/M5StickC-Plus/blob/master/README.md
  gpio_pullup_dis(GPIO_NUM_36);    // above

}

void loop()
{
  for(int i=0; i<200; i++)
  {
    motor1.drive(-200,5);   //speed + or -, duration in ms
    motor1.brake();
    delay(10);
    counter++;
    Serial.println(counter);
  } 
  for(int i=0; i<200; i++)
  {
    motor1.drive(200,5);   //speed + or -, duration in ms
    motor1.brake();
    delay(10);
    counter--;
    Serial.println(counter);
  } 
}

Sample 2 DOES NOT WORK: M5 library and a few features enabled. It compiles and downloads fine, but the motor does not drive.

#include <Arduino.h>
#include <TB6612_ESP32.h>
#include <M5StickCPlus.h>
#define AIN1 26
#define AIN2 25
#define PWMA 0
#define STBY NULL    //note STBY connected directly to 5V pulled high (to save a pin)

int counter =0;
const int offsetA = 1;

Motor motor1 = Motor(AIN1, AIN2, PWMA, offsetA, STBY,5000 ,8,1 );

// Initializing motors.  The library will allow you to initialize as many
// motors as you have memory for.  If you are using functions like forward
// that take 2 motors as arguements you can either write new functions or
// call the function more than once.

void setup()
{
  Serial.begin(115200);
 M5.begin();
  gpio_pulldown_dis(GPIO_NUM_36);  //G36/25 share the same port, so set 36 as floating - https://github.com/m5stack/M5StickC-Plus/blob/master/README.md
  gpio_pullup_dis(GPIO_NUM_36);    // above

}

void loop()
{
  M5.update(); 

     //Use of the drive function which takes as arguements the speed
     //and optional duration.  A negative speed will cause it to go
     //backwards.  Speed can be from -255 to 255.  Also use of the
     //brake function which takes no arguements.

 if (M5.BtnA.wasPressed())
 {
  for(int i=0; i<200; i++)
  {
    motor1.drive(-200,5);   //speed + or -, duration in ms
    motor1.brake();
    delay(10);
    counter++;
    Serial.println(counter);
  } 
  for(int i=0; i<200; i++)
  {
    motor1.drive(200,5);   //speed + or -, duration in ms
    motor1.brake();
    delay(10);
    counter--;
    Serial.println(counter);
  } 
  
 }        
}

Sleep causing unresponsive device

Going into LightSleep or DeepSleep causes the device to freeze or lock up. Uploading the same code by using #include <M5StickC.h> instead of #include <M5StickCPlus.h> fixes the issue, but causes other modules like the display to not function correctly.

This is what I get out of the debug:
018,len:4
load:0x3fff001c,len:1044
load:0x40078000,len:10124

Get/SetData should be Get/SetDate

The functions to set and get the date are called "GetData" and "SetData" instead of "SetDate" and "SetDate". This is also an issue in other M5Stack projects. Is this intended?

Infrared not functioning

I basically pasted the code with a few changes, I'm currently working on a five-screen software for my M5StickC-Plus that I want to put out when I'm done.

Does anybody have working suggestions or code for working infrared?
This is what I currently have :

#include "M5_ScreenFive.h"
#include "M5_Rotate.h"
#include "includes.h"

const int ir_recv_pin = 33;
const int ir_send_pin = 9;
int last_recv_v = 0;
int curr_recv_v = 0;

void setup_IR() {
  pinMode( ir_recv_pin, INPUT );
  pinMode( ir_send_pin, OUTPUT );
}

void screen_three_loop( int &cursor_x, int &cursor_y ) {
  unsigned char ir_code = 0;
  while( true ) {
    m5.update();
    
    if( m5.BtnA.wasReleased() ) return;

    m5.imu.getAhrsData( &pitch, &roll, &yaw );

    if( abs( roll - proll ) > 10 ) {
      rotate_screen( cursor_x, cursor_y );
      proll = roll;
    }

    m5.lcd.setCursor( cursor_x, cursor_y );
    m5.lcd.setTextSize(2);
    m5.lcd.print( "___Infra___" );
    
    if( m5.BtnB.isPressed() ) {
      digitalWrite( ir_send_pin, ir_code );
      m5.lcd.setCursor( cursor_x, 80 );
      m5.lcd.print( "Sending IR" );
      ir_code++;
      m5.lcd.fillRect( cursor_x, 30, 210, 210, BLACK );
    }

    m5.lcd.setCursor( cursor_x, 30 );
    m5.lcd.printf( "Send : 0x%02X", ir_code );

    m5.lcd.setCursor( cursor_x, 50 );
    curr_recv_v = digitalRead( ir_recv_pin );
    if( curr_recv_v != last_recv_v ) {
      m5.lcd.fillRect( cursor_x, 50, 210, 180, BLACK );
      m5.lcd.printf( "Recv : 0x%02X", digitalRead( ir_recv_pin ) );
      last_recv_v = curr_recv_v;
    }

    delay( 25 );
  }
  return;
}

Edit : Got output working by changing send pin from 32 to 9, now finding a bug with the speed it can send so I'm going to fix that real quick, still not sure what to do about receiving though.

Buzzer.update not in M5.update

Please add the M5.Beep.update()-function to the M5.update()-function.
Otherwise the M5.Beep.tome(FRQ, 200) will not end after 200ms.

Thanks

Issues about led and ir transmitter

When I follow the tutorial to try uiflow to turn on the led, it's the ir transmitter that lights up. I see it while filming with my smartphone.

I reflashed the factorytest and the ir transmitter does not light up when I am on the ir test program.

could there be an address error for the LED and the ir transmitter?

{Update} Can I suggest an update the to I2C tester.ino

On my journey of finding out what is wrong with the 8Servo units that I have, I have needed to get my head around I2C ports and how to scan them.

As the StickC and StickC-Plus have two ports, I modified your I2C_tester.ino code so that I can toggle between the ports, after a restart

This is the script I used for the M5StickC

Pressing Button A will set it to the TOP / HAT I2C port and restart

Pressing Button B will set it to the Bottom / Grove port and restart

It's not pretty code, but it does work.

I just wish I could get the 8Servo (or in fact the Servo Hat) to work.

/*
*******************************************************************************
* Copyright (c) 2021 by M5Stack
*                  Equipped with M5StickC sample source code
*                          配套  M5StickC 示例源代码
* Visit for more information: https://docs.m5stack.com/en/core/m5stickc
* 获取更多资料请访问: https://docs.m5stack.com/zh_CN/core/m5stickc
*
* Describe:  I2C Scanner.  I2C探测
* Date: 2021/7/27
*******************************************************************************
*/
/*
This program scans the addresses 1-127 continuosly and shows the devices found
on the TFT. 该程序连续扫描地址 1-127 并显示在外部(内部)I2C发现的设备。
*/
#include <M5StickC.h>
#include <Preferences.h>

Preferences preferences;

int I2C_SDA = 0;
int I2C_SCL = 26;

bool releaseA = false;
bool releaseB = false;
bool portName = 1;

String portNameAlias = "Top Port";

int textColor = YELLOW;

void btn_task(void *arg) { // set this VOID as a task, to run outside of LOOP
    while (1) {
   
        if (M5.BtnA.wasPressed() ) {
            releaseA = !releaseA;
              Serial.println("Chaneg Define");
//        Wire.end();
//            delay (300);
//        Wire.begin(0, 26); // Detect external I2C, Top pins if this sentence is  added,
 I2C_SDA = 0;
 I2C_SCL = 26;
        Serial.println("TOP I2C port activated");
            M5.Lcd.setCursor(0, 0);
            M5.Lcd.println("   RESTARTING                          ");
        portName = 1;
  // Store the counter to the Preferences
  preferences.putUInt("I2C_SDA", I2C_SDA );
  preferences.putUInt("I2C_SCL", I2C_SCL );
  preferences.putBool("portName", portName);

  // Close the Preferences
  preferences.end();
  delay(300);
  ESP.restart();

        }
             if (M5.BtnB.wasPressed() ) {
            releaseB = !releaseB;
              Serial.println("Chaneg Define");
 //       Wire.end();
 //           delay (300);
 //       Wire.begin(33, 32); // Detect external I2C, Top pins if this sentence is  added,
 I2C_SDA = 32;
 I2C_SCL = 33;
        Serial.println("Bottom Grove I2C port activated");
                    M5.Lcd.setCursor(0, 0);
                    M5.Lcd.println("      RESTARTING                               ");
        portName = 0;
  // Store the counter to the Preferences
  preferences.putUInt("I2C_SDA", I2C_SDA );
  preferences.putUInt("I2C_SCL", I2C_SCL );
  preferences.putBool("portName", portName);

  // Close the Preferences
  preferences.end();
  delay(300);
  ESP.restart();
        }
        M5.update();
        vTaskDelay(20);
    }
    
}

void setup() {
    M5.begin();    // Init M5StickC(Init of external I2C is also included ).
                   // 初始化M5StickC(初始化外部I2C也包含在内)
    Serial.begin(9600);
    Serial.println("  ");
        Serial.println(" Hello World ");
        Serial.println("  ");

     preferences.begin("I2C", false);
     I2C_SDA = preferences.getUInt("I2C_SDA", 0); // 0 is incase the prefer does not exist
     I2C_SCL = preferences.getUInt("I2C_SCL", 26); // 26 is incase the prefer does not exist
     Wire.begin(I2C_SDA, I2C_SCL);
     portName = preferences.getBool("portName", 1); // 1 is incase the prefer does not exist, changed later to Top or BASE
if (portName){
  portNameAlias = "Top Port";
  }
else {
  portNameAlias = "Base Port";
}

Serial.println( " I2C Pins in use - SDA = "+String(I2C_SDA)+" , SCL = "+String(I2C_SCL) );

  //   Wire.begin();  // Init wire and join the I2C network. // joins Grove port by default
  //   Wire.begin(0, 26); // Detect external I2C, Top pins if this sentence is  added,
  // Wire.begin(33,32);  //Detect external I2C, Grove port if this sentence is  added,

    M5.Lcd.setTextColor(
        YELLOW);  // Set the font color to yellow.  设置字体颜色为黄色
    M5.Lcd.setRotation(3);                  // Rotate the screen.  旋转屏幕
  //  M5.Lcd.println("M5StickC I2C Tester");  // Print a string on the screen.
                                            // 在屏幕上打印字符串
    Serial.println("M5StickC I2C Tester - "+portNameAlias);
   // Serial.println("M5StickC I2C Tester - Bottom  Port ");

    delay(3000);
    M5.Lcd.fillScreen(
        BLACK);  // Make the screen full of black (equivalent to clear() to
                 // clear the screen).  使屏幕充满黑色(等效clear()清屏)

     xTaskCreate(btn_task,   /* Task function. */
                "btn_task", /* String with name of task. */
                8096,       /* Stack size in bytes. */
                NULL,       /* Parameter passed as input of the task */
                1,          /* Priority of the task. */
                NULL);      /* Task handle. */
}



void loop() {
scanI2C();
delay(200);
}

void scanI2C() {
 //   Wire.begin(I2C_SDA, I2C_SCL);

    int address;
    int error;
    M5.Lcd.setCursor(0, 0);
    M5.Lcd.println("scan "+portNameAlias+" [HEX]");
   // M5.Lcd.println("scan Base port [HEX]");
    Serial.println("   'END' "+portNameAlias+"   ");
    Serial.println("     New Scan >>   ");

    for (address = 1; address < 127; address++) {
        Wire.beginTransmission(
            address);  // Data transmission to the specified device address
                       // starts.   开始向指定的设备地址进行传输数据
        error = Wire.endTransmission(); /*Stop data transmission with the slave.
                   停止与从机的数据传输 0: success.  成功 1: The amount of data
                   exceeds the transmission buffer capacity limit.
                   数据量超过传送缓存容纳限制 return value:              2:
                   Received NACK when sending address.  传送地址时收到 NACK 3:
                   Received NACK when transmitting data.  传送数据时收到 NACK
                                              4: Other errors.  其它错误 */
        if (error == 0) {
            M5.Lcd.print(address, HEX); // show the Decimal address as a HEX value
            M5.Lcd.print(" ");
            Serial.print("Found @ 0x");
            Serial.print(address,HEX); // show the Decimal address as a HEX value
            Serial.print("  & ");
        } else
            M5.Lcd.print(".");
           // Serial.println(" ----- ");

        delay(10);
    }

    if (textColor == YELLOW) {
        textColor = CYAN;
    } else
        textColor = YELLOW;
    M5.Lcd.setTextColor(textColor,
                        BLACK);  // Set the foreground color of the text to
                                 // textColor and the background color to BLACK.
                                 // 设置文字的前景色为textColor背景色为BLACK
}

How can we calibrate the IMU gyros?

Describe the bug

Is there something in the library available to calibrate the gyroscopes?

To reproduce

Every time

Expected behavior

A function to calibrate the gyroscopes

Screenshots

No response

Environment

No response

Additional context

No response

Issue checklist

  • I searched for previous reports in the issue tracker
  • My report contains all necessary details

CoulombCounter not working

The CoulombCounter seems not to work, because the Read32bit-Function only reads 2 instead of 4 bytes:

uint32_t AXP192::Read32bit( uint8_t Addr )
{
	uint32_t ReData = 0;
	Wire1.beginTransmission(0x34);
	Wire1.write(Addr);
	Wire1.endTransmission();
	Wire1.requestFrom(0x34, 4);          //2 replaced by 4 --> works fine
	for( int i = 0 ; i < 4 ; i++ )
	{
		ReData <<= 8;
		ReData |= Wire1.read();
	}
	return ReData;
}

If (Serial) always returns true

Describe the bug

According to Arduino's documentation:

if(Serial)
Description
Indicates if the specified Serial port is ready.
On the boards with native USB, if (Serial) (or if(SerialUSB) on the Due) indicates whether or not the USB CDC serial connection is open. For all other boards, and the non-USB CDC ports, this will always return true.

The M5StickC-Plus has native USB, so I think if (Serial) should return true only when a USB connection is established. This doesn't seem to be the case.

To reproduce

Use this code from Arduino's documentation:

void setup() {
  //Initialize serial and wait for port to open:
  Serial.begin(115200);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB
  }

  // Display something in the terminal
  Serial.println("Hello World");
}

void loop() {}

This code doesn't display "Hello World" in the terminal, because the line Serial.println("Hello World"); is called before the USB connection is established.

Expected behavior

You should see "Hello World" in the terminal.

Screenshots

No response

Environment

  • OS: Windows
  • IDE &IDE Version: VSCode + PlatformIO
  • Repository Version: latest

Additional context

No response

Issue checklist

  • I searched for previous reports in the issue tracker
  • My report contains all necessary details

M5Display::setBrightness will it be implemented ?

Hello,
in M5Display.cpp I see that various functions including M5Display::setBrightness and M5Display::sleep are not implemented (wrapped in an "#if 0" cpp directive). Is there any hope for those to be implemented ?
Thank you very much!

giovanni

Broken link from M5StickC 8-Channel Servo Driver HAT doc

Describe the bug

Hello,

I noticed a broken link from M5StickC 8-Channel Servo Driver HAT doc

8Servos HAT v1.1 with M5StickC Plus : 8SERVO_V1.1.ino

Could you fix it?

Regards

To reproduce

Go to M5StickC 8-Channel Servo Driver HAT doc click the 8Servos HAT v1.1 with M5StickC Plus link.

Expected behavior

Download 8SERVO_V1.1.ino file

Screenshots

No response

Environment

  • OS:
  • IDE &IDE Version:
  • Repository Version:

Additional context

No response

Issue checklist

  • I searched for previous reports in the issue tracker
  • My report contains all necessary details

AXP192.cpp SetSleep() is different than the one for M5StickC

M5.Axp.DeepSleep() is OK with the M5StickC version of SetSleep(), but not with the one supplied for M5StickC-Plus.... is this a bug ?

the correction I made in AXP192.cpp:

void AXP192::SetSleep(void) //version M5stick-C
{
Write1Byte(0x31 , Read8bit(0x31) | ( 1 << 3)); // Turn on short press to wake up
Write1Byte(0x90 , Read8bit(0x90) | 0x07); // GPIO1 floating
Write1Byte(0x82, 0x00); // Disable ADCs
Write1Byte(0x12, Read8bit(0x12) & 0xA1); // Disable all outputs but DCDC1
}
/

void AXP192::xSetSleep(void) //version M5stick-C plus
{
uint8_t buf = Read8bit(0x31);
buf = (1<<3)|buf;
Write1Byte( 0x31 , buf );
Write1Byte( 0x90 , 0x00 );
Write1Byte( 0x12 , 0x09 );
Write1Byte( 0x12 , 0x00 );
}
*/

Black display when using setcursor() even when changing fontsizes from 1 to 7

Describe the bug

Using following code after installing m5stickcplus 0.1.0 i get always black display.
I also note in my other projects that using setCursor(0, 0, x) to change font or size values between 1 and 7 some dont show any display at all , why is that?

      `
      void loop() {
          tftSprite.fillSprite(BLACK);   // Fill the canvas with black.                         
          tftSprite.setCursor(0, 0, 1);  // Set the cursor position and use the 1-point font.
          tftSprite.printf("AXP Temp: %.1fC \r\n",
                           M5.Axp.GetTempInAXP192());  // Get the temperature of AXP192.
                           
          tftSprite.printf("Bat: %.3fv %.1fma\r\n",
                           M5.Axp.GetBatVoltage(),
                           M5.Axp.GetBatCurrent());  // Output voltage and current of // Bat.
                                                     
          tftSprite.printf("Usb: %.2fv %.1fma\r\n",
                           M5.Axp.GetVBusVoltage(),
                           M5.Axp.GetVBusCurrent());  // Output current and voltage of USB
                                                      
          tftSprite.printf("5V-In: %.2fv %.1fma\r\n",
            M5.Axp.GetVinVoltage(), M5.Axp.GetVinCurrent());
          tftSprite.printf("Bat power %.1fmw", M5.Axp.GetBatPower());
          tftSprite.pushSprite(2, 2);   // Where to place our sprite ( 2 pixel marge for best display )
      
          // 0x01 long press(1s), 0x02 press
          // No display or flashing with next line ???
          // if (M5.Axp.GetBtnPress() == 0x02)  { esp_restart(); }  // Restart when powerbutton is pressed shortly
      
          if (M5.BtnA.wasPressed()) {  // When Main button pressed powerdown LCD & Backlight 
            M5.Axp.SetLDO2(false);
          } 
          else if (M5.BtnB.wasPressed()) { // When bottom button pressed powerup LCD & Backlight 
            M5.Axp.SetLDO2(true);
          }
          M5.update();  // Detect whether the keystroke state has changed.
          delay(100);
      }`

To reproduce

use code above in arduino version above

Expected behavior

Arduino ide 1.8.19

Screenshots

No response

Environment

  • OS:
  • IDE &IDE Version:
  • Repository Version:

Additional context

No response

Issue checklist

  • I searched for previous reports in the issue tracker
  • My report contains all necessary details

ESP IDF mapping of screen PINs

Hello M5Stack team!

I was trying to run this ESP IDF sample on my new M5Stick C Plus. In order for it to work, I needed to map the sticks's PINs to the following:

EXAMPLE_PIN_NUM_PCLK | SCK
EXAMPLE_PIN_NUM_CS | CS
EXAMPLE_PIN_NUM_DC | DC
EXAMPLE_PIN_NUM_RST | RST
EXAMPLE_PIN_NUM_DATA0 | MOSI
EXAMPLE_PIN_NUM_BK_LIGHT | BCKL

I found most of the PIN numbers here however it seems that I am missing the BCKL PIN.
What PIN address does it have? Where can I find it? Will there other changes be needed in order for the sticks screen to work with ESP IDF?

Thank you!

Get battery level execution issue

Summary

Hi, with the last version of Arduino Framework and Espressif SDK, also with previous SDK, we have the next crash:

:M5STICKCPLUS$ esp32decode -e firmware.elf 0x40083a91:0x3ffcdef00x40095ae1:0x3ffcdf10 0x4009b169:0x3ffcdf30 0x4009657e:0x3ffce060 0x401e15ba:0x3ffce0a0 0x401e171d:0x3ffce0c0 0x400de2ba:0x3ffce0e0 0x400de2f1:0x3ffce100 0x400de30c:0x3ffce130 0x400e0851:0x3ffce150 0x400d7ee7:0x3ffce170 0x400f0eba:0x3ffce1e0

/home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp_system/panic.c:402
/home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/newlib/assert.c:85
/home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/queue.c:821 (discriminator 2)
/home/.platformio/packages/framework-arduinoespressif32/libraries/Wire/src/Wire.cpp:339
/home/.platformio/packages/framework-arduinoespressif32/libraries/Wire/src/Wire.cpp:503
/home/pio/canairio_firmware/.pio/libdeps/M5STICKCPLUS/M5StickCPlus/src/AXP192.cpp:121
/home/pio/canairio_firmware/.pio/libdeps/M5STICKCPLUS/M5StickCPlus/src/AXP192.cpp:66
/home/pio/canairio_firmware/.pio/libdeps/M5STICKCPLUS/M5StickCPlus/src/AXP192.cpp:327
/home/pio/canairio_firmware/lib/batterylib/battery_m5stack.cpp:14
/home/pio/canairio_firmware/src/main.cpp:233
/home/.platformio/packages/framework-arduinoespressif32/cores/esp32/main.cpp:42

My code is the next:

void Battery_M5STACK::update() {
    curv = M5.Axp.GetBatVoltage();    // <== crash
    vusb = M5.Axp.GetVBusVoltage();
}

The wire init in my development is:

void Sensors::startI2C() {
#if defined(M5STICKCPLUS) || defined(M5COREINK) 
    Wire.begin(32,33);   // M5CoreInk Ext port (default for all sensors)
    enableWire1();
#endif
#ifdef M5ATOM
    enableWire1();
#endif
#if not defined(M5STICKCPLUS) && not defined(M5COREINK) && not defined(M5ATOM)
    Wire.begin();
#endif
}

void Sensors::enableWire1() {
#ifdef M5STICKCPLUS
    Wire1.flush();
    Wire1.begin(0,26);   // M5CoreInk hat pines (header on top)
#endif
#ifdef M5COREINK
    Wire1.flush();
    Wire1.begin(25,26);   // M5CoreInk hat pines (header on top)
#endif
#ifdef M5ATOM
    Wire1.flush();
    Wire1.begin(26,32,100000);   // M5CoreInk Ext port (default for all sensors)
#endif
}

Setup:

Resolving M5STICKCPLUS environment packages...
Platform espressif32 @ 4.4.0 (required: espressif32)
├── framework-arduinoespressif32 @ 3.20003.0 (required: platformio/framework-arduinoespressif32 @ ~3.20003.0)
├── tool-esptoolpy @ 1.30300.0 (required: platformio/tool-esptoolpy @ ~1.30300.0)
├── tool-mkfatfs @ 2.0.1 (required: platformio/tool-mkfatfs @ ~2.0.0)
├── tool-mklittlefs @ 1.203.210628 (required: platformio/tool-mklittlefs @ ~1.203.0)
├── tool-mkspiffs @ 2.230.0 (required: platformio/tool-mkspiffs @ ~2.230.0)
├── toolchain-riscv32-esp @ 8.4.0+2021r2-patch3 (required: espressif/toolchain-riscv32-esp @ 8.4.0+2021r2-patch3)
└── toolchain-xtensa-esp32 @ 8.4.0+2021r2-patch3 (required: espressif/toolchain-xtensa-esp32 @ 8.4.0+2021r2-patch3)

Source code:

CanAirIO Firmware
CanAirIO Sensorslib

Cannot connect Wifi on Arduino Idle

I read through #10 but it does not solve.

I tried to connect to my home WiFi (network band on 2.4 GHz) with Arduino Idle 1.18.19

The Wifi.status() returned 3 (WL_CONNECTED) while Wifi.begin() returned 6(WL_DISCONNECTED)

Original code

#include <M5StickCPlus.h>
#include <WiFi.h>
//#include <HTTPClient.h>

#include "arduino_secrets.h" 

#define PIR_GROVE_PIN 33
#define LED_PIN 10

#define LED_ON LOW
#define LED_OFF HIGH

const char *ssid = "BumBeo";        // your network SSID (name)
const char *pass = "38636300";
int keyIndex = 0;   

int status = WL_IDLE_STATUS;

void setup(){
  M5.begin(true, true, true);             //Init M5StickC plus
  Serial.begin(9600);

  M5.Lcd.setRotation(3);
  M5.Lcd.setTextSize(2);
  M5.Lcd.setCursor(20, 15);
  M5.Lcd.println("PIR motion test");
  M5.Lcd.setCursor(30, 30);
  M5.Lcd.println(" Person dected?");

  pinMode(PIR_GROVE_PIN,INPUT);
  pinMode(LED_PIN,OUTPUT);
  
  // check for the presence of the shield:
  Serial.println("Checking for wifi hardware...");
  /*
  if (WiFi.status() == WL_NO_SHIELD) {
    Serial.println("WiFi shield not present");
    // don't continue:
    while (true);
  }
  */
  //Serial.println("Wifi shield found!");
  // attempt to connect to WiFi network:
  Serial.println("Attempting to connect to Wifi network");
  status = WiFi.begin(ssid, pass);
  
  while (status != WL_CONNECTED) {
    if(status == WL_DISCONNECTED){
      Serial.println("status == WL_DISCONNECTED");
    }
    Serial.print("Wifi.begin: ");
    Serial.println(status);
    Serial.print("Attempting to connect to SSID: ");
    Serial.println(ssid);
    Serial.print("Wifi.status: ");
    Serial.println(WiFi.status());  
    // Connect to WPA/WPA2 network. Change this line if using open or WEP network:
    //status = WiFi.begin(ssid, pass);

    // wait 10 seconds for connection:
    delay(10000);
  }
  Serial.println("Connected to wifi");
  printWiFiStatus();
}

void loop(){

  //static float tmp = 0;
  int motionVal = digitalRead(PIR_GROVE_PIN);
  if(motionVal)
    digitalWrite(LED_PIN,LED_ON);
  else
    digitalWrite(LED_PIN,LED_OFF);
  M5.Lcd.setCursor(80, 60);
  M5.Lcd.printf("%3d",motionVal);
  delay(1000);         //Delay 1s
}

void printWiFiStatus() {
  // print the SSID of the network you're attached to:
  Serial.print("SSID: ");
  Serial.println(WiFi.SSID());

  // print your WiFi shield's IP address:
  IPAddress ip = WiFi.localIP();
  Serial.print("IP Address: ");
  Serial.println(ip);

  // print the received signal strength:
  long rssi = WiFi.RSSI();
  Serial.print("signal strength (RSSI):");
  Serial.print(rssi);
  Serial.println(" dBm");
}

Arduino output terminal

...
Wrote 698288 bytes (443959 compressed) at 0x00010000 in 7.8 seconds (effective 718.3 kbit/s)...
Hash of data verified.
Compressed 3072 bytes to 128...
Writing at 0x00008000... (100 %)
Wrote 3072 bytes (128 compressed) at 0x00008000 in 0.1 seconds (effective 385.7 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...

Serial terminal

status == WL_DISCONNECTED
Wifi.begin: 6
Attempting to connect to SSID: BumBeo
Wifi.status: 3

M5StickC-Plus with MLX90640

Hello
I was using M5stickC and MLX90640. After some time, I bought the M5stickc plus. The advantage of M5stickc plus is that it has a large LCD, but when used with the MLX90640, the screen is displayed small. I am not good at Arduino, so I modified the source, but I did not get the desired result. Please modify it so that it is displayed on the full screen of m5stickc plus.

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.