Giter Club home page Giter Club logo

Comments (5)

animevietsub avatar animevietsub commented on June 6, 2024 1

Make sure that you have ELM327::begin in the void setup().
In your code that should be something like:

void setup()
{
  pinMode(LED_BUILTIN, OUTPUT);
  digitalWrite(LED_BUILTIN, HIGH);

  DEBUG_PORT.begin(115200);
  ELM_PORT.begin("ESP32test", true);
  delay(10000);
  DEBUG_PORT.println("Attempting to connect to ELM327...");

  if (!ELM_PORT.connect("MIS-PENRIGHT-PC"))
  {
    DEBUG_PORT.println("Couldn't connect to OBD scanner");
    while (1);
  }

  if (!myELM327.begin(Serial1, true, 2000))
  {
    Serial.println("Couldn't connect to OBD scanner");
    while (1);
  }

  DEBUG_PORT.println("Connected to ELM327");
  DEBUG_PORT.println("Ensure your serial monitor line ending is set to 'Carriage Return'");
  DEBUG_PORT.println("Type and send commands/queries to your ELM327 through the serial monitor");
  DEBUG_PORT.println();
}

from elmduino.

penright avatar penright commented on June 6, 2024 1

I deleted my previous post, it was way off although it did point me in the right direction. It caused me to go back to the example "https://github.com/PowerBroker2/ELMduino/blob/master/examples/ESP32_Bluetooth_Serial/ESP32_Bluetooth_Serial.ino"

I am guessing where I got confused was between learning to connect to the Bluetooth and ELMduino library. Caught my mistake, @animevietsub was right, in cutting and pasting I missed the myELM327.begin.

Most of my class experience was with .NET. After searching and learning more about C++ class constructor/destructor and typing the deleted response. I saw the errors of my way. I figured it had to be a dumb mistake which is why it was a question and not a bug. :-) Sorry for the confusion. Phase 2 errored when setting the SP (AT SP0). That could be an issue with my emulator, I will need to do some digging. I am going to close this issue. Thanks all.

from elmduino.

PowerBroker2 avatar PowerBroker2 commented on June 6, 2024

I'm not sure what's causing this issue. Perhaps try changing the third argument in sendCommand()'s memset() call?

from elmduino.

penright avatar penright commented on June 6, 2024

Give me some time, I have always just pointed to a lib, using PlatformIO, and never have tried to modify one. I want to learn, let me do some searching on what to do and I will get back. I tried to patch it to turn on debug, but that did not work.
Once I get it figured out, What should I change it to?
Screenshot
image

Is there a way from the main setup to enable debugging? I tried myELM327.debugMode = True.
I also tried to hardcode it in the formatQueryArray, which is why I don't think I have to modify libs down. :-)
image
I was expecting this to dump to the serial monitor.

EDIT:
I just changed some in the code to test, on propose created a syntax error. I did get a compile error. So I may be in the wrong area.
Nope, right area, after fixing the syntax error, and recompile, I did get the serial output I was expecting.
image

from elmduino.

penright avatar penright commented on June 6, 2024

Should PAYLOAD_LEN be 0 at this point?

This is the only place I found where PAYLOAD was set

bool ELM327::begin(Stream &stream, const bool &debug, const uint16_t &timeout, const char &protocol, const uint16_t &payloadLen, const byte &dataTimeout)
{
	elm_port = &stream;
	PAYLOAD_LEN = payloadLen;
	debugMode = debug;
	timeout_ms = timeout;

	Serial.println("begin - payloadLen: " + payloadLen);
	payload = (char *)malloc(PAYLOAD_LEN + 1); // allow for terminating '\0'

	// test if serial port is connected
	if (!elm_port)
		return false;

	// try to connect
	if (!initializeELM(protocol, dataTimeout))
		return false;

	return true;
}

As you can see, I added a Serial.println() in that function and I did not see it executed.
Is that a difference between Bluetooth and Serial?

The bottom line, I don't think the memory is being allocated.

I added a Serial.println above the memset to see and I was getting the error on strlen().
image
image

from elmduino.

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.