Git Product home page Git Product logo

Comments (3)

JoaoLopesF avatar JoaoLopesF commented on May 15, 2024

Hi, I too have projects with some cpp and h files
Works with cpp class or not.

To do RemoteDebug in each cpp, please do this:

----- INO ----

void setup() {

// Your code .....

test_SetRemoteDebug(Debug);

// Or if it is a class

test.setRemoteDebug(Debug);

}

----- CPP (not class) ----
#include "RemoteDebug.h"
static RemoteDebug *_Debug; // static -> private - for only this file

void test_SetRemoteDebug(RemoteDebug *Debug) {
_Debug = Debug;
}

void test1() {

uint8_t a = 2 + 2;

// Debug
if(_Debug->isActive(_Debug->VERBOSE)) {
_Debug->printf("test1: a-> %d\n", a);
}
}


Its clear now ?

Regards

Joao

from remotedebug.

lawrence-jeff avatar lawrence-jeff commented on May 15, 2024

Thank you for the reply, I very much appreciate the help as I use your library in another project and really like it, but still not having much luck in this case - I'm sure it's something I am doing based on my lack of familiarity with the ++ side of C, I am working on a fork so am stuck with this structure. Here is what I tried. Taking your approach I added the line
test_SetRemoteDebug(Debug);
to the setup loop in the ino file, and added the other pieces to one of the .cpp files in my project (tweaked it with a single debug line). I didn't add any include or object instantiation in the ino file (since you didn't mention this) When compiling it errors on the ino file saying 'Debug' was not declared in this scope. I thought maybe I also needed to do the object creation in the ino so then tried adding
RemoteDebug Debug;
So then upon compile the error changed to

ogMainArduino:42: error: 'test_SetRemoteDebug' was not declared in this scope

But still no luck - tried a few other things but it doesn't like any of them.

If it makes it easier to see -the project link is below. For my testing/attempt I was trying to add a debug line to espconnect.cpp (and once I had a working example extend that to main.cpp and opengarage.cpp)

https://github.com/lawrence-jeff/OpenGarage-Firmware/tree/master/OpenGarage

Any pointers?

from remotedebug.

svenove avatar svenove commented on May 15, 2024

I'm struggling with the same thing.
INO:

RemoteDebug Debug;
HanReader hanReader;
setup() {
  Debug.begin("AMS2MQTT", Debug.INFO);   
  hanReader.setRemoteDebug(Debug);
}

HanReader.cpp:

#include <RemoteDebug.h>
#include "HanReader.h"

static RemoteDebug *_Debug; // static -> private - for only this file

HanReader::HanReader()
{

}

void HanReader::setRemoteDebug(RemoteDebug *Debug) {
  _Debug = Debug;
}

HanReader.h:

class HanReader
{
public:
  void setRemoteDebug(RemoteDebug *Debug);
}

Error when compiling:

AmsToMqttBridge.ino: In function 'void setup()':

AmsToMqttBridge:75: error: no matching function for call to 'HanReader::setRemoteDebug(RemoteDebug&)'

     hanReader.setRemoteDebug(Debug);

                                   ^

AmsToMqttBridge.ino:75:35: note: candidate is:

In file included from AmsToMqttBridge.ino:13:0:

libraries\HanReader/HanReader.h:21:7: note: void HanReader::setRemoteDebug(RemoteDebug*)

  void setRemoteDebug(RemoteDebug *Debug);

       ^

libraries\HanReader/HanReader.h:21:7: note:   no known conversion for argument 1 from 'RemoteDebug' to 'RemoteDebug*'

exit status 1
no matching function for call to 'HanReader::setRemoteDebug(RemoteDebug&)'

It's probably just a silly error, but I'm unable to figure it out... :(

from remotedebug.

Related Issues (20)

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.