Before logging an issue, please update to the latest release of Visual Micro from the Downloads Page.

When Logging a Support Issue in the Forum, please ensure you have also:-

  • Enabled vMicro > Compiler > Show Build Properties
  • Re-Compile your program with these settings enabled
 
Save the new Output to a Text File and....
  • Click the Reply button and attach as .txt file OR
  • Click here to Email us with the file attached, and a link to your post
Support requests without the output above may be impossible to answer, so please help us to help you
 
Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic trouble creating local version of adafruit library (Read 1280 times)
jimf
Junior Member
**
Offline


Posts: 16
Joined: May 30th, 2015
trouble creating local version of adafruit library
Mar 25th, 2021 at 8:59pm
Print Post  
Hi, I'm working with ESP32 and the adafruit seesaw library, which has a known bug....that has not been fixed for over a year.  I want to debug the adafruit seesaw library and am running into trouble.  Please bear with me:

The installed adafruit library is with the other installed libraries and exists in a folder named C:\Users\jimfr\OneDrive\Arduino\libraries\Adafruit_seesaw_Library.

I have a solution in VS2019 named Temptester_ESP32 which I'm using to test different sensors for my project.  That solution has several projects, one of which is named soilsensor_example.  This project is the focus of my question.  soilsensor_example lives in C:\Users\jimfr\OneDrive\Arduino\My Examples\soilsensor_example.  I copied the Adafruit_seesaw_library into the soilsensor_example folder.  My code has the following include: #include ".\Adafruit_seesaw_Library\Adafruit_seesaw.h".  VS finds this.  When I'm peeking at definitions in the Adafruit_seesaw.h, it is looking into the local version (I added a comment to the header file to tell which one I'm looking at).  

getting to the problem:  when I build soilsensor_example, I get errors in the attached....indicating that there are duplicate definitions of the methods.  When I look at the External Dependencies folder in the Solution Explorer (for that project), it lists Adafruit_seesaw.h twice.  The properties for those dependencies show that one is pointing to the standard library and the other is pointing to the local library.  I tried to remove the external dependency listed for the standard library by right clicking and cutting it....but I get an error from VS "The operation could not be completed. Not enough memory resources are available to complete this operation."  I don't believe this....there are 8 gigs of available RAM.  I shut VS down, restarted, and got the same error.

Soooooo, my questions:
1) am I approaching this the correct way....creating a local copy of header and .cpp with the intent of debugging the .cpp?
2) If I am approaching this the correct way, then is deleting the external dependency of the installed library the way to go?
3) what should be my next steps?

many thanks.......jim

#include ".\Adafruit_seesaw_Library\Adafruit_seesaw.h"
#include <seesaw_servo.h>
#include <seesaw_neopixel.h>
#include <seesaw_motor.h>
#include <Adafruit_TFTShield18.h>
#include <Adafruit_NeoTrellis.h>
#include <Adafruit_miniTFTWing.h>
#include <Adafruit_Crickit.h>
#include <Wire.h>

//------- I2C bus define -------
#define I2C_SDA 21
#define I2C_SCL 22
TwoWire I2C = TwoWire(0); //---ESP32---

//-----soil sensor -------------
Adafruit_seesaw ss(&I2C);   //---ESP32---
//Adafruit_seesaw ss(0);    //---MEGA---
#define MoID 0x36

void setup() {
  Serial.begin(115200);
  //Wire.begin(); //---MEGA---
  I2C.begin(I2C_SDA, I2C_SCL, 100000); //---ESP32---

  Serial.println("seesaw Soil Sensor example!");
   
  if (!ss.begin(MoID)) {
    Serial.println("ERROR! seesaw not found");
    while(1);
  } else {
    Serial.print("seesaw started! version: ");
    Serial.println(ss.getVersion(), HEX);
  }
}

void loop() {
  float tempC = ss.getTemp();
  Serial.print("tempC="); Serial.println(tempC);
uint16_t capread = ss.touchRead(0);

  Serial.print("Temperature: "); Serial.print(tempC); Serial.println("*C");
  Serial.print("Capacitive: "); Serial.println(capread);
  delay(1000);
}
« Last Edit: Mar 25th, 2021 at 9:01pm by jimf »  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2173
Joined: Feb 13th, 2019
Re: trouble creating local version of adafruit library
Reply #1 - Mar 26th, 2021 at 5:31am
Print Post  
Thanks for the report.

To ensure a specific library is in use, using the Shared projects functionality is the easiest way to avoid confusion / conflicts:
vMicro > Add Library > "Create Shared Project When Including Libraries" 

This is also shown in the below videos:
Control Arduino Libraries with Shared Library Projects
Debugging Arduino Libraries (Without Code Modification)
  
Back to top
 
IP Logged
 
jimf
Junior Member
**
Offline


Posts: 16
Joined: May 30th, 2015
Re: trouble creating local version of adafruit library
Reply #2 - Apr 9th, 2021 at 8:54pm
Print Post  
Thanks.....that did it.  Because I wanted to debug a library that I didn't create, I also cloned it in the project.  I continued to get build errors until I added a new simple project to the solution, copied/pasted my code into the new project, added the library and cloned it to the project I just added, then removed the prior project that was getting the errors.  The build on the new project worked fine.  Thanks again.....jimf.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint