Error compiling JoyC_&_RoverC/Master/Master.ino



  • I try to compile the code from https://github.com/m5stack/M5StickC-Plus/blob/master/examples/KIT/JoyC_%26_RoverC/Master/Master.ino
    under Arduino: 1.8.19 (Windows 10), Board: "M5Stick-C-Plus, Default, 1500000, None"
    But i get an error:

    RoverC:88:23: error: 'I2C_ERROR_NO_BEGIN' was not declared in this scope
    
     uint8_t IIC_ReState = I2C_ERROR_NO_BEGIN;
    
                           ^~~~~~~~~~~~~~~~~~
    
    C:\Users\toro\Documents\Arduino\RoverC\RoverC.ino:88:23: note: suggested alternative: 'ESP_ERR_NO_MEM'
    
     uint8_t IIC_ReState = I2C_ERROR_NO_BEGIN;
    
                           ^~~~~~~~~~~~~~~~~~
    
                           ESP_ERR_NO_MEM
    

    The answer is in the error, following the suggestion fixes the error.

    Now, besides that it works i have no idea if the replacement is correct logically. The Const-Names suggest yes, but there might be more to it...
    If the replacement is universally ok, should a github pull request be made?

    EDIT:
    There is an error/warning thrown that i had overlooked.
    So, just doing the replacement seems like not enough...

    RoverC.ino.cpp:1:
    ...\AppData\Local\Arduino15\packages\m5stack\hardware\esp32\2.0.2/
    tools/sdk/esp32/include/esp_common/include/esp_err.h:31:37: 
    warning: unsigned conversion from 'int' to 'uint8_t' {aka 'unsigned char'} changes value from '257' to '1' [-Woverflow]
     #define ESP_ERR_NO_MEM              0x101   /*!< Out of memory */
                                         ^~~~~
    ...\Arduino\RoverC\RoverC.ino:88:23: note: in expansion of macro 'ESP_ERR_NO_MEM'
     uint8_t IIC_ReState = ESP_ERR_NO_MEM;
                           ^~~~~~~~~~~~~~
    


  • @sirtet Change "I2C_ERROR_NO_BEGIN" to "ESP_OK". The git for M5StickC-Plus has already been fixed with this. The fix also works for the M5StickC code.