Start a new topic

disable dbSerial?

Hello,

How can I disable the dbSerial output? I have finished testing/debugging, so I no longer need the debug output. Also unfortunately, my micro only has 2 uarts, and I need both (one for nextion, one for gps connection). I'd rather not use an extra software serial if I don't have to.


As I understand, the serial connection gets closed when you click on 'Disconnect' in the Debug window, or when you close the Debug window. Then you can use your serial port for anything else. I'm not sure if I understand what you mean with "disable dbSerial" ?


1 person likes this

Allow me to clarify; I'm not referring to the nextion editor. I mean with my final project, how can I disable the automatic debug output on whichever uart I define as dbSerial? My micro only has 2 hw uarts, and I need one for the nextion connection and one for a gps. I am sorry if I am having trouble conveying my meaning. The nextion library outputs stuff on dbSerial during a pop event. I don't want it to do this. Thanks in advance.

I'm still not sure about what you call "dbSerial", but maybe it's not so important. Do you use this name in the program for your microcontroller ?


The output messages you talk about, are they like "0X65 0Xxx 0Xxx 0X00 0Xff 0Xff 0Xff" on touch release events in touch areas ? Or which "Nextion library" are you referring to ?


As part of the Arduino Nextion library, there is a file called NexSerialConfig.h and in this file one must define 2 serial interfaces. One for the connection to the nextion, called nexSerial, and one for the debug information from the library, called dbSerial. During a 'push' or 'pop' event, the library outputs debug data on dbSerial. What I am trying to do is either 1.) Completely disble the debug output. or 2.) Somehow point that dbSerial reference to a kind of dummy serial port (if that exists?), without using my precious resources for a softwareserial that I not only don't want nor need. As I mentioned in my previous message I only have 2 hardware uarts, and I need both. I do not need the debug info from the library. I hope that this has finally clarified what I am trying to do. If not, then I truly apologize for not being able to say what I mean.


1 person likes this

sorry, i pasted a word into my previous message and it forced me to change all of my text to a larger font.

Andrew, I know exactly what you are saying in there should be a compiler directive to disable debug output entirely IMO. Once they release the code officially, I may do a PR to add the conditional. I do that in all my code.

1 person likes this

Now I understand, thank you for the clarification !!


I see now on https://github.com/itead/ITEADLIB_Arduino_Nextion/commit/0bde200258a2545991cf1633a7f6d9c380a458f0 that the file 'NexSerialConfig.h' was introduced 3 days ago. 

'dbSerial' and 'nexSerial' didn't exist in the first version of the library.


Maybe ITEAD's idea is that the debug messages should be sent to PC on the USB serial connection, while messages to the display are sent on a UART connection. 

That's how it usually works on the Teensy board, where 'Serial' is the USB connection, while 'Serial1', 'Serial2' and 'Serial3' are hardware UART connections.

https://www.pjrc.com/teensy/td_uart.html


Otherwise I agree with you that it should be possible to deactivate dbSerial in the NexSerialConfig.h file.

//#define dbSerial Serial


The files using dbSerial should check first if dbSerial is defined or not. 

void NexTouch::print(void)
{
    CHECK FIRST IF dbSerial IS DEFINED, OTHERWISE DON'T RUN THIS CODE !!!
    dbSerial.print("[");
    dbSerial.print((uint32_t)this);
    dbSerial.print(":");
    dbSerial.print(pid);
    dbSerial.print(",");
    dbSerial.print(cid);
    dbSerial.print(",");
    if (name)
    {
        dbSerial.print(name);
    }
    else
    {
        dbSerial.print("(null)");
    }
    dbSerial.print(",");
    dbSerial.print((uint32_t)cbPush);
    dbSerial.print(",");
    dbSerial.print((uint32_t)cbPop);
    dbSerial.println("]");
}

 I hope ITEAD will give us a clarification...

The library has been changing frequently. When I first posted this topic, dbSerial and nexSerial were defined in NexTouch.h Hopefully we will hear some more from itead soon. :)

As you see,in the file NexSerialConfig.h :dbSerial is for output debug information,nexSerial is for communicate with Nextion screen. We have released new version of the  Nextion screen lib.

In the new library ,you can edit  the related macros in the file NexSerialConfig.h to enable or disable the debug information. 


https://github.com/itead/ITEADLIB_Arduino_Nextion


Thanks.


1 person likes this
Login or Signup to post a comment